themes_api

Definition:
function themes_api($action, $args = null) {}

Retrieve theme installer pages from WordPress Themes API.
It is possible for a theme to override the Themes API result with three filters. Assume this is for themes, which can extend on the Theme Info to offer more choices. This is very powerful and must be used with care, when overridding the filters.

Parameters

  • string $action
  • array|object $args: Optional. Arguments to serialize for the Theme Info API.

Defined filters

  • themes_api_args
    apply_filters('themes_api_args', $args, $action)
  • themes_api
    apply_filters('themes_api', false, $action, $args)
  • themes_api_result
    apply_filters('themes_api_result', $res, $action, $args)

Source code

function themes_api($action, $args = null) {



	if ( is_array($args) )

		$args = (object)$args;



	if ( !isset($args->per_page) )

		$args->per_page = 24;



	$args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.

	$res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API.



	if ( ! $res ) {

		$request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );

		if ( is_wp_error($request) ) {

			$res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() );

		} else {

			$res = unserialize( wp_remote_retrieve_body( $request ) );

			if ( ! $res )

			$res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) );

		}

	}

	//var_dump(array($args, $res));

	return apply_filters('themes_api_result', $res, $action, $args);

}

10329

submit_button

Definition:
function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {}

Echos a submit button, with provided text and appropriate class

Parameters

  • string $text: The text of the button (defaults to ‘Save Changes’)
  • string $type: The type of button. One of: primary, secondary, delete
  • string $name: The HTML name of the submit button. Defaults to “submit”. If no id attribute is given in $other_attributes below, $name will be used as the button’s id.
  • bool $wrap: True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true
  • array|string $other_attributes: Other attributes that should be output with the button, mapping attributes to their values, such as array( ‘tabindex’ => ‘1’ ). These attributes will be output as attribute=”value”, such as tabindex=”1″. Defaults to no other attributes. Other attributes can also be provided as a string such as ‘tabindex=”1″‘, though the array format is typically cleaner.

Source code

function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {

	echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );

}

10318

sort_menu

Definition:
function sort_menu($a, $b) {}

Parameters

  • $a
  • $b

Source code

	function sort_menu($a, $b) {

		global $menu_order, $default_menu_order;

		$a = $a[2];

		$b = $b[2];

		if ( isset($menu_order[$a]) && !isset($menu_order[$b]) ) {

			return -1;

		} elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) {

			return 1;

		} elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) {

			if ( $menu_order[$a] == $menu_order[$b] )

				return 0;

			return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1;

		} else {

			return ($default_menu_order[$a] <= $default_menu_order[$b]) ? -1 : 1;

		}

	}

10307

single_term_title

Definition:
function single_term_title( $prefix = '', $display = true ) {}

Display or retrieve page title for taxonomy term archive.
Useful for taxonomy term template files for displaying the taxonomy term page title. It has less overhead than wp_title(), because of its limited implementation.

Parameters

  • string $prefix: Optional. What to display before the title.
  • bool $display: Optional, default is true. Whether to display or retrieve title.

Return values

returns:Title when retrieving, null when displaying or failure.

Defined filters

  • single_cat_title
    apply_filters( 'single_cat_title', $term->name )
  • single_tag_title
    apply_filters( 'single_tag_title', $term->name )
  • single_term_title
    apply_filters( 'single_term_title', $term->name )

Source code

function single_term_title( $prefix = '', $display = true ) {

	$term = get_queried_object();



	if ( !$term )

		return;



	if ( is_category() )

		$term_name = apply_filters( 'single_cat_title', $term->name );

	elseif ( is_tag() )

		$term_name = apply_filters( 'single_tag_title', $term->name );

	elseif ( is_tax() )

		$term_name = apply_filters( 'single_term_title', $term->name );

	else

		return;



	if ( empty( $term_name ) )

		return;



	if ( $display )

		echo $prefix . $term_name;

	else

		return $term_name;

}

10301

show_admin_bar

Definition:
function show_admin_bar( $show ) {}

Set the display status of the admin bar.
This can be called immediately upon plugin load. It does not need to be called from a function hooked to the init action.

Parameters

  • bool $show: Whether to allow the admin bar to show.

Source code

function show_admin_bar( $show ) {

	global $show_admin_bar;

	$show_admin_bar = (bool) $show;

}

10286