[Resolved] Search results

Home Forums Support [Resolved] Search results

Home Forums Support Search results

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #903101

    Hello support team,

    I’m just doing some testing on my website: https://www.hearmeraw.uk and if you use the search function, searching for ‘mushrooms’, then many results come up from my online store which is good.

    A couple of problems I’m facing though.

    1, shortcodes are disabled. Is there any way of enabling them on search results?
    2, can the search results have a different layout to that of the blog?
    3, is there a way to limit the returned characters of each search result as displaying the entire short description of a product is way too much
    4, Could we include meta info or category breadcrubs so people are able to see what section of the site the search result is from.
    5, is it possible to exclude certain sections / pages / custom post types from appearing in search results?

    I love the theme, and I know wordpress’s search function isn’t amazing, and search pages are often over looked in themes, but it would be good to have some options for the search page built into the theme.


    Lead Developer
    Lead Developer

    Hi Paul,

    1. I believe the only way to show shortcodes in the results is to enable the full text instead of using an excerpt. The excerpts will strip the shortcodes.

    2. What kind of layout are you looking for?

    3. You can do this if you use excerpts and not the full text (which would make it so shortcodes don’t show). Let me know which one you want to go with.

    4. Do you have these turned off for your archives by default in Customize > Layout > Blog? If so, we can use a function to target the search results and display them.

    5. You can use the pre_get_posts hook to do that: https://wp-mix.com/wordpress-exclude-custom-post-type-search/

    Let me know ๐Ÿ™‚


    Hi Tom,

    Thanks for the quick response.

    1, The ‘excerpt word count’ does not work on product descriptions. My website is primarily a store, so would be handy to have the exerpts adhere to the excerpt word count.

    I believe a good workaround would be to add another section titled ‘Search’ in the ‘Customiser > Layout > Blog > Content’ section, so that people could customise the search page.

    2, I’d like to have a column layout for my blog, and have a traditional line by line layout for the search results. Ideally having a small square featured image displayed to the left of the page title and page excerpt.

    3, The ‘Excertpt word count’ only works for blogs and not on product descriptions.

    4, The meta info, also only shows on blog posts, would be nice to have product categories in the meta info too.

    5, thanks.

    I’ve also noticed that product featured images do not display on the search results, yet blog featured images do.


    Lead Developer
    Lead Developer

    Hey Paul,

    1. This might help: https://stackoverflow.com/questions/35693954/woocommerce-short-description-excerpt-length

    2. So do you have the column layout already set up for your regular archives? If so, try this function:

    add_filter( 'option_generate_blog_settings', function( $settings ) {
        if ( is_search() ) {
            $settings['column_layout'] = false;
            $settings['page_post_image_alignment'] = 'left';
        return $settings;
    } );

    4. I wonder if something like this would do it?:

    add_action( 'generate_after_content', function() {
        if ( is_search() && 'product' == get_post_type() ) {
            foreach ( get_the_terms( get_the_ID(), 'product_cat' ) as $cat ) {
                echo $cat->name;
    } );

    Thanks Tom,

    1, unfortunately, code doesn’t work on the search page when results are returned…?

    2, Perfect. Thanks

    4, Thanks. I’ll maybe look to edit the search.php and put into the child theme for more customisations.

    Are there any plans for future releases to improve the search results page?


    Lead Developer
    Lead Developer

    Your search results page seems to be one column, although there aren’t any featured images to align left. Have you made any adjustments to include products in the search?: https://docs.generatepress.com/article/generate_navigation_search_output/#woocommerce-products



    im experiencing the same Issues with Shortcodes in Search Results, they were not shown.

    Any workaround how to fix that?

    Best regards

    Lead Developer
    Lead Developer

    Hi there,

    You need to display the full content in search results to show shortcodes:

    add_filter( 'generate_show_excerpt', function( $show ) {
        if ( is_search() ) {
            return false;
        return $show;
    } );
    Marie Amandine

    Hello support team,

    I am using the pre_get_posts. When I add ‘product’, tags and categories ‘post’ type disappear.

    function shapeSpace_filter_search($query) {
    	if (!$query->is_admin && $query->is_search) {
    		$query->set('post_type', array('post', 'product'));
    	return $query;
    add_filter('pre_get_posts', 'shapeSpace_filter_search');

    Any idea ?

    Customer Support

    Hi Marie,

    Can you open a new topic for this? This topic is already marked solved.

    Please include more details on the new topic as well. (expected result, current state.)

    Let us know. ๐Ÿ™‚

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