Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using my search form on the main forum page?

  • @ajtruckle

    Participant

    I have this custom code to display a form on the stated pages:

    // ==============================================================
    //display bbPress search form above single topics and forums
    function rk_bbp_search_form(){

    if ( bbp_allow_search()) {
    ?>
    <form role=”search” method=”get” id=”bbp-search-form” action=”https://www.publictalksoftware.co.uk/support-forums/search/”&gt;
    <div class=”trucklesoft-bbp-searchrow”>
    <label class=”screen-reader-text hidden” for=”bbp_search”>Search for:</label>
    <input type=”hidden” name=”action” value=”bbp-search-request”>
    <input tabindex=”101″ type=”text” value=”” name=”bbp_search” id=”bbp_search”>
    <input tabindex=”102″ class=”button” type=”submit” id=”bbp_search_submit” value=”Search”>
    </div>

    <div class=”gdpos-power-link”>
    Advanced Search
    </div>
    </form> <?php
    }
    }

    add_action( ‘bbp_template_before_single_forum’, ‘rk_bbp_search_form’ );
    add_action( ‘bbp_template_before_single_topic’, ‘rk_bbp_search_form’ );
    // ==============================================================

    Can I also use this code to replace the form that is displayed at the top of the forums page too?

    This is because I have introduced my own class which I now need also on the main forum page form:

    https://www.publictalksoftware.co.uk/support-forums/

    General Information

    You will see they look different.

    Is there just another action I need to add here?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @ajtruckle

    Participant

    At the moment I added this additional styling:

    #bbp-search-form > div { display: flex; }
    #bbp-search-form > div input[type=text] { flex: 1; }

    @ajtruckle

    Participant

    Please ignore.

    I simply use:

    /* Widen the search form */
    #bbp-search-form > div:first-of-type { display: flex; }
    #bbp-search-form #bbp_search { flex: 1; margin-right: 5px; }
    #bbp-search-form #bbp_search_submit { margin-top: 0px; margin-bottom: 0px; }

    @ajtruckle

    Participant

    Actually, my original question still stands. I had modified this code to add a placeholder (for consistency)

    // ============================================================== 
    //display bbPress search form above single topics and forums
    function rk_bbp_search_form(){
      
        if ( bbp_allow_search()) {
            ?>
    <form role="search" method="get" id="bbp-search-form" action="https://www.publictalksoftware.co.uk/support-forums/search/">
        <div class="trucklesoft-bbp-searchrow">
            <label class="screen-reader-text hidden" for="bbp_search">Search for:</label>
            <input type="hidden" name="action" value="bbp-search-request">
            <input tabindex="101" type="text" value="" name="bbp_search" id="bbp_search" placeholder="Type Search Term ...">
            <input tabindex="102" class="button" type="submit" id="bbp_search_submit" value="Search">
        </div>
    
        <div class="gdpos-power-link">
            <a href="https://www.publictalksoftware.co.uk/support-forums/search/">Advanced Search</a>
        </div>
    </form>        <?php
        }
    }
      
    add_action( 'bbp_template_before_single_forum', 'rk_bbp_search_form' );
    add_action( 'bbp_template_before_single_topic', 'rk_bbp_search_form' );
    // ==============================================================

    Now I would also like to add this placeholder to the search form here:

    https://www.publictalksoftware.co.uk/support-forums/

    It shows OK everywhere else, example:

    Frequently Asked Questions

    Thank you.

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