HEX
Server: Apache
System: Linux srv-plesk28.ps.kz 5.14.0-284.18.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 29 17:06:27 EDT 2023 x86_64
User: greencl1 (10085)
PHP: 8.1.33
Disabled: apache_setenv,dl,eval,exec,openlog,passthru,pcntl_exec,pcntl_fork,popen,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,socket_create,socket_create_listen,socket_create_pair,syslog,system,socket_listen,stream_socket_server
Upload Files
File: /var/www/vhosts/greenclinic.kz/newsite/wp-content/themes/green-clinic/functions.php
<?php
/**
 * Green clinic functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Green_clinic
 */

if ( ! defined( '_S_VERSION' ) ) {
	// Replace the version number of the theme on each release.
	define( '_S_VERSION', '1.0.0' );
}
 
add_filter('wpcf7_autop_or_not', '__return_false');
/**
 * Sets up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which
 * runs before the init hook. The init hook is too late for some features, such
 * as indicating support for post thumbnails.
 */
function green_clinic_setup() {
	/*
		* Make theme available for translation.
		* Translations can be filed in the /languages/ directory.
		* If you're building a theme based on Green clinic, use a find and replace
		* to change 'green-clinic' to the name of your theme in all the template files.
		*/
	load_theme_textdomain( 'green-clinic', get_template_directory() . '/languages' );

	// Add default posts and comments RSS feed links to head.
	add_theme_support( 'automatic-feed-links' );

	/*
		* Let WordPress manage the document title.
		* By adding theme support, we declare that this theme does not use a
		* hard-coded <title> tag in the document head, and expect WordPress to
		* provide it for us.
		*/
	add_theme_support( 'title-tag' );

	/*
		* Enable support for Post Thumbnails on posts and pages.
		*
		* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
		*/
	add_theme_support( 'post-thumbnails' );

	// This theme uses wp_nav_menu() in one location.
	register_nav_menus(
		array(
            'header_before' => esc_html__('top header links', 'green-clinic'), 
            'header_menu'   => esc_html__('header menu', 'green-clinic'),
            'footer_menu_1' => esc_html__('footer menu 1 colum', 'green-clinic'),
            'footer_menu_2' => esc_html__('footer menu 2 colum', 'green-clinic'),  
            'footer_menu_3' => esc_html__('footer menu 3 colum', 'green-clinic'),
            'footer_menu_4' => esc_html__('footer menu 4 colum', 'green-clinic')
		)
        
	);

	/*
		* Switch default core markup for search form, comment form, and comments
		* to output valid HTML5.
		*/
	add_theme_support(
		'html5',
		array(
			'search-form',
			'comment-form',
			'comment-list',
			'gallery',
			'caption',
			'style',
			'script',
		)
	);

	

	

	/**
	 * Add support for core custom logo.
	 *
	 * @link https://codex.wordpress.org/Theme_Logo
	 */
	add_theme_support(
		'custom-logo',
		array(
			'flex-width'  => true,
			'flex-height' => true,
		)
	);
}
add_action( 'after_setup_theme', 'green_clinic_setup' );
function green_clinic_widgets_init() {
	register_sidebar(
		array(
			'name'          => esc_html__( 'Sidebar', 'green_clinic' ),
			'id'            => 'sidebar-1',
			'description'   => esc_html__( 'Add widgets here.', 'green_clinic' ),
			'before_widget' => '',
			'after_widget'  => '',
			'before_title'  => '',
			'after_title'   => '',
		)
	);
}
add_action( 'widgets_init', 'green_clinic_widgets_init' );
/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function green_clinic_content_width() {
	$GLOBALS['content_width'] = apply_filters( 'green_clinic_content_width', 640 );
}
add_action( 'after_setup_theme', 'green_clinic_content_width', 0 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar

 */ 
/**
 * Enqueue scripts and styles.
 */

function green_clinic_scripts() {
  $url = get_template_directory_uri();

	if ( is_front_page() ) {
    wp_enqueue_style('green-clinic-style', get_stylesheet_uri(), array(), _S_VERSION);
    wp_style_add_data('green-clinic-style', 'rtl', 'replace');

    wp_enqueue_style( 'style-fancy', "{$url}/assets/css/fancybox.css", [] );
    wp_enqueue_style( 'style-main', "{$url}/assets/css/style.min.css", [] );
	
    wp_enqueue_style( 'style-add', "{$url}/assets/css/add.css", [] );
    wp_enqueue_style( 'style-media', "{$url}/assets/css/media.css", [] );
    wp_enqueue_script( 'fancy-js', "{$url}/assets/js/fancybox.umd.js", ['jquery'],  _S_VERSION, true);
    wp_enqueue_script( 'wow-js', "{$url}/assets/js/wow.min.js", ['jquery'],  _S_VERSION, true);
    wp_enqueue_script( 'app-js', "{$url}/assets/js/app.js", ['jquery'], false, true );
    wp_enqueue_script( 'main-js', "{$url}/assets/js/main.min.js", ['jquery'],  _S_VERSION, true);
	 
	} else {
		
		wp_enqueue_style( 'style-fancy', "{$url}/assets/css/fancybox.css", [] );
		wp_enqueue_style( 'style-swiper', "{$url}/assets/css/swiper-bundle.min.css", [] );
		wp_enqueue_style( 'style-global', "{$url}/assets/css/global.css", [] );
		wp_enqueue_style( 'style-main', "{$url}/assets/css/style.min.css", [] );
		wp_enqueue_style( 'style-pages', "{$url}/assets/css/pages.css", [] );
		wp_enqueue_style( 'style-add', "{$url}/assets/css/add.css", [] );
		wp_enqueue_style( 'style-media', "{$url}/assets/css/media.css", [] );
		wp_enqueue_script( 'swiper-js', "{$url}/assets/js/swiper-bundle.min.js", array('jquery'),  _S_VERSION, false);
		wp_enqueue_script( 'fancy-js', "{$url}/assets/js/fancybox.umd.js", array('jquery'),  _S_VERSION, true);
		wp_enqueue_script( 'wow-js', "{$url}/assets/js/wow.min.js", array('jquery'),  _S_VERSION, true);
		wp_enqueue_script( 'main-js', "{$url}/assets/js/main.min.js", array('jquery'),  _S_VERSION, true);
		
		wp_enqueue_script( 'app-js', "{$url}/assets/js/app.js", array('jquery'), false, true );
	}
	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 
		wp_enqueue_script( 'comment-reply' );
		
	}
}

