• Resolved link1921u

    (@link1921u)


    I would like to customize the search page to only show post with the title, featured image and tags, how could I do that?

    Oh, and it could be done that for example, it only looks for pages with a category?

    I’m talking about creating it in a child theme

    • This topic was modified 3 years, 8 months ago by link1921u.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Leo

    (@leohsiang)

    Hi there,

    I would like to customize the search page to only show post with the title, featured image and tags

    That should almost be the default when using the free theme. We just need to remove the excerpt with some CSS:

    .search-results .entry-summary {
        display: none;
    }

    Adding CSS: https://docs.generatepress.com/article/adding-css/

    Thread Starter link1921u

    (@link1921u)

    Thanks Leo!

    And if I want only posts to appear and not pages?

    Thread Starter link1921u

    (@link1921u)

    I got it with this code:

    function SearchFilter($query) {
        if ($query->is_search) {
            $query->set('post_type', 'post');
        }
        return $query;
    }
    add_filter('pre_get_posts','SearchFilter');
    Leo

    (@leohsiang)

    Glad to hear ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I would like to custom the “search page”’ is closed to new replies.