hightlight search results

This commit is contained in:
Jonas Heinrich 2020-07-21 12:21:25 +02:00
parent c9354c5f2e
commit e75c9ccfdc
5 changed files with 37 additions and 8 deletions

View file

@ -1337,6 +1337,10 @@ body.page-theme-color-quaternary form input[type='submit'] {
.teaser-box-category-marker .icon { .teaser-box-category-marker .icon {
mask: url('../img/teaser-box-arrow-brand-secondary.svg') no-repeat center / contain; mask: url('../img/teaser-box-arrow-brand-secondary.svg') no-repeat center / contain;
background-repeat: no-repeat;
background-position: left center;
background-size: contain;
-webkit-mask-image: url('../img/teaser-box-arrow-brand-secondary.svg');
position: absolute; position: absolute;
right: 0; right: 0;
bottom: 0.55556rem; bottom: 0.55556rem;
@ -1362,6 +1366,10 @@ body.page-theme-color-quaternary form input[type='submit'] {
.teaser-box-color-brand-secondary .teaser-box-category-marker::after { .teaser-box-color-brand-secondary .teaser-box-category-marker::after {
mask: url('../img/teaser-box-arrow-brand-secondary.svg') no-repeat center / contain; mask: url('../img/teaser-box-arrow-brand-secondary.svg') no-repeat center / contain;
background-repeat: no-repeat;
background-position: left center;
background-size: contain;
-webkit-mask-image: url('../img/teaser-box-arrow-brand-secondary.svg');
} }
.teaser-box-color-brand-tertiary .teaser-box-category-marker { .teaser-box-color-brand-tertiary .teaser-box-category-marker {
@ -1427,6 +1435,10 @@ body.page-theme-color-secondary .teaser-box-category-marker:hover {
body.page-theme-color-secondary .teaser-box-category-marker::after { body.page-theme-color-secondary .teaser-box-category-marker::after {
mask: url('../img/teaser-box-arrow-brand-secondary.svg') no-repeat center / contain; mask: url('../img/teaser-box-arrow-brand-secondary.svg') no-repeat center / contain;
background-repeat: no-repeat;
background-position: left center;
background-size: contain;
-webkit-mask-image: url('../img/teaser-box-arrow-brand-secondary.svg');
} }
body.page-theme-color-tertiary .teaser-box-image { body.page-theme-color-tertiary .teaser-box-image {

View file

@ -38,9 +38,9 @@ ul.bestandliste {
padding: 2rem 0 2rem 0; padding: 2rem 0 2rem 0;
} }
/* @media (max-width: 1024px) { .intro-element .content-wrap #centeredMultiLine {
.intro-element .content-wrap #centeredMultiLine { display: flex;
height: 100%; align-self: flex-end;
line-height: 4em; align-items: center;
} justify-content: center;
} */ }

View file

@ -138,3 +138,8 @@ h2.screen-reader-text {
.search-term { .search-term {
background-color: yellow; background-color: yellow;
} }
.tx-indexedsearch-redMarkup {
font-weight: 400;
background-color: rgba(0, 153, 130, 0.1);
}

View file

@ -31,11 +31,11 @@
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
console.log("resized"); console.log("resized");
textFit(document.getElementById('centeredMultiLine'), {alignHoriz: true, alignVert: true, multiLine: true, reProcess: true, maxFontSize: 45}); textFit(document.getElementById('centeredMultiLine'), {alignHoriz: true, multiLine: true, reProcess: true, maxFontSize: 35});
}); });
window.addEventListener('resize', function(event){ window.addEventListener('resize', function(event){
console.log("resized"); console.log("resized");
textFit(document.getElementById('centeredMultiLine'), {alignHoriz: true, alignVert: true, multiLine: true, reProcess: true, maxFontSize: 45}); textFit(document.getElementById('centeredMultiLine'), {alignHoriz: true, multiLine: true, reProcess: true, maxFontSize: 35});
}); });
</script> </script>

View file

@ -384,3 +384,15 @@ function kit_widgets_init() {
} }
add_action( 'widgets_init', 'kit_widgets_init' ); add_action( 'widgets_init', 'kit_widgets_init' );
# Highlight query in search results
function kit_highlight_results($text){
if(is_search()){
$sr = get_query_var('s');
$keys = explode(" ",$sr);
$text = preg_replace('/('.implode('|', $keys) .')/iu', '<strong class="tx-indexedsearch-redMarkup">'.$sr.'</strong>', $text);
}
return $text;
}
add_filter('the_excerpt', 'kit_highlight_results');