add_action( 'wp_enqueue_scripts', 'green_clinic_scripts' );


add_filter( 'get_the_archive_title', function( $title ){
	return preg_replace('~^[^:]+: ~', '', $title );
});


function cc_mime_types($mimes) {
    $mimes['svg'] = 'image/svg+xml';
    return $mimes;
  }
  add_filter('upload_mimes', 'cc_mime_types');
/**
 * Implement the Custom Header feature.
 */


/**
 * Custom template tags for this theme.
 */
require get_template_directory() . '/inc/template-tags.php';

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require get_template_directory() . '/inc/template-functions.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/inc/customizer.php';

/**
 * Load Jetpack compatibility file.
 */
if ( defined( 'JETPACK__VERSION' ) ) {
	require get_template_directory() . '/inc/jetpack.php';  
}

function custom_acf_get_field_name_by_key( $key ) {

    $field = acf_maybe_get_field( $key );

    if ( empty( $field ) || ! isset( $field['parent'], $field['name'] ) ) {
        return $field;
    }

    $ancestors = array();

    while ( ! empty( $field['parent'] ) && ! in_array( $field['name'], $ancestors ) ) {

        $parent = acf_get_field( $field['parent'] );

        $ancestors[] = $field['name'];

        $field = $parent;

    }

    $formatted_key = array_reverse( $ancestors );
    $formatted_key = implode( '_', $formatted_key );

    return "_$formatted_key";

}

// Register the AJAX handlers
add_action('wp_ajax_search_prices', 'handle_search_prices');
add_action('wp_ajax_nopriv_search_prices', 'handle_search_prices');

