Site logo

Archived topic

How to Customize My Search Result Page

10 replies · Started by Fandi Ahmad on December 1, 2020

Viewing posts 1–11 of 11

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.

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?

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

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;
}

Hi, thank you its work.

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

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;
}

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

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

Hi there,

did you resolve the issue?

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

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.

This archived topic is closed to new replies.