// Поддержка меню if (function_exists('add_theme_support')) { add_theme_support('menus'); add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); } function enqueue_styles() { //wp_enqueue_style( 'dev-style', get_stylesheet_uri()); wp_register_style('font-style', 'https://fonts.googleapis.com/css?family=Open+Sans:400,700'); wp_enqueue_style( 'font-style'); wp_register_style('site-styles', get_template_directory_uri() . '/css/styles.css'); wp_enqueue_style( 'site-styles'); wp_register_style('jquery-ui', get_template_directory_uri() . '/css/jquery-ui.min.css'); wp_enqueue_style( 'jquery-ui'); } add_action('wp_enqueue_scripts', 'enqueue_styles'); function enqueue_scripts () { wp_register_script('gl-jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js');wp_enqueue_script('gl-jquery'); wp_register_script('jquery-ui', get_template_directory_uri() . '/js/jquery-ui.min.js'); wp_enqueue_script('jquery-ui'); wp_register_script('slick', get_template_directory_uri() . '/js/slick.min.js'); wp_enqueue_script('slick'); wp_register_script('pop-up', get_template_directory_uri() . '/js/pop-up.js'); wp_enqueue_script('pop-up'); wp_register_script('mobile-menu', get_template_directory_uri() . '/js/mobile-menu.js'); wp_enqueue_script('mobile-menu'); wp_register_script('scripts', get_template_directory_uri() . '/js/scripts.js'); wp_enqueue_script('scripts'); } add_action('wp_enqueue_scripts', 'enqueue_scripts'); function dimox_breadcrumbs() { /* === ОПЦИИ === */ $text['home'] = 'Главная'; // текст ссылки "Главная" $text['category'] = '%s'; // текст для страницы рубрики //$text['search'] = 'Результаты поиска по запросу "%s"'; // текст для страницы с результатами поиска $text['search'] = 'Результаты поиска'; $text['tag'] = 'Записи с тегом "%s"'; // текст для страницы тега $text['author'] = 'Статьи автора %s'; // текст для страницы автора $text['404'] = 'Ошибка 404'; // текст для страницы 404 $text['page'] = 'Страница %s'; // текст 'Страница N' $text['cpage'] = 'Страница комментариев %s'; // текст 'Страница комментариев N' $wrap_before = '
'; // закрывающий тег обертки $sep = ''; // разделитель между "крошками" $sep_before = ''; // тег перед разделителем $sep_after = ''; // тег после разделителя $show_home_link = 1; // 1 - показывать ссылку "Главная", 0 - не показывать $show_on_home = 0; // 1 - показывать "хлебные крошки" на главной странице, 0 - не показывать $show_current = 1; // 1 - показывать название текущей страницы, 0 - не показывать $before = '<\/span><\/p>/is', '', $content);
return $content;
}
add_filter('the_content', 'strip_more');
function filter_function_name_11( $canonical_url ){
$canonical_url = preg_replace("/\/page\/.*/is", '/', $canonical_url);
return $canonical_url;
}
add_filter( 'wpseo_canonical', 'filter_function_name_11', 10, 2 );
## Отключаем Emojis в WordPress
if(1){
## отключаем DNS prefetch
add_filter('emoji_svg_url', '__return_empty_string');
/**
* Disable the emoji's
*/
add_action( 'init', 'disable_emojis' );
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
/**
* Filter function used to remove the tinymce emoji plugin.
*
* @param array $plugins
* @return array Difference betwen the two arrays
*/
function disable_emojis_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}
}
function get_doctor_exp($y){
$exp = date('Y') - $y;
$num = $exp % 10;
if($num == 1) $str = ' год';
else if($num > 1 && $num < 5) $str = ' года';
else $str = ' лет';
return $exp . $str;
}
function render_form(){
$form = file_get_contents(get_template_directory_uri().'/forms/callback.tpl');
$form = str_replace("%%button%%", 'btn', $form);
//echo $form;
}
function add_comment(){
if(isset($_POST['comment'])){
$name = htmlspecialchars(strip_tags($_POST['name']));
$phone = htmlspecialchars(strip_tags($_POST['phone']));
$email = htmlspecialchars(strip_tags($_POST['email']));
$text = htmlspecialchars(strip_tags($_POST['review']));
$page_id = htmlspecialchars(strip_tags($_POST['to_page']));
$doctor = htmlspecialchars(strip_tags($_POST['doctor']));
if($doctor != $page_id && $doctor > 1) $page_id = $doctor;
if(!$name || !$text || !$page_id) die();
$commentdata = array(
'comment_post_ID' => $page_id,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $phone,
'comment_content' => $text
);
wp_new_comment( $commentdata );
die();
}
}
add_action( 'init', 'add_comment' );
function send_mail_feedback(){
if(isset($_POST['feedback'])){
$name = htmlspecialchars(strip_tags($_POST['name']));
$phone = htmlspecialchars(strip_tags($_POST['phone']));
$doctor = htmlspecialchars(strip_tags($_POST['doctor']));
$to = "pr@diamed.ru,tec@diamed.ru,z25x27y31@gmail.com";
$subject = "Невынашивание | Запись на прием";
$message = "Имя: $name
Телефон: $phone";
if($doctor) $message .= "
К доктору: $doctor";
$headers = 'From: nevynashivanie.ru
Телефон: $phone";
$headers = 'From: nevynashivanie.ru \n";
}
function end_lvl(&$output, $depth=0, $args=array()) {
//$output .= "
\n";
}
function start_el(&$output, $item, $depth=0, $args=array(),$current_object_id = 0) {
/*$output.= '
'.esc_attr($item->name);
*/
$output .= '\n";
}
}
//add_theme_support('post-thumbnails');
//add_image_size('loopThumb', 299, 299, true);
//add_image_size('newsThumb', 82, 82, true);
//add_image_size('galThumb', 140, 140, true);
if ( function_exists( 'add_image_size' ) ) {
add_image_size('articles', '226', '151', true);
add_image_size('usluga', '300', '200', true);
add_image_size('doctors', '200', '200', array( 'right', 'top'));
add_image_size('doctor', '240', '247', true);
add_image_size('smalldoctor', '90', '90', array( 'right', 'top'));
}
## Отключает новый редактор блоков в WordPress (Гутенберг).
## ver: 1.0
if( 'disable_gutenberg' ){
add_filter( 'use_block_editor_for_post_type', '__return_false', 100 );
// отключим подключение базовых css стилей для блоков
// ВАЖНО! когда выйдут виджеты на блоках или что-то еще, эту строку нужно будет комментировать
remove_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' );
// Move the Privacy Policy help notice back under the title field.
add_action( 'admin_init', function(){
remove_action( 'admin_notices', [ 'WP_Privacy_Policy_Content', 'notice' ] );
add_action( 'edit_form_after_title', [ 'WP_Privacy_Policy_Content', 'notice' ] );
} );
}
Страница не найдена