Knowledgepress, Hero Live Search custom post type

I'm a beginner on wordpress. Recently, I've used a knowledgepress theme for my site and I have a problem with the Hero Live Search, I would like that it shows my custom post type, that I 've added with Pod's plugin.
By default, the Hero Live Search shows only page, faq and post's results.
Second question, I'd like to create a page with an accordion menu, that display my category with all my custom post types inside. Have you an issue for that? There is already a knowledgebase theme inclued with Knowledgepress but it only shows posts but not my custom post that I created.
Thanks for your help

  • Predrag Dubajic

    Hey @Eufonie,

    Hope you're doing well today :slight_smile:

    Recently, I've used a knowledgepress theme for my site and I have a problem with the Hero Live Search, I would like that it shows my custom post type, that I 've added with Pod's plugin.

    Try adding this code snippet in your theme functions.php file or creating new .php file in mu-plugins folder:

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

    Second question, I'd like to create a page with an accordion menu, that display my category with all my custom post types inside. Have you an issue for that? There is already a knowledgebase theme inclued with Knowledgepress but it only shows posts but not my custom post that I created.

    I'm not familiar with the Knowledgepress theme so maybe their support would be the right way to go as they know how the theme we built and would give best solution for this.
    You can also read some more about WP page templates here:
    https://codex.wordpress.org/Page_Templates

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.