Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Style the search-results-page

  • Hello 🙂

    can anybody tell me how i can style the search-results-Page?
    https://capture.dropbox.com/CBP7xwUwx2Tnd5S9

    Thanks for our help,
    Jenny

  • Hi there,

    Are there any Elements currently active on the search results page?

  • Hi Alvind, thank you for your reply.

    I removed the blank header area via CSS. Is there a possibility to split the content of this page into three separate containers as shown in the Dropbox video?

    Thanks,
    Jenny

  • 1. To remove sidebar, you can use a layout element, set it to content/no sidebar, set location to search result.

    Is there a possibility to split the content of this page into three separate containers as shown in the Dropbox video?

    2. I do not understand the 3 container you drew in your video, what will be the content for the 3 containers? and are the 3 containers supposed to be on top of the page?

  • Hello Ying,

    thank you very much for your reply and the explanation related to the sidebar!

    Yes, I’d like to structure the content of this page differently. Right now, each of the content items appears on the full page. I’d like to restructure the content items so they appear in either two or three columns instead. Is there such a possibility?

    Thanks again,
    Jenny

  • Hi there,

    the Search results page behaves like the blog and archive pages.
    So if you activate the Blog module in Appearance > GeneratePress,
    then in Customizer > Layout > Blog, you can enable columns:

    https://docs.generatepress.com/article/using-columns-in-the-blog/

    But this will apply to blog, archives and search.
    Let me know if you need it just for the search results.

  • Hi David,

    sorry for the late reply. I think it’s fine for now, however, I’d highly appreciate if you could add a solution related to the search results only. If required, we would then be able to switch immediately.

    Thanks again,
    Jenny

  • In the doc David linked, there is a PHP solution already.

    Here’s the code to enable columns in search results:

    add_filter( 'generate_blog_columns', function( $columns ) {
        if ( is_search() ) {
            return true;
        }
    
        return $columns;
    } );

    Here’s the code to set column number:

    add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
    function tu_search_column_count( $count ) {
        if ( is_search() ) {
            return 33; 
        }
    
        return $count;
    }

    33 means 33%, which is 3 columns.

    50 would be 50%, 2 columns.

    20 would be 20%, 5 columns.

    And so on…

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.