Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search form in the Sub forums


  • Stefan Velev
    Participant

    @kozzmen

    Hi there,

    I am trying to add a search form in the forum’s topics (sub forums) and I would like to hear your opinion on that issue.
    bbPress has built in search form, which is unfortunately available only on the main forums list.
    I would like to have that search on the sub forums as well at let my users search the forums when they are browsing the topics.

    Any idea how to achieve this?
    WP v. 3.9.2
    bbPress v. 2.5.3

Viewing 2 replies - 1 through 2 (of 2 total)

  • Toby
    Participant

    @tobyhawkins

    Not quite sure if I understand exactly what you want, but one of these should help..

    If you want to display a search form at the top of single topics add the following to your functions.php file:

        function my_bbp_topic_search_form(){
            ?>
            <div class="bbp-search-form">
         
                <?php bbp_get_template_part( 'form', 'search' ); ?>
         
            </div>
            <?php
        }
        add_action( 'bbp_template_before_single_topic', 'my_bbp_topic_search_form' );

    If you want a search form at the top of single forums (or sub forums) use the following in your functions.php file:

        function my_bbp_forum_search_form(){
            ?>
            <div class="bbp-search-form">
         
                <?php bbp_get_template_part( 'form', 'search' ); ?>
         
            </div>
            <?php
        }
        add_action( 'bbp_template_before_single_forum', 'my_bbp_forum_search_form' );

    If you want to limit results to the topic or forum in question that will be a little more tricky but the following post will point you in the right direction (it shows you how to limit searching to a single forum – you’ll need to customise further to apply it to a single topic): http://sevenspark.com/tutorials/how-to-search-a-single-forum-with-bbpress.

    Hope that helps.


    MrCarlLister
    Participant

    @mrcarllister

    I know this is an old thread but it was the one I came across when searching for a solution. I managed to use the link above and create a solution that will only search current and sub forums / topics. You can find it here.

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