File: /var/www/vhosts/greenclinic.kz/newsite/wp-content/themes/green-clinic/single-directions.php
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package asds
*/
$the_post = get_the_ID();
$categories = get_the_category( $the_post );
//$categories_name = $categories[0]->name;
//$categories_id = $categories[0]->term_id;
//$categories_slug = $categories[0]->slug;
$theme_uri = get_template_directory_uri();
get_header();
?>
<?php get_template_part( 'template-parts/content_header', 'none' ); ?>
<?php
$title = get_field('title');
$text = get_field('text');
$btn = get_field('btn');
$btn_link = get_field('btn_link');
$cpost = get_field('post');
?>
<?php if($title):?>
<section class="section doctor">
<div class="container">
<div class="direction__details block1 visible">
<div class="direction__about">
<?php if($title):?><h3><?php echo $title ?></h3><?php endif; ?>
<?php if($text):?><?php echo $text ?><?php endif; ?>
<?php if($btn): ?>
<button class="yellow-button">
<span class="yellow-button-label"><?php echo $btn ?></span>
<svg
width="24"
height="25"
viewBox="0 0 24 25"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M18 12.5L18.3536 12.1464L18.7071 12.5L18.3536 12.8536L18 12.5ZM6 13C5.72386 13 5.5 12.7761 5.5 12.5C5.5 12.2239 5.72386 12 6 12V13ZM14.3536 8.14645L18.3536 12.1464L17.6464 12.8536L13.6464 8.85355L14.3536 8.14645ZM18.3536 12.8536L14.3536 16.8536L13.6464 16.1464L17.6464 12.1464L18.3536 12.8536ZM18 13H6V12H18V13Z"
fill="#262626"
/>
</svg>
</button>
<?php endif; ?>
</div>
<div class="direction__slider">
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<?php foreach($cpost as $cpost_item): ?>
<?php
$title = get_field('title', $cpost_item);
$cover_text = get_field('cover_text', $cpost_item);
$title = get_field('title', $cpost_item);
$cover_img = get_field('cover_img', $cpost_item);
?>
<div class="swiper-slide">
<div class="swiper-slide__details">
<?php if($title): ?><h3><?php echo $title ?></h3><?php endif; ?>
<?php if($cover_text): ?><?php echo $cover_text ?><?php endif; ?>
</div>
<div class="swiper-slide__bg-img" data-wow-delay="1s"><img class="wow animate__animated animate__fadeInBottomRight" src="<?php echo $cover_img["url"]; ?>"></div>
</div>
<?php endforeach; ?>
</div>
</div>
<svg
style="border-radius: 50%"
class="button-prev"
width="45"
height="43"
viewBox="0 0 45 43"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_60_1051)">
<g filter="url(#filter0_dd_60_1051)">
<ellipse
cx="22.5"
cy="21.6144"
rx="22.5"
ry="21.6144"
fill="white"
/>
</g>
<path
d="M24.875 26.25L20.125 21.5L24.875 16.75"
stroke="#0F1721"
stroke-linecap="round"
stroke-linejoin="round"
/>
</g>
<defs>
<filter
id="filter0_dd_60_1051"
x="-60"
y="-60"
width="165"
height="163.229"
filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB"
>
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feColorMatrix
in="SourceAlpha"
type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha"
/>
<feOffset dx="10" dy="10" />
<feGaussianBlur stdDeviation="25" />
<feComposite in2="hardAlpha" operator="out" />
<feColorMatrix
type="matrix"
values="0 0 0 0 0.0384375 0 0 0 0 0.341667 0 0 0 0 0.190052 0 0 0 1 0"
/>
<feBlend
mode="normal"
in2="BackgroundImageFix"
result="effect1_dropShadow_60_1051"
/>
<feColorMatrix
in="SourceAlpha"
type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha"
/>
<feOffset dx="-10" dy="-10" />
<feGaussianBlur stdDeviation="25" />
<feComposite in2="hardAlpha" operator="out" />
<feColorMatrix
type="matrix"
values="0 0 0 0 0.23776 0 0 0 0 0.6875 0 0 0 0 0.46263 0 0 0 1 0"
/>
<feBlend
mode="normal"
in2="effect1_dropShadow_60_1051"
result="effect2_dropShadow_60_1051"
/>
<feBlend
mode="normal"
in="SourceGraphic"
in2="effect2_dropShadow_60_1051"
result="shape"
/>
</filter>
<clipPath id="clip0_60_1051">
<rect width="45" height="43" rx="21.5" fill="white" />
</clipPath>
</defs>
</svg>
<svg
style="border-radius: 50%"
class="button-next"
width="45"
height="45"
viewBox="0 0 45 45"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g filter="url(#filter0_dd_56_20361)">
<circle
cx="22.5"
cy="22.5"
r="22.5"
transform="rotate(180 22.5 22.5)"
fill="#43BA7E"
/>
</g>
<path
d="M19.793 17.8604L24.543 22.6104L19.793 27.3604"
stroke="white"
stroke-linecap="round"
stroke-linejoin="round"
/>
<defs>
<filter
id="filter0_dd_56_20361"
x="-60"
y="-60"
width="165"
height="165"
filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB"
>
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feColorMatrix
in="SourceAlpha"
type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha"
/>
<feOffset dx="10" dy="10" />
<feGaussianBlur stdDeviation="25" />
<feComposite in2="hardAlpha" operator="out" />
<feColorMatrix
type="matrix"
values="0 0 0 0 0.0384375 0 0 0 0 0.341667 0 0 0 0 0.190052 0 0 0 1 0"
/>
<feBlend
mode="normal"
in2="BackgroundImageFix"
result="effect1_dropShadow_56_20361"
/>
<feColorMatrix
in="SourceAlpha"
type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
result="hardAlpha"
/>
<feOffset dx="-10" dy="-10" />
<feGaussianBlur stdDeviation="25" />
<feComposite in2="hardAlpha" operator="out" />
<feColorMatrix
type="matrix"
values="0 0 0 0 0.23776 0 0 0 0 0.6875 0 0 0 0 0.46263 0 0 0 1 0"
/>
<feBlend
mode="normal"
in2="effect1_dropShadow_56_20361"
result="effect2_dropShadow_56_20361"
/>
<feBlend
mode="normal"
in="SourceGraphic"
in2="effect2_dropShadow_56_20361"
result="shape"
/>
</filter>
</defs>
</svg>
</div>
</div>
</div>
</section>
<?php endif; ?>
<?php get_template_part( 'blocks/blocks' ); ?>
<?php get_footer(); ?>
<script>
var swiper = new Swiper(".mySwiper", {
navigation: {
nextEl: ".button-next",
prevEl: ".button-prev",
},
loop: true,
});
</script>
<script>
// Debounce function to limit the rate of invoking the performSearch function
function debounce(func, wait, immediate) {
let timeout;
return function() {
const context = this,
args = arguments;
const later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
const callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
// Function to perform the search via AJAX
function performSearch() {
let searchTerm = jQuery('#searchInput').val().trim();
// Only perform the search if the search term is not too short
if (searchTerm.length < 3) {
// Optionally, clear the search results if the term is too short
jQuery('#search__results').html('');
return;
}
// Show the preloader animation
jQuery('.preloader').show();
// Send the AJAX request to perform the search
jQuery.ajax({
url: '/wp-admin/admin-ajax.php',
type: 'POST',
data: {
action: 'search_prices',
term: searchTerm
},
success: function(response) {
// Display the search results
jQuery('#search__results').html(response);
// Hide the preloader animation
jQuery('.preloader').hide();
},
error: function() {
// Hide the preloader animation
jQuery('.preloader').hide();
// Display an error message to the user
alert('Search failed. Please try again.');
}
});
}
(function($) {
$(document).ready(function() {
// Debounce the keyup event to limit the rate of AJAX requests
const debouncedSearch = debounce(performSearch, 300);
// Attach the debounced search function to the keyup event on the search input
$('#searchBtn').on('click', debouncedSearch);
var value_two = localStorage.getItem("value_ls");
var click_two = localStorage.getItem("value_click");
if (click_two == 1) {
let serIn = $('#searchInput');
serIn.val(value_two);
serIn.trigger('keydown');
serIn.trigger('keyup');
localStorage.removeItem("value_ls");
localStorage.removeItem("value_click");
localStorage.clear();
} else {}
$('#paidFilter').on('click', function() {
$('#search__results').removeClass('open');
$('#search__results_osms').removeClass('open');
$('#search__results_paid').addClass('open');
});
$('#osmsFilter').on('click', function() {
$('#search__results').removeClass('open');
$('#search__results_paid').removeClass('open');
$('#search__results_osms').addClass('open');
});
});
$('body').on('click', '.search__results-service', function() {
var value_name = $(this).find('.search__service-name').html();
var value_price = $(this).find('.search__results-price').html();
var value_type = $(this).find('.search__service-type').html();
var value_price_id = $(this).find('#pageidid').html();
var click_one = 1;
localStorage.setItem("value_name", value_name);
localStorage.setItem("value_price", value_price);
localStorage.setItem("value_type", value_type);
localStorage.setItem("value_click", click_one);
localStorage.setItem("value_price_id", value_price_id);
console.log(value_price_id);
document.location.href = '/zapis-na-priem';
});
})(jQuery);
</script>