install_theme_search_form

Display search form for searching themes.

Description

install_theme_search_form( (bool) $type_selector = true ); 

Parameters (1)

0. $type_selector — Optional. (bool) => true
The type selector.

Usage

  1. if ( !function_exists( 'install_theme_search_form' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/theme-install.php'; 
  3.  
  4. // The type selector. 
  5. $type_selector = true; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = install_theme_search_form($type_selector); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/theme-install.php  
  1. function install_theme_search_form( $type_selector = true ) { 
  2. $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; 
  3. $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; 
  4. if ( ! $type_selector ) 
  5. echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>'; 
  6. ?> 
  7. <form id="search-themes" method="get"> 
  8. <input type="hidden" name="tab" value="search" /> 
  9. <?php if ( $type_selector ) : ?> 
  10. <label class="screen-reader-text" for="typeselector"><?php _e('Type of search'); ?></label> 
  11. <select name="type" id="typeselector"> 
  12. <option value="term" <?php selected('term', $type) ?>><?php _e('Keyword'); ?></option> 
  13. <option value="author" <?php selected('author', $type) ?>><?php _e('Author'); ?></option> 
  14. <option value="tag" <?php selected('tag', $type) ?>><?php _ex('Tag', 'Theme Installer'); ?></option> 
  15. </select> 
  16. <label class="screen-reader-text" for="s"><?php 
  17. switch ( $type ) { 
  18. case 'term': 
  19. _e( 'Search by keyword' ); 
  20. break; 
  21. case 'author': 
  22. _e( 'Search by author' ); 
  23. break; 
  24. case 'tag': 
  25. _e( 'Search by tag' ); 
  26. break; 
  27. ?></label> 
  28. <?php else : ?> 
  29. <label class="screen-reader-text" for="s"><?php _e('Search by keyword'); ?></label> 
  30. <?php endif; ?> 
  31. <input type="search" name="s" id="s" size="30" value="<?php echo esc_attr($term) ?>" autofocus="autofocus" /> 
  32. <?php submit_button( __( 'Search' ), '', 'search', false ); ?> 
  33. </form> 
  34. <?php