get_template_directory

Definition:
function get_template_directory() {}

Retrieve current theme directory.

Return values

returns:Template directory path.

Defined filters

  • template_directory
    apply_filters( 'template_directory', $template_dir, $template, $theme_root )

Source code

function get_template_directory() {

	$template = get_template();

	$theme_root = get_theme_root( $template );

	$template_dir = "$theme_root/$template";



	return apply_filters( 'template_directory', $template_dir, $template, $theme_root );

}

1739

get_template

Definition:
function get_template() {}

Retrieve name of the current theme.

Return values

returns:Template name.

Defined filters

  • template
    apply_filters('template', get_option('template')

Source code

function get_template() {

	return apply_filters('template', get_option('template'));

}

1737

get_taxonomy_template

Definition:
function get_taxonomy_template() {}

Retrieve path of taxonomy template in current or parent template.
Retrieves the taxonomy and term, if term is available. The template is prepended with ‘taxonomy-‘ and followed by both the taxonomy string and the taxonomy string followed by a dash and then followed by the term.

Source code

function get_taxonomy_template() {

	$term = get_queried_object();

	$taxonomy = $term->taxonomy;



	$templates = array();



	$templates[] = "taxonomy-$taxonomy-{$term->slug}.php";

1735

get_taxonomy_labels

Definition:
function get_taxonomy_labels( $tax ) {}

Builds an object with all taxonomy labels out of a taxonomy object
Accepted keys of the label array in the taxonomy object:

Parameters

  • object $tax: Taxonomy object

Return values

returns:with all the labels as member variables

Source code

function get_taxonomy_labels( $tax ) {

	if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) )

		$tax->labels['separate_items_with_commas'] = $tax->helps;



	$nohier_vs_hier_defaults = array(

		'name' => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ),

		'singular_name' => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ),

		'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ),

		'popular_items' => array( __( 'Popular Tags' ), null ),

		'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ),

		'parent_item' => array( null, __( 'Parent Category' ) ),

		'parent_item_colon' => array( null, __( 'Parent Category:' ) ),

		'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),

		'view_item' => array( __( 'View Tag' ), __( 'View Category' ) ),

		'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ),

		'add_new_item' => array( __( 'Add New Tag' ), __( 'Add New Category' ) ),

		'new_item_name' => array( __( 'New Tag Name' ), __( 'New Category Name' ) ),

		'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ),

		'add_or_remove_items' => array( __( 'Add or remove tags' ), null ),

		'choose_from_most_used' => array( __( 'Choose from the most used tags' ), null ),

	);

	$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];



	return _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );

}

1733

get_taxonomy

Definition:
function get_taxonomy( $taxonomy ) {}

Retrieves the taxonomy object of $taxonomy.
The get_taxonomy function will first check that the parameter string given is a taxonomy object and if it is, it will return it.

Parameters

  • string $taxonomy: Name of taxonomy object to return

Return values

returns:The Taxonomy Object or false if $taxonomy doesn’t exist

Source code

function get_taxonomy( $taxonomy ) {

	global $wp_taxonomies;



	if ( ! taxonomy_exists( $taxonomy ) )

		return false;



	return $wp_taxonomies[$taxonomy];

}

1731