fix page results count
This commit is contained in:
parent
4fcd021cb7
commit
4c62fafeb9
3 changed files with 7 additions and 15 deletions
|
|
@ -135,3 +135,7 @@ h2.screen-reader-text {
|
||||||
.tx-indexedsearch-res p {
|
.tx-indexedsearch-res p {
|
||||||
margin: 0.2rem 0;
|
margin: 0.2rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-term {
|
||||||
|
background-color: yellow;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -263,16 +263,3 @@ function kit_modify_posts_per_page( $query ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_action( 'pre_get_posts', 'kit_modify_posts_per_page' );
|
add_action( 'pre_get_posts', 'kit_modify_posts_per_page' );
|
||||||
|
|
||||||
|
|
||||||
function highlight_results($text) {
|
|
||||||
if (is_search() && !is_admin()) {
|
|
||||||
$sr = get_query_var('s');
|
|
||||||
$keys = explode(' ', $sr);
|
|
||||||
$keys = array_filter($keys);
|
|
||||||
$text = preg_replace('/('.implode('|', $keys) .')/iu', '<span class="search-highlight">\0</span>', $text);
|
|
||||||
}
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
add_filter('the_excerpt', 'highlight_results');
|
|
||||||
add_filter('the_title', 'highlight_results');
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,9 @@ get_header();
|
||||||
<?php
|
<?php
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
|
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
|
||||||
$post_start = ($wp_query->found_posts - $wp_query->post_count);
|
$post_count_start = (($paged -1) * 10) + 1;
|
||||||
echo "Anzeige der Ergebnisse <strong>" . $post_start . " bis " . $wp_query->post_count . "</strong> von insgesamt <strong>" . $wp_query->found_posts. "</strong>";
|
$post_count_end = ((($paged -1) * 10) + $wp_query->post_count);
|
||||||
|
echo "Anzeige der Ergebnisse <strong>" . $post_count_start . " bis " . $post_count_end . "</strong> von insgesamt <strong>" . $wp_query->found_posts. "</strong>";
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<!-- render the anchor-links to the sections inside the displayed result rows -->
|
<!-- render the anchor-links to the sections inside the displayed result rows -->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue