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

@ -59,7 +59,7 @@
} }
.tx-indexedsearch .tx-indexedsearch-browsebox { .tx-indexedsearch .tx-indexedsearch-browsebox {
margin-top: 15px; margin-top: 40px;
} }
.tx-indexedsearch .tx-indexedsearch-browsebox > * + * { .tx-indexedsearch .tx-indexedsearch-browsebox > * + * {
@ -117,7 +117,7 @@
} }
.tx-indexedsearch .tx-indexedsearch-res .link-more span::after { .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; position: absolute;
width: 17px; width: 17px;
margin-left: 10px; margin-left: 10px;
@ -131,3 +131,7 @@
h2.screen-reader-text { h2.screen-reader-text {
display: none; display: none;
} }
.tx-indexedsearch-res p {
margin: 0.2rem 0;
}

View file

@ -214,6 +214,10 @@ function kit_customize_css()
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>; 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 { .nav-second-level-group-headline .icon {
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>; 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' ); 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');

View file

@ -40,6 +40,7 @@ get_header();
</fieldset> </fieldset>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
@ -49,12 +50,24 @@ get_header();
<p> <p>
<?php <?php
global $wp_query; global $wp_query;
echo "Anzeige der Ergebnisse <strong>1 bis 10</strong> von insgesamt <strong>" . $wp_query->found_posts. "</strong>"; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$post_start = ($wp_query->found_posts - $wp_query->post_count);
echo "Anzeige der Ergebnisse <strong>" . $post_start . " bis " . $wp_query->post_count . "</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 -->
<ul class="tx-indexedsearch-browsebox"><li class="tx-indexedsearch-browselist-currentPage"><strong><a href="#" onclick="document.getElementById('tx_indexedsearch_pointer').value='0';document.getElementById('tx_indexedsearch').submit();return false;">Seite 1</a></strong></li><li><a href="#" onclick="document.getElementById('tx_indexedsearch_pointer').value='1';document.getElementById('tx_indexedsearch').submit();return false;">Seite 2</a></li><li><a href="#" onclick="document.getElementById('tx_indexedsearch_pointer').value='1';document.getElementById('tx_indexedsearch').submit();return false;">Nächste &gt;</a></li></ul> <div class="tx-indexedsearch-browsebox">
<?php the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => __( '< Zurück', 'textdomain' ),
'next_text' => __( 'Nächste >', 'textdomain' ),
'type' => 'list',
'before_page_number' => 'Seite ',
) ); ?>
</div>
</div> </div>
@ -84,22 +97,6 @@ get_header();
<!-- <ul class="tx-indexedsearch-browsebox">
<li class="tx-indexedsearch-browselist-currentPage">
<strong>
<a href="#" onclick="document.getElementById('tx_indexedsearch_pointer').value='0';document.getElementById('tx_indexedsearch').submit();return false;">Seite 1</a>
</strong>
</li>
<li>
<a href="#" onclick="document.getElementById('tx_indexedsearch_pointer').value='1';document.getElementById('tx_indexedsearch').submit();return false;">Seite 2</a>
</li>
<li>
<a href="#" onclick="document.getElementById('tx_indexedsearch_pointer').value='1';document.getElementById('tx_indexedsearch').submit();return false;">Nächste &gt;</a>
</li>
</ul> -->
</div> </div>
</div> </div>

View file

@ -34,6 +34,7 @@ get_header();
</fieldset> </fieldset>
</form> </form>
</div> </div>
</div> </div>
</div> </div>