From 4fcd021cb70b7fda14e9ae61b99d7c5c48263bc5 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Sun, 26 Apr 2020 17:14:03 +0200 Subject: [PATCH] styling fixes search results page --- kit/css/search.css | 8 +++++-- kit/functions.php | 17 +++++++++++++++ kit/search.php | 53 ++++++++++++++++++++++------------------------ kit/searchpage.php | 1 + 4 files changed, 49 insertions(+), 30 deletions(-) diff --git a/kit/css/search.css b/kit/css/search.css index 70cb5aa..b935ad2 100644 --- a/kit/css/search.css +++ b/kit/css/search.css @@ -59,7 +59,7 @@ } .tx-indexedsearch .tx-indexedsearch-browsebox { - margin-top: 15px; + margin-top: 40px; } .tx-indexedsearch .tx-indexedsearch-browsebox > * + * { @@ -117,7 +117,7 @@ } .tx-indexedsearch .tx-indexedsearch-res .link-more span::after { - content: url(img/arrow-right-grey.svg); + content: url(../img/arrow-right-grey.svg); position: absolute; width: 17px; margin-left: 10px; @@ -131,3 +131,7 @@ h2.screen-reader-text { display: none; } + +.tx-indexedsearch-res p { + margin: 0.2rem 0; +} diff --git a/kit/functions.php b/kit/functions.php index 383bd0b..ef7425e 100644 --- a/kit/functions.php +++ b/kit/functions.php @@ -214,6 +214,10 @@ function kit_customize_css() color: ; } + .tx-indexedsearch .tx-indexedsearch-browsebox ul li .current { + background-color: ; + } + .nav-second-level-group-headline .icon { background-color: ; } @@ -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', '\0', $text); + } + return $text; +} +add_filter('the_excerpt', 'highlight_results'); +add_filter('the_title', 'highlight_results'); diff --git a/kit/search.php b/kit/search.php index 34ec8a0..c13e2ef 100644 --- a/kit/search.php +++ b/kit/search.php @@ -40,6 +40,7 @@ get_header(); + @@ -49,13 +50,25 @@ get_header();

1 bis 10 von insgesamt " . $wp_query->found_posts. ""; + $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; + $post_start = ($wp_query->found_posts - $wp_query->post_count); + echo "Anzeige der Ergebnisse " . $post_start . " bis " . $wp_query->post_count . " von insgesamt " . $wp_query->found_posts. ""; ?>

- - +
+ 2, + 'prev_text' => __( '< Zurück', 'textdomain' ), + 'next_text' => __( 'Nächste >', 'textdomain' ), + 'type' => 'list', + 'before_page_number' => 'Seite ', + ) ); ?> +
+ + + @@ -72,31 +85,15 @@ get_header(); -
- 2, - 'prev_text' => __( '< Zurück', 'textdomain' ), - 'next_text' => __( 'Nächste >', 'textdomain' ), - 'type' => 'list', - 'before_page_number' => 'Seite ', - ) ); ?> -
- - - - +
+ 2, + 'prev_text' => __( '< Zurück', 'textdomain' ), + 'next_text' => __( 'Nächste >', 'textdomain' ), + 'type' => 'list', + 'before_page_number' => 'Seite ', + ) ); ?> +
diff --git a/kit/searchpage.php b/kit/searchpage.php index 2369b19..0052f9b 100644 --- a/kit/searchpage.php +++ b/kit/searchpage.php @@ -34,6 +34,7 @@ get_header(); +