Site logo

Archived topic

Change search results page layout

9 replies · Started by Santa on October 27, 2019

Viewing posts 1–10 of 10

Hello! Is it possible to change how posts are displayed in search results page? Currently there are 2 columns and no title or tags to the post, as well it displays also not only posts, but pages/links that include the word. Is it possible to change the layout to 4 columns and when there is for example only 1 result as a page/link, show posts in one line, not like masonry? Could the padding between page/link results be removed as well?

- When nothing found the footer overlays the "no results". What can be done here?

Thank you!

Hi Leo! Thank you for your help! Can you please tell what should be changed here:


add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
    if ( is_search() ) {
	$options['read_more_button'] = true;
        $options['infinite_scroll'] = true;
	$options['infinite_scroll_button'] = true;
	$options['masonry_load_more'] = 'More search results';
	$options['post_image'] = true;
	$options['post_image_position'] = 'post-image-above-header';
	$options['post_image_alignment'] = 'post-image-aligned-center';
	$options['featured_column'] = true;
	$options['masonry'] = false;
    }
  
    return $options;
}

to make it 3 collumns for this page? Or it can be changed only in Customizer?
Is it possible to reduce spacing between result titles?

You only need to add the options you are wanting to change. For example, if you want to turn off infinite scroll for the search result page, then this is all you need:

add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
    if ( is_search() ) {
        $options['infinite_scroll'] = false;

    }
  
    return $options;
}

Columns would require this filter:
https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns

Space between titles would require some CSS. Let me know when the above is done :)

Hi Leo! Thank you so much! Works great! Sounds good, how to achieve smaller space between titles? :)

Are you done with all other tweaking now? So you want the featured image to show?

Hi Leo! Everything is great, except for the titles that appearing on top of search results. I would like to reduce space between them. How to achieve this? Thank you!

So this is what I'm seeing right now:
https://www.screencast.com/t/2kdlcjRkG

Just to confirm, you still want some of the featured images to show?

It's not really possible to target the title without featured images only.

Hi Leo! For the spacing I meant the spacing for search results on top of the featured images. Not the titles for the posts in the photo, but for the titles/results on top of the post results with featured photos. Is it possible to reduce spacing for these results? Thanks!

Hi there,

give this CSS a shot:

.search .entry-summary {
    margin: 0;
}
.search.separate-containers .inside-article {
    padding-top: 0px;
}
This archived topic is closed to new replies.