WordPress.org

Making WordPress.org


Ignore:
Timestamp:
03/22/2017 07:23:39 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Support Theme: Add "Search this forum" form to plugin- and theme-specific views.

Use the plugin or theme name as intext parameter in the search query passed to Google.

See #7.

File:
1 edited

Legend:

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

    r5022 r5163  
    1616<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    1717    <label for="s" class="screen-reader-text"><?php _ex( 'Search for:', 'label', 'wporg-forums' ); ?></label>
    18     <input type="search" id="s" class="search-field" placeholder="<?php echo esc_attr_x( 'Search forums', 'placeholder', 'wporg-forums' ); ?>" value="<?php the_search_query(); ?>" name="s" />
     18    <?php
     19        if ( 'wporg_compat_before_single_view' === current_action() ) {
     20            $placeholder = _x( 'Search this forum', 'placeholder', 'wporg-forums' );
     21            $project     = wporg_support_get_compat_object();
     22        } else {
     23            $placeholder = _x( 'Search forums', 'placeholder', 'wporg-forums' );
     24            $project     = null;
     25        }
     26    ?>
     27    <input type="search" id="s" class="search-field" placeholder="<?php echo esc_attr( $placeholder ); ?>" value="<?php the_search_query(); ?>" name="s" />
     28    <?php if ( $project ) : ?>
     29    <input type="hidden" name="intext" value="<?php echo esc_attr( $project->prefixed_title ); ?>" />
     30    <?php endif; ?>
    1931    <button class="button button-primary button-search"><i class="dashicons dashicons-search"></i><span class="screen-reader-text"><?php _e( 'Search forums', 'wporg-forums' ); ?></span></button>
    2032</form>
Note: See TracChangeset for help on using the changeset viewer.