New Landing How can we help? Themeforest Theme Support Dante How to specify which post/page/types etc appear in search results?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Posted in: Dante
  • #118685
    mhote
    Member
    Post count: 394

    Hi, there’s certain pages that need an option to not show in search results (ie. homepage, clients, testimonials, attachment files). How can we specify or control what shows in the search results? Thks!

    #118853
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    neither wordpress nor theme has this feature. You can try this plugin https://wordpress.org/plugins/search-exclude/.

    Thanks
    Mohammad

    #138145
    alemarengo
    Member
    Post count: 695

    Hi guys!
    I’m really interested in excluding Clients in search results.
    See this example in order to see what I mean:
    http://www.puntobianco.net/?clients=pip-studio
    (there’s my face in it…)
    Isn’t there a quick snippet to add to functions.php?
    I mean, is there a way to include exclude_from_search => true when registering “Clients” as custom post type?
    I hope so… ๐Ÿ™‚

    In this case, I’d like to explain what is my need.
    As I purchased Dante, I expected that among default custom post type there was also one called “Brands”.
    As a workaround, I should have used Clients as per products’ Brands, but only to include them into a carousel that I put on my ecommerce homepage. In fact, every Client has a link that brings to its Brand – which exists thanks to Woothemes Brands extension.

    #138147
    alemarengo
    Member
    Post count: 695

    Sorry to bother you about this topic, but I’m quite thinking I managed it by using this snippet:

    function GetCertainPostTypes($query) {
        if ($query->is_search) {
            $query->set('post_type',array('post','page','product','product_brand','product_tag','pa_marchio','product_cat'));
        }
    return $query;
    }
    add_filter('pre_get_posts','GetCertainPostTypes');
    #138149
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Ok great ๐Ÿ™‚

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register