Skip to:
Content
Pages
Categories
Search
Top
Bottom

Integrate WordPress search and bp group documents

  • @vijaychacko56

    Participant

    Hi,

    I am trying to customize the “Bp Group Documents” plugin.I would like to be able to search for a document uploaded based on document title. Has this already been done before? I would like to be able to search for a document in the WordPress default search option.

Viewing 6 replies - 1 through 6 (of 6 total)
  • @prashantvatsh

    Participant
    add_action( 'pre_get_posts', 'ps_bp_doc_search' );
    function ps_bp_doc_search( $query ) {
        if ( $query->is_search ) {
    	$query->set( 'post_type', array( 'post', 'page', 'bp_doc') );
        }
    }

    Please paste this function in your child theme’s functions.php. If there is no child theme then can use code snippets plugin https://wordpress.org/plugins/code-snippets/ to paste this snippet.

    Hopefully, this will help you.

    Thanks

    @vijaychacko56

    Participant

    Hello Prashant,

    Thank you for your response. I am currently working with the code solution you provided. For some reason, the query->set is not updating the post_type attribute of the Query Object. Still debugging this. Will update soon. Thank You

    @prashantvatsh

    Participant

    ok

    @vijaychacko56

    Participant

    Hi Prashant,

    The above solution did not work. Including ‘bp_doc’ as a post type in the $query object did not make a difference in the search as ‘bp_doc’ does not exist as a post type. Tried to create custom post type ‘bp_doc’ but couldn’t figure out a way to link the post type to the document list.

    Thank You

    @vijaychacko56

    Participant

    So is there any way I can Create a taxonomy or custom post type for the documents being uploaded through the Bp Group Documents plugin?

    @shanebp

    Moderator

    afaik, Bp Group Documents uses a custom table – not a custom post type.

    So search integration will require filtering the WP search SQL.
    And that is beyond the scope of these forums – therefore this thread will be closed.

    You can contact the plugin creator thru their support forum.
    You can find info on the web re filtering WP searches.
    Or perhaps you could hire a developer.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar