install_search_form() - WordPress 函数参考中文文档

返回介绍

install_search_form()

发布于 2017-09-11 字数3008 浏览 785 评论 0

install_search_form( bool $deprecated = true )

Displays a search form for searching plugins.


描述


参数

$deprecated

(bool)
(Optional)
Not used.

Default value: true


源代码

File: wp-admin/includes/plugin-install.php

function install_search_form( $deprecated = true ) {
	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
	$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
	?><form class="search-form search-plugins" method="get">
		<input type="hidden" name="tab" value="search" />
		<label class="screen-reader-text" for="typeselector"><?php _e( 'Search plugins by:' ); ?></label>
		<select name="type" id="typeselector">
			<option value="term"<?php selected( 'term', $type ); ?>><?php _e( 'Keyword' ); ?></option>
			<option value="author"<?php selected( 'author', $type ); ?>><?php _e( 'Author' ); ?></option>
			<option value="tag"<?php selected( 'tag', $type ); ?>><?php _ex( 'Tag', 'Plugin Installer' ); ?></option>
		</select>
		<label><span class="screen-reader-text"><?php _e( 'Search Plugins' ); ?></span>
			<input type="search" name="s" value="<?php echo esc_attr( $term ) ?>" class="wp-filter-search" placeholder="<?php esc_attr_e( 'Search plugins...' ); ?>" />
		</label>
		<?php submit_button( __( 'Search Plugins' ), 'hide-if-js', false, false, array( 'id' => 'search-submit' ) ); ?>
	</form><?php
}

更新日志

Version 描述
4.6.0 The $type_selector parameter was deprecated.
2.7.0 Introduced.

相关函数

Uses

  • wp-admin/includes/template.php:
    submit_button()
  • wp-includes/l10n.php:
    _e()
  • wp-includes/l10n.php:
    _ex()
  • wp-includes/l10n.php:
    esc_attr_e()
  • wp-includes/l10n.php:
    __()
  • wp-includes/formatting.php:
    wp_unslash()
  • wp-includes/formatting.php:
    esc_attr()
  • wp-includes/general-template.php:
    selected()
  • Show 3 more uses
    Hide more uses


Used By

  • wp-admin/includes/class-wp-plugin-install-list-table.php:
    WP_Plugin_Install_List_Table::views()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!