function handle_search_prices() {
    global $wpdb;

    // Get the search term from the AJAX request
    $term = sanitize_text_field($_POST['term']);
    $cache_key = 'search_prices_' . md5($term);
    $cached_results = get_transient($cache_key);

    if ($cached_results !== false) {
        // If cached results are available, return them
        echo $cached_results;
        wp_die();
    }

    // Prepare the search term for the SQL query
    $term = '%' . $wpdb->esc_like($term) . '%';

    // Perform the SQL query to search for prices
    $query = $wpdb->prepare("
        SELECT p.ID, p.post_title, pm.meta_key, pm.meta_value
        FROM {$wpdb->posts} p
        JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id
        WHERE p.post_type = 'prices'
        AND p.post_status = 'publish'
        AND pm.meta_key LIKE %s
        AND pm.meta_value LIKE %s
    ", 'prices_%', $term);

    ob_start();
    $results = $wpdb->get_results($query);

    if (!empty($results)) {
        foreach ($results as $result) {
            // Render each search result as needed
            echo '<div class="search__results-item">';
            echo '<h3>' . __(esc_html($result->post_title)) . '</h3>';
            echo '<p>' . __(esc_html($result->meta_value)) . '</p>';
            echo '</div>';
        }
    } else {
        echo '<p>No results found</p>';
    }

    $output = ob_get_clean();
    set_transient($cache_key, $output, 12 * HOUR_IN_SECONDS);
    echo $output;
    wp_die();
}


	
	/* ---- Хлебные кошки ----*/
	function dimox_breadcrumbs() {

		/* === ОПЦИИ === */
		$text['home']     = 'Главная'; // текст ссылки "Главная"
		switch(wpm_get_language()){
			case 'ru': 
				$text['home']     = 'Главная'; // текст ссылки "Главная"
				break;
			case 'kz': 
				$text['home']     = 'Басты'; // текст ссылки "Главная"
				break;
			case 'en': 
				$text['home']     = 'Home'; // текст ссылки "Главная"
				break;
		}
		$text['category'] = '%s'; // текст для страницы рубрики
		$text['search']   = 'Результаты поиска по запросу "%s"'; // текст для страницы с результатами поиска
		$text['tag']      = 'Записи с тегом "%s"'; // текст для страницы тега
		$text['author']   = 'Статьи автора %s'; // текст для страницы автора
		$text['404']      = 'Ошибка 404'; // текст для страницы 404
		$text['page']     = 'Страница %s'; // текст 'Страница N'
		$text['cpage']    = 'Страница комментариев %s'; // текст 'Страница комментариев N'

		$wrap_before    = '<div class="breadcrumbs">'; // открывающий тег обертки
		$wrap_after     = '</div><!-- .bread-crambs -->'; // закрывающий тег обертки
		$sep            = ''; // разделитель между "крошками"
		$before         = '<span>'; // тег перед текущей "крошкой"
		$after          = '</span>'; // тег после текущей "крошки"

		$show_on_home   = 0; // 1 - показывать "хлебные крошки" на главной странице, 0 - не показывать
		$show_home_link = 1; // 1 - показывать ссылку "Главная", 0 - не показывать
		$show_current   = 1; // 1 - показывать название текущей страницы, 0 - не показывать
		$show_last_sep  = 1; // 1 - показывать последний разделитель, когда название текущей страницы не отображается, 0 - не показывать
		/* === КОНЕЦ ОПЦИЙ === */

		global $post;
		$home_url       = home_url('/');
		$link           = '<span>';
		$link          .= '<a href="%1$s">%2$s</a>';
		$link          .= '';
		$link          .= '</span>';
		$parent_id      = ( $post ) ? $post->post_parent : '';
		$home_link      = sprintf( $link, $home_url, $text['home'], 1 );
		if ( is_home() || is_front_page() ) {
			if ( $show_on_home ) echo $wrap_before . $home_link . $wrap_after;
		} else {
			$position = 0;
			echo $wrap_before;
			if ( $show_home_link ) {
				$position += 1;
				echo $home_link;
			}
			
			if ( is_category() ) {
				
				$parents = get_ancestors( get_query_var('cat'), 'category' );
				foreach ( array_reverse( $parents ) as $cat ) {
					$position += 1;
					if ( $position > 1 ) echo $sep;
					echo sprintf( $link, get_category_link( $cat ), get_cat_name( $cat ), $position );
				}
				if ( get_query_var( 'paged' ) ) {
					$position += 1;
					$cat = get_query_var('cat');
					echo $sep . sprintf( $link, get_category_link( $cat ), get_cat_name( $cat ), $position );
					echo $sep . $before . sprintf( $text['page'], get_query_var( 'paged' ) ) . $after;
				} else {
					if ( $show_current ) {
						if ( $position >= 1 ) echo $sep;
						echo $before . sprintf( $text['category'], single_cat_title( '', false ) ) . $after;
					} elseif ( $show_last_sep ) echo $sep;
				}
			} elseif ( is_search() ) {
				if ( get_query_var( 'paged' ) ) {
					$position += 1;
					if ( $show_home_link ) echo $sep;
					echo sprintf( $link, $home_url . '?s=' . get_search_query(), sprintf( $text['search'], get_search_query() ), $position );
					echo $sep . $before . sprintf( $text['page'], get_query_var( 'paged' ) ) . $after;
				} else {
					if ( $show_current ) {
						if ( $position >= 1 ) echo $sep;
						echo $before . sprintf( $text['search'], get_search_query() ) . $after;
					} elseif ( $show_last_sep ) echo $sep;
				}
			} elseif ( is_year() ) {
				if ( $show_home_link && $show_current ) echo $sep;
				if ( $show_current ) echo $before . get_the_time('Y') . $after;
				elseif ( $show_home_link && $show_last_sep ) echo $sep;
			} elseif ( is_month() ) {
				if ( $show_home_link ) echo $sep;
				$position += 1;
				echo sprintf( $link, get_year_link( get_the_time('Y') ), get_the_time('Y'), $position );
				if ( $show_current ) echo $sep . $before . get_the_time('F') . $after;
				elseif ( $show_last_sep ) echo $sep;
			} elseif ( is_day() ) {
				if ( $show_home_link ) echo $sep;
				$position += 1;
				echo sprintf( $link, get_year_link( get_the_time('Y') ), get_the_time('Y'), $position ) . $sep;
				$position += 1;
				echo sprintf( $link, get_month_link( get_the_time('Y'), get_the_time('m') ), get_the_time('F'), $position );
				if ( $show_current ) echo $sep . $before . get_the_time('d') . $after;
				elseif ( $show_last_sep ) echo $sep;
			} elseif ( is_single() && ! is_attachment() ) {
				if ( get_post_type() != 'control_category' ) {
					$terms = wp_get_object_terms($post->ID, 'control_category');   
					if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
					$position += 1;
					$post_type = get_post_type_object( get_post_type() );
					$lina = str_replace('%control_category%', $taxonomy_slug, get_post_type_archive_link( $post_type->name ));

					if($post_type->name == 'biznes'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Бизнес-партнерство";
								break;
							case 'kz': 
								$control_text = "Бизнес серіктестік";
								break;
							case 'en': 
								$control_text = "Business partnership";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'konkursy'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Конкурсы";
								break;
							case 'kz': 
								$control_text = "Конкурстар";
								break;
							case 'en': 
								$control_text = "Bidding";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'event'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Конгрессно-выставочные мероприятия";
								break;
							case 'kz': 
								$control_text = "Конгрестік-көрме іс-шаралары";
								break;
							case 'en': 
								$control_text = "Congress and exhibition events";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'media_news'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Медиа";
								break;
							case 'kz': 
								$control_text = "Медиа";
								break;
							case 'en': 
								$control_text = "Media";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'news'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Новости";
								break;
							case 'kz': 
								$control_text = "Жаңалықтар";
								break;
							case 'en': 
								$control_text = "News";
								break;
						}
						if ( $position > 1 ){
              $item = get_page_by_path('/news');
              $lina = get_permalink($item->ID);
							echo $sep;
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'photo-gallery'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Фотогалерея";
								break;
							case 'kz': 
								$control_text = "Фотогалерея";
								break;
							case 'en': 
								$control_text = "Photo Gallery";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'directions'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Направления";
								break;
							case 'kz': 
								$control_text = "Бағыттар";
								break;
							case 'en': 
								$control_text = "Directions";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							switch(wpm_get_language()){
							case 'ru': 
								$lina='https://greenclinic.kz/ru/directions';
								break;
							case 'kz': 
							$lina='https://greenclinic.kz/kz/directions';
								break;
							case 'en': 
								$lina='https://greenclinic.kz/en/directions';
								break;
						}
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'doctors'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Врачи";
								break;
							case 'kz': 
								$control_text = "Дәрігерлер";
								break;
							case 'en': 
								$control_text = "Doctors";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							switch(wpm_get_language()){
							case 'ru': 
								$lina='https://greenclinic.kz/ru/doctors';
								break;
							case 'kz': 
							$lina='https://greenclinic.kz/kz/doctors';
								break;
							case 'en': 
								$lina='https://greenclinic.kz/en/doctors';
								break;
						}
							
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'prices'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Цены";
								break;
							case 'kz': 
								$control_text = "Бағалар";
								break;
							case 'en': 
								$control_text = "Prices";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							switch(wpm_get_language()){
							case 'ru': 
								$lina='https://greenclinic.kz/ru/search';
								break;
							case 'kz': 
							$lina='https://greenclinic.kz/kz/search';
								break;
							case 'en': 
								$lina='https://greenclinic.kz/en/search';
								break;
						}
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}elseif($post_type->name == 'vacancies'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Вакансии";
								break;
							case 'kz': 
								$control_text = "Бос жұмыс орындары";
								break;
							case 'en': 
								$control_text = "Vacancies";
								break;
						}
						if ( $position > 1 ){
							echo $sep;
							echo sprintf( $link, $lina, $control_text, $position );
						}
					}else{
						if ( $position > 1 ){
							echo $sep;
							echo sprintf( $link, $lina, $post_type->labels->name, $position );
						}
					}
					
					

					
					if ( $show_current ) echo $sep . $before . get_the_title() . $after;
					elseif ( $show_last_sep ) echo $sep;
				} elseif ( get_post_type() != 'post' ) {
					$position += 1;
					$post_type = get_post_type_object( get_post_type() );
					if ( $position > 1 ) echo $sep;
					echo sprintf( $link, get_post_type_archive_link( $post_type->name ), $post_type->labels->name, $position );
					if ( $show_current ) echo $sep . $before . get_the_title() . $after;
					elseif ( $show_last_sep ) echo $sep;
				} else {
					$cat = get_the_category(); $catID = $cat[0]->cat_ID;
					$parents = get_ancestors( $catID, 'category' );
					$parents = array_reverse( $parents );
					$parents[] = $catID;
					foreach ( $parents as $cat ) {
						$position += 1;
						if ( $position > 1 ) echo $sep;
						echo sprintf( $link, get_category_link( $cat ), get_cat_name( $cat ), $position );
					}
					if ( get_query_var( 'cpage' ) ) {
						$position += 1;
						echo $sep . sprintf( $link, get_permalink(), get_the_title(), $position );
						echo $sep . $before . sprintf( $text['cpage'], get_query_var( 'cpage' ) ) . $after;
					} else {
						if ( $show_current ) echo $sep . $before . get_the_title() . $after;
						elseif ( $show_last_sep ) echo $sep;
					}
				}
			} elseif ( is_post_type_archive() ) {
				$post_type = get_post_type_object( get_post_type() );
				if ( get_query_var( 'paged' ) ) {
					$position += 1;
					if ( $position > 1 ) echo $sep;
					echo sprintf( $link, get_post_type_archive_link( $post_type->name ), $post_type->label, $position );
					echo $sep . $before . sprintf( $text['page'], get_query_var( 'paged' ) ) . $after;
				} else {
					

					if($post_type->name == 'biznes'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Бизнес-партнерство";
								break;
							case 'kz': 
								$control_text = "Бизнес серіктестік";
								break;
							case 'en': 
								$control_text = "Business partnership";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}elseif($post_type->name == 'konkursy'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Конкурсы";
								break;
							case 'kz': 
								$control_text = "Конкурстар";
								break;
							case 'en': 
								$control_text = "Bidding";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}elseif($post_type->name == 'event'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Конгрессно-выставочные мероприятия";
								break;
							case 'kz': 
								$control_text = "Конгрестік-көрме іс-шаралары";
								break;
							case 'en': 
								$control_text = "Congress and exhibition events";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}elseif($post_type->name == 'directions'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Направления";
								break;
							case 'kz': 
								$control_text = "Бағыттар";
								break;
							case 'en': 
								$control_text = "Directions";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}elseif($post_type->name == 'photo-gallery'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Фотогалерея";
								break;
							case 'kz': 
								$control_text = "Фотогалерея";
								break;
							case 'en': 
								$control_text = "Photo Gallery";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}elseif($post_type->name == 'news'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Новости";
								break;
							case 'kz': 
								$control_text = "Жаңалықтар";
								break;
							case 'en': 
								$control_text = "News";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}elseif($post_type->name == 'doctors'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Врачи";
								break;
							case 'kz': 
								$control_text = "Врачи2";
								break;
							case 'en': 
								$control_text = "Врачи3";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}elseif($post_type->name == 'prices'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Цены";
								break;
							case 'kz': 
								$control_text = "Бағалар";
								break;
							case 'en': 
								$control_text = "Prices";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}elseif($post_type->name == 'vacancies'){
						switch(wpm_get_language()){
							case 'ru': 
								$control_text = "Вакансии";
								break;
							case 'kz': 
								$control_text = "Бос жұмыс орындары";
								break;
							case 'en': 
								$control_text = "Vacancies";
								break;
						}
						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $control_text . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;
					}else{

						if ( $show_home_link && $show_current ) echo $sep;
						if ( $show_current ) echo $before . $post_type->label . $after;
						elseif ( $show_home_link && $show_last_sep ) echo $sep;

					}






				}
			} elseif ( is_attachment() ) {
				
				$parent = get_post( $parent_id );
				$cat = get_the_category( $parent->ID ); $catID = $cat[0]->cat_ID;
				$parents = get_ancestors( $catID, 'category' );
				$parents = array_reverse( $parents );
				$parents[] = $catID;
				foreach ( $parents as $cat ) {
					$position += 1;
					if ( $position > 1 ) echo $sep;
					echo sprintf( $link, get_category_link( $cat ), get_cat_name( $cat ), $position );
				}
				$position += 1;
				echo $sep . sprintf( $link, get_permalink( $parent ), $parent->post_title, $position );
				if ( $show_current ) echo $sep . $before . get_the_title() . $after;
				elseif ( $show_last_sep ) echo $sep;
			} elseif ( is_page() && ! $parent_id ) {
				
				if ( $show_home_link && $show_current ) echo $sep;
				if ( $show_current ) echo $before . get_the_title() . $after;
				elseif ( $show_home_link && $show_last_sep ) echo $sep;
			} elseif ( is_page() && $parent_id ) {
				$parents = get_post_ancestors( get_the_ID() );
				foreach ( array_reverse( $parents ) as $pageID ) {
					$position += 1;
					if ( $position > 1 ) echo $sep;
					echo sprintf( $link, get_page_link( $pageID ), get_the_title( $pageID ), $position );
				}
				if ( $show_current ) echo $sep . $before . get_the_title() . $after;
				elseif ( $show_last_sep ) echo $sep;
			} elseif ( is_tag() ) {
				if ( get_query_var( 'paged' ) ) {
					$position += 1;
					$tagID = get_query_var( 'tag_id' );
					echo $sep . sprintf( $link, get_tag_link( $tagID ), single_tag_title( '', false ), $position );
					echo $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['tag'], single_tag_title( '', false ) ) . $after;
					elseif ( $show_home_link && $show_last_sep ) echo $sep;
				}
			} elseif ( is_author() ) {
				$author = get_userdata( get_query_var( 'author' ) );
				if ( get_query_var( 'paged' ) ) {
					$position += 1;
					echo $sep . sprintf( $link, get_author_posts_url( $author->ID ), sprintf( $text['author'], $author->display_name ), $position );
					echo $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 ( $show_home_link && $show_last_sep ) echo $sep;
				}
			} elseif ( is_404() ) {
				if ( $show_home_link && $show_current ) echo $sep;
				if ( $show_current ) echo $before . $text['404'] . $after;
				elseif ( $show_last_sep ) echo $sep;
			} elseif ( has_post_format() && ! is_singular() ) {
				if ( $show_home_link && $show_current ) echo $sep;
				echo get_post_format_string( get_post_format() );
			} elseif(get_post_type() == 'control'){

				switch(wpm_get_language()){
					case 'ru': 
						$control_text = "Корпоративное управление";
						break;
					case 'kz': 
						$control_text = "Корпоративтік басқару";
						break;
					case 'en': 
						$control_text = "Corporate governance";
						break;
				}

				$position += 1;
				echo sprintf( $link, get_term_link(9, 'control_category'), $control_text, $position );

			}
			
			echo $wrap_after;
		}
	}