Making WordPress.org


Ignore:
Timestamp:
06/11/2021 05:39:41 AM (4 years ago)
Author:
dd32
Message:

Support: Attempt to use bbPress/WordPress search for support forums.

This is kind of ugly and not perfect, this is just to get it out there.

Searches from Plugin/Theme subforums should be limited to that plugin/theme forum.
Searches for support threads (without plugin/themes) should be limited to not-plugin/theme/review forums.
Searches from homepage or where it says 'Documentation' should be limited to HelpHub articles/Pages.

This is temporary, and as a result, the urls are not super pretty, but should suffice for the immediate need.

SEe #5771.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/searchform.php

    r9664 r11025  
    2121            $placeholder = _x( 'Search this forum', 'placeholder', 'wporg-forums' );
    2222            $project     = wporg_support_get_compat_object();
     23            $tab         = $project->type;
     24            $project     = $project->post_name;
    2325        } elseif ( is_front_page() ) {
    2426            $placeholder = _x( 'Search documentation', 'placeholder', 'wporg-forums' );
    2527            $project     = null;
    2628            $tab         = 'docs';
     29        } elseif ( is_search() || bbp_is_search() ) {
     30            if ( isset( $_GET['tab'] ) ) {
     31                $tab     = $_GET['tab'];
     32                $project = $_GET[ $_GET['tab'] ];
     33            }
    2734        } else {
    2835            $placeholder = _x( 'Search forums', 'placeholder', 'wporg-forums' );
    2936            $project     = null;
     37            $tab         = 'support';
    3038        }
    3139    ?>
    32     <input type="search" id="s" class="search-field" placeholder="<?php echo esc_attr( $placeholder ); ?>" value="<?php the_search_query(); ?>" name="s" />
     40    <input type="search" id="s" class="search-field" placeholder="<?php echo esc_attr( $placeholder ); ?>" value="<?php echo esc_attr( get_query_var( 's' ) ?: get_query_var( 'bbp_search' ) ) ?>" name="s" />
    3341    <?php if ( $project ) : ?>
    34     <input type="hidden" name="intext" value="<?php echo esc_attr( $project->prefixed_title ); ?>" />
     42    <input type="hidden" name="<?php echo esc_attr( $tab ); ?>" value="<?php echo esc_attr( $project ); ?>" />
    3543    <?php endif; ?>
    3644    <?php if ( $tab ) : ?>
Note: See TracChangeset for help on using the changeset viewer.