check if search results exists
This commit is contained in:
parent
9423a7bff0
commit
c1ca62ea2e
2 changed files with 23 additions and 10 deletions
|
|
@ -44,16 +44,27 @@ get_header();
|
|||
|
||||
<p>
|
||||
<?php
|
||||
global $wp_query;
|
||||
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
|
||||
$post_count_start = (($paged -1) * 10) + 1;
|
||||
$post_count_end = ((($paged -1) * 10) + $wp_query->post_count);
|
||||
_e("Showing results", 'kit');
|
||||
echo "<strong> ";
|
||||
printf( esc_html__( '%d to %d', 'kit' ), $post_count_start, $post_count_end );
|
||||
echo "</strong> ";
|
||||
_e("from total results", 'kit');
|
||||
echo " <strong>" . $wp_query->found_posts. "</strong>";
|
||||
|
||||
# Check if search results exists
|
||||
if ($wp_query->found_posts) {
|
||||
|
||||
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
|
||||
$post_count_start = (($paged -1) * 10) + 1;
|
||||
$post_count_end = ((($paged -1) * 10) + $wp_query->post_count);
|
||||
_e("Showing results", 'kit');
|
||||
echo "<strong> ";
|
||||
printf( esc_html__( '%d to %d', 'kit' ), $post_count_start, $post_count_end );
|
||||
echo "</strong> ";
|
||||
_e("from total results", 'kit');
|
||||
echo " <strong>" . $wp_query->found_posts. "</strong>";
|
||||
|
||||
} else {
|
||||
|
||||
echo "<p>";
|
||||
_e("No results found", 'kit');
|
||||
echo ".</p>";
|
||||
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue