返回介绍

install_theme_search_form()

发布于 2017-09-11 01:07:48 字数 3179 浏览 949 评论 0 收藏 0

install_theme_search_form( bool $type_selector = true )

Display search form for searching themes.


description


参数

$type_selector

(bool) (Optional)

Default value: true


源代码

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

function install_theme_search_form( $type_selector = true ) {
	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
	$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
	if ( ! $type_selector )
		echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>';
	?>
<form id="search-themes" method="get">
	<input type="hidden" name="tab" value="search" />
	<?php if ( $type_selector ) : ?>
	<label class="screen-reader-text" for="typeselector"><?php _e('Type of search'); ?></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', 'Theme Installer'); ?></option>
	</select>
	<label class="screen-reader-text" for="s"><?php
	switch ( $type ) {
		case 'term':
			_e( 'Search by keyword' );
			break;
		case 'author':
			_e( 'Search by author' );
			break;
		case 'tag':
			_e( 'Search by tag' );
			break;
	}
	?></label>
	<?php else : ?>
	<label class="screen-reader-text" for="s"><?php _e('Search by keyword'); ?></label>
	<?php endif; ?>
	<input type="search" name="s" id="s" size="30" value="<?php echo esc_attr($term) ?>" autofocus="autofocus" />
	<?php submit_button( __( 'Search' ), '', 'search', false ); ?>
</form>
<?php
}

更新日志

Versiondescription
2.8.0Introduced.

相关函数

Uses

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

Used By

  • wp-admin/includes/theme-install.php: install_themes_dashboard()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文