| Server IP : 185.252.147.100 / Your IP : 216.73.217.33 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/html/epauto.ru/wordpress/wp-content/themes/generatepress_child/ |
Upload File : |
<?php
/**
* GeneratePress child theme functions and definitions.
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
*/
// add_action('wp_footer', function () {
// //if (current_user_can('administrator')) {
// global $post;
// if ($post && $post->post_type === 'car') {
// echo '<pre style="position:fixed;bottom:0;background:#fff;padding:10px;z-index:9999;">';
// echo 'engine_type: ' . get_post_meta($post->ID, 'car_engine_type', true);
// echo '</pre>';
// }
// // }
// });
// add_action('wp_footer', function () {
// if (!current_user_can('administrator')) return;
// $cars = get_posts([
// 'post_type' => 'car',
// 'post_status' => 'any',
// 'posts_per_page' => -1,
// ]);
// echo '<div style="position:fixed;bottom:0;left:0;right:0;background:#fff;color:#000;padding:15px;border-top:2px solid red;z-index:99999;max-height:300px;overflow:auto;font-family:monospace;font-size:12px;">';
// echo '<strong>Все автомобили и их engine_type:</strong><br>';
// foreach ($cars as $car) {
// $val = get_post_meta($car->ID, 'car_engine_type', true);
// echo 'ID ' . $car->ID . ' | "' . $car->post_title . '" → engine_type = [' . esc_html($val) . ']<br>';
// }
// echo '</div>';
// });
add_action( 'phpmailer_init', 'smtp_phpmailer_init' );
function smtp_phpmailer_init( $phpmailer ){
$phpmailer->IsSMTP();
$phpmailer->CharSet = 'UTF-8';
$phpmailer->Host = 'smtp.mail.ru';
$phpmailer->Username = 'avto.amiro@mail.ru';
//wp-config
//define( 'SMTP_PASS', 'fzsvjilpxpdybyfi' );
//$phpmailer->Password = SMTP_PASS;
$phpmailer->Password = 'j8HMPlVEsCT5ee3X9iKt';
$phpmailer->SMTPAuth = true;
$phpmailer->SMTPSecure = 'ssl';
$phpmailer->Port = 465;
$phpmailer->From = 'avto.amiro@mail.ru';
$phpmailer->FromName = 'MitrofanovAvto';
$phpmailer->isHTML( true );
}
require_once get_stylesheet_directory() . '/inc/car-sitemap.php';
add_filter('use_block_editor_for_post_type', 'my_disable_gutenberg_for_car', 10, 2);
function my_disable_gutenberg_for_car($use, $post_type) {
if ($post_type === 'car') {
return false;
}
return $use;
}
require_once get_stylesheet_directory() . '/inc/car-post-type.php';
require_once get_stylesheet_directory() . '/inc/car-model-brand-link.php';
require_once get_stylesheet_directory() . '/inc/car-metabox.php';
require_once get_stylesheet_directory() . '/inc/car-validation.php';
require_once get_stylesheet_directory() . '/inc/car-filter.php';
require_once get_stylesheet_directory() . '/inc/car-rest.php';
require_once get_stylesheet_directory() . '/inc/car-shortcodes.php';
require_once get_stylesheet_directory() . '/inc/car-gallery.php';
require_once get_stylesheet_directory() . '/inc/car-popup.php';
require_once get_stylesheet_directory() . '/inc/car-calculator-settings.php';
require_once get_stylesheet_directory() . '/inc/car-calculator.php';
require_once get_stylesheet_directory() . '/inc/contact-form.php';
require_once get_stylesheet_directory() . '/inc/cars-filter-form.php';
/**
* Форматирование числа с разделителем тысяч (пробел)
*/
function my_car_format_number($value, $prefix = '', $suffix = '') {
if ($value === '' || $value === null || $value === false) {
return '';
}
$formatted = number_format((float) $value, 0, '.', ' ');
$result = '';
if ($prefix) $result .= $prefix;
$result .= $formatted;
if ($suffix) $result .= ' ' . $suffix;
return $result;
}
function preload_font() {
?>
<link rel="preload" href="<?= esc_url( get_stylesheet_directory_uri() ); ?>/font/Manrope-VariableFont_wght.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="<?= esc_url( get_stylesheet_directory_uri() ); ?>/font/inter-v20-cyrillic_latin-regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="<?= esc_url( get_stylesheet_directory_uri() ); ?>/font/inter-v20-cyrillic_latin-600.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<?php
}
add_action( 'wp_head', 'preload_font', 2 );
// TO STYLES IN ADMIN
// If you added your CSS in your child theme’s style.css file then add this snippet:
add_filter( 'generate_editor_styles', function( $editor_styles ) {
$editor_styles[] = 'style.css';
return $editor_styles;
} );
// // If you added your CSS in the Customizer > Additional CSS then add this snippet
// add_filter( 'block_editor_settings_all', function( $editor_settings ) {
// $css = wp_get_custom_css_post()->post_content;
// $editor_settings['styles'][] = array( 'css' => $css );
// return $editor_settings;
// } );
add_filter(
'generateblocks_typography_font_family_list',
function( $fonts ) {
$fonts[] = [
'label' => 'My custom fonts',
'options' => [
[
'label' => 'Manrope',
'value' => 'Manrope',
],
[
'label' => 'Inter',
'value' => 'Inter',
],
],
];
return $fonts;
}
);
add_filter( 'generate_copyright', function () {
?>
<span class="copyright">© <?php echo date( 'Y' ); ?> <?php bloginfo( 'name' ); ?>. Все права защищены.</span>
<?php
}, 90);
add_filter( 'wp_nav_menu_items', 'add_extra_item_to_nav_menu', 10, 2 );
function add_extra_item_to_nav_menu( $items, $args ) {
if ($args->theme_location == 'primary' ) {
$items .= '<li class="menu-item menu-item-wa"><a href="https://wa.me/79502878751"><span class="gb-icon" style="line-height: 1; display: block;height: 1em;"><svg aria-hidden="true" role="img" height="1em" width="1em" viewBox="0 0 448 512" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z"></path></svg></span></a></li>';
$items .= '<li class="menu-item menu-item-tg"><a href="https://t.me/asm_epauto"><span class="gb-icon" style="line-height: 1; display: block;height: 1em;"><svg height="1em" width="1em" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M41.42 7.309s3.885-1.515 3.56 2.164c-.107 1.515-1.078 6.818-1.834 12.553l-2.59 16.99s-.216 2.489-2.159 2.922c-1.942.432-4.856-1.515-5.396-1.948-.432-.325-8.094-5.195-10.792-7.575-.756-.65-1.62-1.948.108-3.463L33.649 18.13c1.295-1.3 2.59-4.33-2.806-.65l-15.11 10.28s-1.727 1.083-4.964.109l-7.016-2.165s-2.59-1.623 1.835-3.246c10.793-5.086 24.068-10.28 35.831-15.15" fill="currentColor"></path></svg></span></a></li>';
$items .= '<li id="menu-item-342" class="header-button menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-342"><a href="/#contact" aria-current="page">Заказать</a></li>';
}
return $items;
}