check if search results exists
This commit is contained in:
parent
9423a7bff0
commit
c1ca62ea2e
2 changed files with 23 additions and 10 deletions
|
|
@ -484,5 +484,7 @@ function search_excerpt_highlight() {
|
||||||
$text = wp_strip_all_tags( get_the_content() );
|
$text = wp_strip_all_tags( get_the_content() );
|
||||||
$query = explode(' ', get_search_query());
|
$query = explode(' ', get_search_query());
|
||||||
|
|
||||||
|
print_r($query);
|
||||||
|
|
||||||
echo generate_excerpt($text, $query, $length);
|
echo generate_excerpt($text, $query, $length);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,10 @@ get_header();
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
global $wp_query;
|
|
||||||
|
# Check if search results exists
|
||||||
|
if ($wp_query->found_posts) {
|
||||||
|
|
||||||
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
|
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
|
||||||
$post_count_start = (($paged -1) * 10) + 1;
|
$post_count_start = (($paged -1) * 10) + 1;
|
||||||
$post_count_end = ((($paged -1) * 10) + $wp_query->post_count);
|
$post_count_end = ((($paged -1) * 10) + $wp_query->post_count);
|
||||||
|
|
@ -54,6 +57,14 @@ get_header();
|
||||||
echo "</strong> ";
|
echo "</strong> ";
|
||||||
_e("from total results", 'kit');
|
_e("from total results", 'kit');
|
||||||
echo " <strong>" . $wp_query->found_posts. "</strong>";
|
echo " <strong>" . $wp_query->found_posts. "</strong>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
echo "<p>";
|
||||||
|
_e("No results found", 'kit');
|
||||||
|
echo ".</p>";
|
||||||
|
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue