[Support request] Change search results page layout

Home Forums Support [Support request] Change search results page layout

Home Forums Support Change search results page layout

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1045738
    Santa

    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!

    #1046284
    Leo
    Staff
    Customer Support

    Hi there,

    Currently, the search results page inherits the settings under Layout > Blog in the customizer.

    If you want the layout to be different than the main posts page, this filter is needed:
    https://docs.generatepress.com/article/option_generate_blog_settings/

    You can see an example at the bottom:
    https://docs.generatepress.com/article/option_generate_blog_settings/#examples

    Let me know if this helps πŸ™‚

    #1047142
    Santa

    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?

    #1047185
    Leo
    Staff
    Customer Support

    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 πŸ™‚

    #1047919
    Santa

    Hi Leo! Thank you so much! Works great! Sounds good, how to achieve smaller space between titles? πŸ™‚

    #1048046
    Leo
    Staff
    Customer Support

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

    #1048546
    Santa

    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!

    #1049050
    Leo
    Staff
    Customer Support

    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.

    #1049366
    Santa

    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!

    #1049613
    David
    Staff
    Customer Support

    Hi there,

    give this CSS a shot:

    .search .entry-summary {
        margin: 0;
    }
    .search.separate-containers .inside-article {
        padding-top: 0px;
    }
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.