Skip to:
Content
Pages
Categories
Search
Top
Bottom

search function still available after searching


  • haddly
    Participant

    @haddly

    Hi,
    I have received a few complaints from my users, that when they search in the our forum, a result list displays, but it’s not possible to keep searching without having to go back to the main forum page.
    Is there a way to keep the search function on every page/post of the forum?
    thanks in advance for any replies/help with this.
    Daniel

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

  • haddly
    Participant

    @haddly

    Do i need to provide more information for this query to be answered?


    Robin W
    Moderator

    @robin-w

    no just a little patience !


    haddly
    Participant

    @haddly

    Thx, didn’t mean to be pushy


    Robkk
    Moderator

    @robkk

    Use this PHP code place it into a child theme functions.php file or use a plugin like functionality.

    //display bbPress search form in search results
    function rk_bbp_search_form_in_search_results(){
    
        if ( bbp_allow_search() && bbp_is_search_results() ) {
            ?>
            <div class="bbp-search-form">
    
                <?php bbp_get_template_part( 'form', 'search' ); ?>
    
            </div>
            <?php
        }
    }
    
    add_action( 'bbp_template_before_search', 'rk_bbp_search_form_in_search_results' );

    Also look at this guide.

    https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#23-show%c2%a0the-bbpress-forum-search-everywhere


    haddly
    Participant

    @haddly

    Hi Robkk,

    Thanks for the code. unfortunately it doesn’t work for my website. Well, I have a vagrant set up on my computer with a copy website and i test everything there before i make real changes.
    I made a child theme and a style.css file (this works as my wordpress site recognises it) and i made a functions.php file and added the code you gave me. The thing is, i tried some other code that exists on https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#23-show%c2%a0the-bbpress-forum-search-everywhere and they didnt work either.
    any suggestions?
    would greatly appreciate any help.
    thx
    Dan


    haddly
    Participant

    @haddly

    Hi,
    can you tell me if its actually worth adding a child theme, if the parent theme is an individually created one by a web design company? There wont be any updates to this theme.
    Also, can you explain what you meant by “… or use a plugin like functionality. “.?


    Robkk
    Moderator

    @robkk

    Also, can you explain what you meant by “… or use a plugin like functionality. “.?

    This plugin its called Functionality, its like a plugin that can hold custom php code snippets.

    https://wordpress.org/plugins/functionality/

    Thanks for the code. unfortunately it doesn’t work for my website

    Both of the code snippets I posted should show the forum search above a single topic, single forum, and in search results. Well unless your custom theme has custom bbPress templates with all the available hooks I am using in my code removed.

    can you tell me if its actually worth adding a child theme, if the parent theme is an individually created one by a web design company?

    I mean you do not have to.


    haddly
    Participant

    @haddly

    Hi,
    can you tell me if i should be able to add this to my functions.php file and it should work?
    The reason i ask is that i have tried it and it doesnt show any search box after the initial search.
    thx

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