install_theme_search

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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: