[Resolved] How to Customize My Search Result Page

Home Forums Support [Resolved] How to Customize My Search Result Page

Home Forums Support How to Customize My Search Result Page

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1561190
    Fandi Ahmad

    Hi, My Name is Fandi from Indonesia, I was installed GeneratePress and I think that as a awesome Theme I ever installed.

    I just want to ask a litte bit basic question about “how to customize the result page”. I want to customize the result page of my website “—-” same with the homepage or something like “just the image and tittle show on there”

    Sample of my result page: —-
    Want same like my home page or similar of that.

    Thank you.

    #1561707
    Leo
    Staff
    Customer Support

    Hi there,

    Sorry but I don’t understand the requirement.

    The search result page is supposed to show all the search results when a keyword is searched.

    Are you only wanting to show a static page?

    #1562132
    Fandi Ahmad

    No, I just want to make my result page appearance same like the homepage when a keyword is searched. thanks.

    #1562403
    Elvin
    Staff
    Customer Support

    Hi,

    To clarify: You’re trying to display the search results in columns/cards like the products in home page?

    If so, you can set the search display result through Dashboard > Appearance > Customize > Layout > Blog and set check “Display posts in columns”. But this will also apply to blog archives as well.

    Alternatively, if you only want this to apply on the search page only, you can use this PHP snippet:

    add_filter( 'generate_blog_columns','tu_portfolio_columns' );
    function tu_portfolio_columns( $columns ) {
        if ( is_search() ) {
            return true;
        }
        return $columns;
    }
    
    add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
    function tu_search_column_count( $count ) {
        if ( is_search() ) {
            return 25;
        }
    
        return $count;
    }

    A wise man once said:
    "Have you cleared your cache?"

    #1562886
    Fandi Ahmad

    Hi, thank you its work.

    But, Can I show the tittle & product image only on there? Similar like my homepage.

    #1562895
    Elvin
    Staff
    Customer Support

    But, Can I show the tittle & product image only on there? Similar like my homepage.

    We can hide the excerpt from display by adding this CSS:

    body.search .entry-summary, body.search .entry-content  {
        display: none;
    }

    A wise man once said:
    "Have you cleared your cache?"

    #1563043
    Fandi Ahmad

    Thanks for the answer its work, but the downlaod link still appear on there, can I hide that also? thanks.

    #1563164
    Fandi Ahmad

    I was hide it on exclude “in element” but the download link still appear on that, I only want to my products appear on there. no other. thanks

    #1563682
    David
    Staff
    Customer Support

    Hi there,

    did you resolve the issue?

    #2222967
    Patrick

    Hi,
    ===
    Nevermind, already solved, I’ve had to look better:
    https://docs.generatepress.com/article/option_generate_blog_settings/
    ==

    Initial question:
    In reply to Elvin’s script suggestion:

    add_filter( 'generate_blog_columns','tu_portfolio_columns' );
    function tu_portfolio_columns( $columns ) {
        if ( is_search() ) {
            return true;
        }
        return $columns;
    }
    
    add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
    function tu_search_column_count( $count ) {
        if ( is_search() ) {
            return 25;
        }
    
        return $count;
    }
    

    I know it’s an old topic but my question is very related.
    My search results are in 3 columns because this is indeed the blog setting. However I want the search result to be a single 100% width column.
    So actually I need this script the other way around. Can you help me out?
    Thanks,
    – Patrick

    #2223410
    David
    Staff
    Customer Support

    Hi there,

    you can do:

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

    This will force the search to be a single column.

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