styling fixes search results page

This commit is contained in:
Jonas Heinrich 2020-04-26 17:14:03 +02:00
parent 0ecd2e5efc
commit 4fcd021cb7
4 changed files with 49 additions and 30 deletions

View file

@ -214,6 +214,10 @@ function kit_customize_css()
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
.tx-indexedsearch .tx-indexedsearch-browsebox ul li .current {
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
.nav-second-level-group-headline .icon {
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
}
@ -259,3 +263,16 @@ function kit_modify_posts_per_page( $query ) {
}
}
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');