Skip to:
Content
Pages
Categories
Search
Top
Bottom

BBPress Search results in WordPress search


  • alien13
    Participant

    @alien13

    I want to display in WordPress search results page – 10 or less found results from BBPress (plugin) forums. I know that BBPress use custom post types (forum, topic, reply) but I don’t know how to do it. I try with WP Query, but it didn’t show nothing. I don’t want to override BBPress search page and functions, I just want to show some results in WordPress search page. Is this possible?

    Thank you all in advance.

    Here is the query I try:

    <?php 
        // The Query
        $the_query = new WP_Query( array (
            'post_type' => array('topic', 'reply'),
            'posts_per_page' => 10,
            's'=> $s
        ));
    
        // The Loop
        if ( $the_query->have_posts() ) {
            while ( $the_query->have_posts() ) { $the_query->the_post();
                echo '<li>' . get_the_title() . '</li>';
            }
        } else {
        // no posts found
        }
        /* Restore original Post Data */
        wp_reset_postdata();
    ?>

You must be logged in to reply to this topic.