Definition:
function install_theme_search($page) {}
Display theme search results
Parameters
- string $page
Source code
function install_theme_search($page) {
global $theme_field_defaults;
$type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
$term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
$args = array();
switch( $type ){
case 'tag':
$terms = explode(',', $term);
$terms = array_map('trim', $terms);
$terms = array_map('sanitize_title_with_dashes', $terms);
$args['tag'] = $terms;
break;
case 'term':
$args['search'] = $term;
break;
case 'author':
$args['author'] = $term;
break;
}
$args['page'] = $page;
$args['fields'] = $theme_field_defaults;
if ( !empty( $_POST['features'] ) ) {
$terms = $_POST['features'];
$terms = array_map( 'trim', $terms );
$terms = array_map( 'sanitize_title_with_dashes', $terms );
$args['tag'] = $terms;
$_REQUEST['s'] = implode( ',', $terms );
$_REQUEST['type'] = 'tag';
}
$api = themes_api('query_themes', $args);
if ( is_wp_error($api) )
wp_die($api);
add_action('install_themes_table_header', 'install_theme_search_form');
display_themes($api->themes, $api->info['page'], $api->info['pages']);
}
2065

February 12, 2011 


No comments yet... Be the first to leave a reply!