// Поддержка меню
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 = '
'; // открывающий тег обертки
$wrap_after = '
'; // закрывающий тег обертки
$sep = ''; // разделитель между "крошками"
$sep_before = ''; // тег перед разделителем
$sep_after = ''; // тег после разделителя
$show_home_link = 1; // 1 - показывать ссылку "Главная", 0 - не показывать
$show_on_home = 0; // 1 - показывать "хлебные крошки" на главной странице, 0 - не показывать
$show_current = 1; // 1 - показывать название текущей страницы, 0 - не показывать
$before = ''; // тег перед текущей "крошкой"
$after = ''; // тег после текущей "крошки"
/* === КОНЕЦ ОПЦИЙ === */
global $post;
$home_link = home_url('/');
$link_before = '';
$link_after = '';
$link_attr = ' itemprop="url"';
$link_in_before = '';
$link_in_after = '';
$link = $link_before . '' . $link_in_before . '%2$s' . $link_in_after . '' . $link_after;
$link_root = $link_before . '' . $link_in_before . '%2$s' . $link_in_after . '' . $link_after;
$frontpage_id = get_option('page_on_front');
$parent_id = $post->post_parent;
$sep = ' ' . $sep_before . $sep . $sep_after . ' ';
if (is_home() || is_front_page()) {
if ($show_on_home) echo $wrap_before . '' . $text['home'] . '' . $wrap_after;
} else {
echo $wrap_before;
if ($show_home_link) echo sprintf($link_root, $home_link, $text['home']);
if ( is_category() ) {
$cat = get_category(get_query_var('cat'), false);
if ($cat->parent != 0) {
$cats = get_category_parents($cat->parent, TRUE, $sep);
$cats = preg_replace("#^(.+)$sep$#", "$1", $cats);
$cats = preg_replace('#]+)>([^<]+)<\/a>#', $link_before . '' . $link_in_before . '$2' . $link_in_after .'' . $link_after, $cats);
if ($show_home_link) echo $sep;
echo $cats;
}
if ( get_query_var('paged') ) {
$cat = $cat->cat_ID;
echo $sep . sprintf($link, get_category_link($cat), get_cat_name($cat)) . $sep . $before . sprintf($text['page'], get_query_var('paged')) . $after;
} else {
if ($show_current) echo $sep . $before . sprintf($text['category'], single_cat_title('', false)) . $after;
}
} elseif ( is_search() ) {
if (have_posts()) {
if ($show_home_link && $show_current) echo $sep;
if ($show_current) echo $before . sprintf($text['search'], get_search_query()) . $after;
} else {
if ($show_home_link) echo $sep;
echo $before . sprintf($text['search'], get_search_query()) . $after;
}
} elseif ( is_day() ) {
if ($show_home_link) echo $sep;
echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $sep;
echo sprintf($link, get_month_link(get_the_time('Y'), get_the_time('m')), get_the_time('F'));
if ($show_current) echo $sep . $before . get_the_time('d') . $after;
} elseif ( is_month() ) {
if ($show_home_link) echo $sep;
echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y'));
if ($show_current) echo $sep . $before . get_the_time('F') . $after;
} elseif ( is_year() ) {
if ($show_home_link && $show_current) echo $sep;
if ($show_current) echo $before . get_the_time('Y') . $after;
} elseif ( is_single() && !is_attachment() ) {
if ($show_home_link) echo $sep;
if ( get_post_type() != 'post' ) {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
printf($link, $home_link . '/' . $slug['slug'] . '/', $post_type->labels->singular_name);
if ($show_current) echo $sep . $before . get_the_title() . $after;
} else {
$cat = get_the_category(); $cat = $cat[0];
$cats = get_category_parents($cat, TRUE, $sep);
if (!$show_current || get_query_var('cpage')) $cats = preg_replace("#^(.+)$sep$#", "$1", $cats);
$cats = preg_replace('#]+)>([^<]+)<\/a>#', $link_before . '' . $link_in_before . '$2' . $link_in_after .'' . $link_after, $cats);
echo $cats;
if ( get_query_var('cpage') ) {
echo $sep . sprintf($link, get_permalink(), get_the_title()) . $sep . $before . sprintf($text['cpage'], get_query_var('cpage')) . $after;
} else {
if ($show_current) echo $before . get_the_title() . $after;
}
}
// custom post type
} elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) {
$post_type = get_post_type_object(get_post_type());
if ( get_query_var('paged') ) {
echo $sep . sprintf($link, get_post_type_archive_link($post_type->name), $post_type->label) . $sep . $before . sprintf($text['page'], get_query_var('paged')) . $after;
} else {
if ($show_current) echo $sep . $before . $post_type->label . $after;
}
} elseif ( is_attachment() ) {
if ($show_home_link) echo $sep;
$parent = get_post($parent_id);
$cat = get_the_category($parent->ID); $cat = $cat[0];
if ($cat) {
$cats = get_category_parents($cat, TRUE, $sep);
$cats = preg_replace('#]+)>([^<]+)<\/a>#', $link_before . '' . $link_in_before . '$2' . $link_in_after .'' . $link_after, $cats);
echo $cats;
}
printf($link, get_permalink($parent), $parent->post_title);
if ($show_current) echo $sep . $before . get_the_title() . $after;
} elseif ( is_page() && !$parent_id ) {
if ($show_current) echo $sep . $before . get_the_title() . $after;
} elseif ( is_page() && $parent_id ) {
if ($show_home_link) echo $sep;
if ($parent_id != $frontpage_id) {
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
if ($parent_id != $frontpage_id) {
$breadcrumbs[] = sprintf($link, get_permalink($page->ID), get_the_title($page->ID));
}
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ($i = 0; $i < count($breadcrumbs); $i++) {
echo $breadcrumbs[$i];
if ($i != count($breadcrumbs)-1) echo $sep;
}
}
if ($show_current) echo $sep . $before . get_the_title() . $after;
} elseif ( is_tag() ) {
if ( get_query_var('paged') ) {
$tag_id = get_queried_object_id();
$tag = get_tag($tag_id);
echo $sep . sprintf($link, get_tag_link($tag_id), $tag->name) . $sep . $before . sprintf($text['page'], get_query_var('paged')) . $after;
} else {
if ($show_current) echo $sep . $before . sprintf($text['tag'], single_tag_title('', false)) . $after;
}
} elseif ( is_author() ) {
global $author;
$author = get_userdata($author);
if ( get_query_var('paged') ) {
if ($show_home_link) echo $sep;
echo sprintf($link, get_author_posts_url($author->ID), $author->display_name) . $sep . $before . sprintf($text['page'], get_query_var('paged')) . $after;
} else {
if ($show_home_link && $show_current) echo $sep;
if ($show_current) echo $before . sprintf($text['author'], $author->display_name) . $after;
}
} elseif ( is_404() ) {
if ($show_home_link && $show_current) echo $sep;
if ($show_current) echo $before . $text['404'] . $after;
} elseif ( has_post_format() && !is_singular() ) {
if ($show_home_link) echo $sep;
echo get_post_format_string( get_post_format() );
}
echo $wrap_after;
}
} // end of dimox_breadcrumbs()
function strip_more($content) {
$content = preg_replace('/<\/span>|<\/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 ' . "\r\n" . "Content-type: text/html; charset=utf-8" . "\r\n";
wp_mail( $to, $subject, $message, $headers );
die();
}
}
add_action( 'init', 'send_mail_feedback' );
function send_mail_callback(){
if(isset($_POST['callback'])){
$name = htmlspecialchars(strip_tags($_POST['name']));
$phone = htmlspecialchars(strip_tags($_POST['phone']));
$to = "pr@diamed.ru,tec@diamed.ru,z25x27y31@gmail.com";
$subject = "Невынашивание | Обратный звонок";
$message = "Имя: $name
Телефон: $phone";
$headers = 'From: nevynashivanie.ru ' . "\r\n" . "Content-type: text/html; charset=utf-8" . "\r\n";
wp_mail( $to, $subject, $message, $headers );
die();
}
}
add_action( 'init', 'send_mail_callback' );
class Walker_Category_Custom extends Walker_Category {
function start_lvl(&$output, $depth=0, $args=array()) {
//$output .= "\n\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' ] );
} );
}
XML SitemapXML Sitemap Index
This is a XML Sitemap which is supposed to be processed by search engines which follow the XML Sitemap standard like Ask.com, Bing, Google and Yahoo.
It was generated using the Blogging-Software WordPress and the Google Sitemap Generator Plugin by Arne Brachhold.
You can find more information about XML sitemaps on sitemaps.org and Google's list of sitemap programs.
This file contains links to sub-sitemaps, follow them to see the actual sitemap content.