nanodesigns / nanosupport

Create a fully featured Support Center in your WordPress setup without any third party dependency, completely FREE. Get a built-in Knowledgebase too. The plugin is available on WordPress.org repository:
https://wordpress.org/plugins/nanosupport/
GNU General Public License v2.0
50 stars 13 forks source link

How to search Knowledgebase separately? #18

Closed mayeenulislam closed 5 years ago

mayeenulislam commented 7 years ago

Chris from ibousa.org asked:

Is there a way to search all items in the Knowledgebase?

mayeenulislam commented 7 years ago

Currently with NanoSupport v0.2.2 the knowledgebase cannot be searched separately from site search. But the site search works well with NanoSupport knowledgebase.

You can test at the following link (the site search is at the bottom of the page): http://dev.nanodesignsbd.com/knowledgebase/ (P.S.: the demo link might change anytime, because it's a dev. environment)

A system in under development and currently at a promising state to let the user search Knowledgebase separately. InshALLAH we will unveil very soon.

fang-yu commented 6 years ago

I use DIVI theme, but seem like the wordpress search bar can not even search the knowledge base post. I see in the demo site, you add a search bar in the bottom, may I ask that how to do that?

mayeenulislam commented 6 years ago

@fang-yu We second to the issue. Because from NanoSupport core the Knowledgebase entries are searchable.

It might be your theme that is prohibiting exhibiting any other Custom Post Type to appear on the search result. In that case what we can suggest is to tweak the search result with the pre_get_posts hook:

<?php
function tweaking_mytheme_search_result( $query ) {
    if( is_admin() ) return;

    if( is_search() && $query->is_main_query() ) {
        $query->set('post_type', 'nanodoc');
    } 
}

add_action( 'pre_get_posts', 'tweaking_mytheme_search_result' );

Source: WordPress StackExchange by tormorten

fang-yu commented 6 years ago

Thanks. But n order to do so, do you mean that I could add the following code to the functions.php in my theme folder ?

<?php
function tweaking_mytheme_search_result( $query ) {
    if( is_admin() ) return;

    if( is_search() && $query->is_main_query() ) {
        $query->set('post_type', 'nanodoc');
    } 
}

add_action( 'pre_get_posts', 'tweaking_mytheme_search_result' );
mayeenulislam commented 6 years ago

Yes, not in the parent theme, but in your child theme's functions.php so that theme update won't wash the code away.

mayeenulislam commented 5 years ago

We are glad to announce the first Premium Add-on for NanoSupport:

Addon: Knowledgebase Search - NanoSupport

Requires NanoSupport v0.6.0

It will suggest from the Knowledgebase Docs while submitting a new ticket, and it will enable a separate search feature in Knowledgebase. 😃