add filters search
This commit is contained in:
48
search.php
48
search.php
@@ -7,6 +7,16 @@
|
||||
get_header();?>
|
||||
|
||||
|
||||
<?if (trim($s) !== ''):?>
|
||||
|
||||
<?$params = [
|
||||
'post_type' => 'post',
|
||||
's' => $s,
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 20
|
||||
]?>
|
||||
|
||||
|
||||
|
||||
<div id="content">
|
||||
|
||||
@@ -16,21 +26,11 @@ get_header();?>
|
||||
|
||||
<div id="search-form">
|
||||
<form action="<?php bloginfo( 'url' ); ?>" method="get">
|
||||
<input class="search-text" type="text" name="s" placeholder="<?=$s?>" value=""/>
|
||||
<input class="search-text" type="text" name="s" placeholder="Найти" value="<?=$s?>"/>
|
||||
<input class="search_submit" type="submit" value="Найти"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?if (trim($s) !== ''):?>
|
||||
|
||||
<?$params = [
|
||||
'post_type' => 'post',
|
||||
's' => $s,
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 20
|
||||
]?>
|
||||
|
||||
<p class="search-result">По запросу «<?php
|
||||
<div class="search-result">
|
||||
По запросу «<?php
|
||||
$allsearch = new WP_Query($params);
|
||||
$key = esc_html($s, 1);
|
||||
$count = $allsearch->post_count; _e('');
|
||||
@@ -45,7 +45,27 @@ else:
|
||||
echo $count . ' '; _e('результата');
|
||||
endif;
|
||||
endif;
|
||||
//wp_reset_query(); ?></p>
|
||||
//wp_reset_query(); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="find_panel">
|
||||
<select class="search-select" id="search_type" name="search_type">
|
||||
<option value="date">По дате</option>
|
||||
<option value="revel" <?if($_GET['search_type'] == 'revel'):?> selected<?endif?>>По релевантности</option>
|
||||
</select>
|
||||
<select class="search-select" id="search_date" name="search_date">
|
||||
<option value="all" selected>За все время</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if(have_posts()) :?>
|
||||
<div class="search-card-box">
|
||||
|
||||
Reference in New Issue
Block a user