• Resolved amityweb

    (@amityweb)


    How do we search other plugins an custom post types? For example, we have added KnB Knowledge Base plugin but Global BuddyPress search does not search it. We need a way to add the search results of any type of content to the search results, we cant have a search form that searches only half the site. So is there a way to do it, some hooks/action/filters?

    Thanks
    Laurence

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter amityweb

    (@amityweb)

    Also, the KnB plugin has its own search form on the Knowledge base page, but looks like Global BuddyPress is overriding it, its not searching knowledge base articles but searching BuddyPress!

    Plugin Author BuddyBoss

    (@buddyboss)

    Hey @amityweb,

    Thanks for reaching out with your question.

    I’m afraid there is no filters/hooks/actions inside Global Search plugin to add the search results of any type of content to the search results. It might be doable with custom coding inside plugin itself.

    Thread Starter amityweb

    (@amityweb)

    Can you give us any hints please? I see other posts where you say you will add support, so what is required?

    Also, do you know how to stop your search form taking over the KnB form? Thats what seems to be happening, and is actually the main issue my customer reported, that the KnB form is not showing knowledgeable results, but it is showing all other buddypress results, which the main search form does.

    Thanks

    i’m having the same issue. the global search plugin, although in the screenshots shows an option for custom post types, i dont see the option in the admin to enable such feature. and i also have a knowledgebase plugin i’d like to use with this. I bought the boss theme and a bunch of buddyboss plugins to get my site up n running but this is the only bottleneck. search the knowledgebase is quite important for the community i’m building

    Thread Starter amityweb

    (@amityweb)

    hi @buddyboss. Any updates on this? How do we ourselves add a search to your plugin (in my case KnB) and how can we stop it overriding the built in KnB search form?

    Thanks

    Plugin Author BuddyBoss

    (@buddyboss)

    @amityweb
    Adding a search to any plugins require a hell of codes. It’s not just one filter or couple lines of code. ??

    First off one would need to add search item option in plugin setting options

    Then need one class for the custom search type which inherited from BBoss_Global_Search_Type , you can refer /plugins/buddyboss-global-search/includes/search-types/class.BBoss_Global_Search_Posts.php

    how can we stop it overriding the built in KnB search form?

    Remove following items from KnB search form tag markup if consist any of the followings

    Remove role=’search’ attribute from search tag

    Remove search-form and searchform from class attribute of KnB search form

    Make sure search form id is not the adminbarsearch

    Thread Starter amityweb

    (@amityweb)

    Thank you will have a look
    I had a look at one of the other search classes you have added, and I didnt think it looked too bad. I am a PHP developer so the others looked OK to me. I was going to try duplicating one of the other ones you have, then changing the code to search KnB data instead.

    @amityweb Where you successful in adding a new custom post type to the buddypress global search?

    Plugin Author BuddyBoss

    (@buddyboss)

    Hi @pandraka
    If you have not set Exclude From Search true while creating new custom post type, it will be available as an option inside global search plugin.
    Inside the Custom Post Type UI plugin, you can find as following options, keep it false.

    Exclude From Search (default: false) Whether or not to exclude posts with this post type from front end search results.

    Great, but I didn’t use a plugin to create the custom post type. I did add these two lines to the function that creates the game reports:

    ‘exclude_from_search’ => false,
    ‘publicly_queryable’ => true,

    and now I see them in the BuddyPress Global Search panel.

    Thank you.

    Plugin Author BuddyBoss

    (@buddyboss)

    Great ??

    Thread Starter amityweb

    (@amityweb)

    Sorry for late reply but I can confirm changing

    'exclude_from_search' => true,
    to
    'exclude_from_search' => false,
    in
    KnB-knowledge-base-wordpress/includes/class-wpKnB-functions.php
    shows Knowledge Base in the BP Global Search menu, and selecting it means the Knowlegde Base is searchable.

    In fact, the following code in your functions.php file will do it without modifying the Knowledge Base plugin.

    /**
     * Add Knowledge Base into Search
     */
    function change_capabilities_of_knowledge_base_posttype( $args, $post_type )
    {
    	// Do not filter any other post type
    	if ( $post_type !== 'knowledge_base' )
    	{
    		// Give other post_types their original arguments
    		return $args;
    	}
    
    	// Change the capability_type of the "custom-css-js" post_type
    	$args['exclude_from_search'] = false;
    
    	// Give the custom-css-js post type it's arguments
    	return $args;
    }
    add_filter( 'register_post_type_args', 'change_capabilities_of_knowledge_base_posttype' , 10, 2 );

    Why someone would make a knowledge base not searchable beats me.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to search other plugins/custom posts?’ is closed to new replies.