1

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();
?>
2
  • I try with WP Query, but it didn't show nothing Please share what you tried. So that, others can help in making it work! – Pothi Kalimuthu Sep 17 '13 at 10:41
  • I edited my first post. – Dido Kotsev Sep 17 '13 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.