| Server IP : 80.93.52.51 / Your IP : 216.73.217.60 Web Server : Apache/2.4.58 (Ubuntu) System : Linux 80-93-52-51.swtest.ru 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/undergroundexpert.info/wp-content/themes/shablon/ |
Upload File : |
<?php get_header();
$cl = pll_current_language();
if ($cl == 'ru') {
$results = 'Результаты поиска по:';
$aritclesFound = 'Статьи в тексте, которых найдено искомое слово/фраза:';
} else {
$results = 'Search results for:';
$aritclesFound = 'Articles in text that searched for a word or phrase:';
}
if ($cl == 'ru') {
get_template_part('includes/breadcrumbs');
} ?>
<div id="content_section">
<div class="center_wrap">
<div class="dt">
<div class="dtc vat content_column">
<div class="page_content">
<?php $search_string = trim(strip_tags($_GET['s'])); //Получили искомую строку
//if(substr($search_string, -1) == '+'){$search_string = substr($search_string, 0, -1);$_GET['s'] = $search_string;}?>
<h1 class="block_title big"><?=$results?> <?php echo $search_string; ?></h1>
<?php
$reg = "/^\d{1,2}\.\d{1,2}\.\d{4}$/";
$no_search = 0; //если не найдено то увеличим, и в конце выведем сообщение не найдено и форму
if(have_posts() || preg_match($reg, $search_string)):
?>
<?php
?>
<?php if(have_posts()):?>
<?php $no_search++;?>
<p class="search_razdel_title"><?=$articlesFound?></p>
<ol>
<?php while (have_posts()) : the_post(); ?>
<li>
<p class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php $title = get_the_title(); $keys = explode(" ",$s); $title = preg_replace('/('.implode('|', $keys) .')/iu', '<strong class="search-excerpt">\0</strong>', $title); echo $title; ?>
</a></p>
<p><?php $excerpt = get_the_excerpt(); $keys = explode(" ",$s); $excerpt = preg_replace('/('.implode('|', $keys) .')/iu', '<strong class="search-excerpt">\0</strong>', $excerpt); echo $excerpt; ?></p>
</li>
<?php endwhile; ?>
</ol>
<?php endif; ?>
<?php if( preg_match($reg, $search_string) ):?>
<?php
$date_str = explode('.', $search_string);
//Ищем в рубрике календарь событий
$events = array(); //здесь будут лежать id записей у которых диапазон дат проведения совпадает с искомой датой:
$args = array (
'post_type' => 'post',
'posts_per_page' => -1,
'offset' => 0,
'cat' => 20,
'post_status' => 'publish',
);
$event_posts = get_posts($args);
foreach($event_posts as $event_post):
$start_date = explode('.', get_field('start_date', $event_post));
$start_time_metka = mktime(0,0,0,$start_date[1], $start_date[0], $start_date[2]);
$finish_date = explode('.', get_field('finish_date', $event_post));
$finish_time_metka = mktime(0,0,0,$finish_date[1], $finish_date[0], $finish_date[2]);
$search_time_metka = mktime(0,0,0,$date_str[1], $date_str[0], $date_str[2]);
if($search_time_metka >= $start_time_metka && $search_time_metka <= $finish_time_metka) {
$events[] = $event_post->ID;
}
endforeach;
//Конец поиска в рубрике Календарь событий
//Поиск записей опубликованных в эту дату
$args_str = 'showposts=-1' . '&year=' .$date_str[2] .'&monthnum=' .$date_str[1] .'&day=' .$date_str[0];
if(isset($_GET['cat'])) $args_str .= '&cat=' . trim(strip_tags($_GET['cat']));
$date_posts = new WP_Query($args_str);
//Конец поиска записей опубликованных в эту дату
?>
<?php if(!empty($events)):?>
<?php $no_search++;?>
<p class="search_razdel_title">Календарь событий:</p>
<ol>
<?php foreach($events as $event_id): ?>
<li><a href="<?php echo get_permalink($event_id)?>"><?php echo get_the_title($event_id)?></a></li>
<?php endforeach;?>
</ol>
<?php endif;?>
<?php
if($date_posts->have_posts()) : ?>
<?php $no_search++;?>
<p class="search_razdel_title">Статьи, опубликованные <?php echo $search_string?>:</p>
<ol>
<?php while($date_posts->have_posts()) : $date_posts->the_post(); ?>
<li><a href="<?php the_permalink()?>"><?php the_title()?></a></li>
<?php endwhile; wp_reset_query(); ?>
</ol>
<?php endif;
?>
<?php endif; //preg_match?>
<?php if($no_search == 0):?>
<h2>По вашему запросу ничего не найдено, попробуйте переформулировать запрос</h2>
<?php get_search_form(); ?>
<?php endif;?>
<?php
else:?>
<h2>По вашему запросу ничего не найдено, попробуйте переформулировать запрос</h2>
<?php get_search_form(); ?>
<?php
endif;?>
</div><!--/.page_content-->
</div><!--/.dtc.content_column-->
<?php get_sidebar();?>
</div><!--/.dt-->
</div><!--/.center_wrap-->
</div><!--/#content_section-->
<?php get_footer();?>