get_the_title

Definition:
function get_the_title( $id = 0 ) {}

Retrieve post title.
If the post is protected and the visitor is not an admin, then "Protected" will be displayed before the post title. If the post is private, then "Private" will be located before the post title.

Parameters

  • int $id: Optional. Post ID.

Defined filters

  • protected_title_format
    apply_filters('protected_title_format', __('Protected: %s')
  • private_title_format
    apply_filters('private_title_format', __('Private: %s')
  • the_title
    apply_filters( 'the_title', $title, $id )

Source code

function get_the_title( $id = 0 ) {

	$post = &get_post($id);



	$title = isset($post->post_title) ? $post->post_title : '';

	$id = isset($post->ID) ? $post->ID : (int) $id;



	if ( !is_admin() ) {

		if ( !empty($post->post_password) ) {

			$protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));

			$title = sprintf($protected_title_format, $title);

		} else if ( isset($post->post_status) && 'private' == $post->post_status ) {

			$private_title_format = apply_filters('private_title_format', __('Private: %s'));

			$title = sprintf($private_title_format, $title);

		}

	}

	return apply_filters( 'the_title', $title, $id );

}

1859

get_the_time

Definition:
function get_the_time( $d = '', $post = null ) {}

Retrieve the time at which the post was written.

Parameters

  • string $d: Optional Either ‘G’, ‘U’, or php date format defaults to the value specified in the time_format option.
  • int|object $post: Optional post ID or object. Default is global $post object.

Defined filters

  • get_the_time
    apply_filters('get_the_time', $the_time, $d, $post)

Source code

function get_the_time( $d = '', $post = null ) {

	$post = get_post($post);



	if ( '' == $d )

		$the_time = get_post_time(get_option('time_format'), false, $post, true);

	else

		$the_time = get_post_time($d, false, $post, true);

	return apply_filters('get_the_time', $the_time, $d, $post);

}

1857

get_the_term_list

Definition:
function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {}

Retrieve a post’s terms as a list with specified format.

Parameters

  • int $id: Post ID.
  • string $taxonomy: Taxonomy name.
  • string $before: Optional. Before list.
  • string $sep: Optional. Separate items using this.
  • string $after: Optional. After list.

Defined filters

  • term_links-$taxonomy
    apply_filters( "term_links-$taxonomy", $term_links )

Source code

function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {

	$terms = get_the_terms( $id, $taxonomy );



	if ( is_wp_error( $terms ) )

		return $terms;



	if ( empty( $terms ) )

		return false;



	foreach ( $terms as $term ) {

		$link = get_term_link( $term, $taxonomy );

		if ( is_wp_error( $link ) )

			return $link;

		$term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';

	}



	$term_links = apply_filters( "term_links-$taxonomy", $term_links );



	return $before . join( $sep, $term_links ) . $after;

}

1855

get_the_terms

Definition:
function get_the_terms( $id = 0, $taxonomy ) {}

Retrieve the terms of the taxonomy that are attached to the post.

Parameters

  • int $id: Post ID. Is not optional.
  • string $taxonomy: Taxonomy name.

Return values

returns:False on failure. Array of term objects on success.

Defined filters

  • get_the_terms
    apply_filters( 'get_the_terms', $terms, $id, $taxonomy )

Source code

function get_the_terms( $id = 0, $taxonomy ) {

	global $post;



 	$id = (int) $id;



	if ( !$id ) {

		if ( !$post->ID )

			return false;

		else

			$id = (int) $post->ID;

	}



	$terms = get_object_term_cache( $id, $taxonomy );

	if ( false === $terms ) {

		$terms = wp_get_object_terms( $id, $taxonomy );

		wp_cache_add($id, $terms, $taxonomy . '_relationships');

	}



	$terms = apply_filters( 'get_the_terms', $terms, $id, $taxonomy );



	if ( empty( $terms ) )

		return false;



	return $terms;

}

1853

get_the_taxonomies

Definition:
function get_the_taxonomies($post = 0, $args = array() {}

Retrieve all taxonomies associated with a post.
This function can be used within the loop. It will also return an array of the taxonomies with links to the taxonomy and name.

Parameters

  • int $post: Optional. Post ID or will use Global Post ID (in loop).
  • array $args: Override the defaults.

Source code

function get_the_taxonomies($post = 0, $args = array() ) {

	if ( is_int($post) )

		$post =& get_post($post);

	elseif ( !is_object($post) )

		$post =& $GLOBALS['post'];



	$args = wp_parse_args( $args, array(

		'template' => '%s: %l.',

	) );

	extract( $args, EXTR_SKIP );



	$taxonomies = array();



	if ( !$post )

		return $taxonomies;



	foreach ( get_object_taxonomies($post) as $taxonomy ) {

		$t = (array) get_taxonomy($taxonomy);

		if ( empty($t['label']) )

			$t['label'] = $taxonomy;

		if ( empty($t['args']) )

			$t['args'] = array();

		if ( empty($t['template']) )

			$t['template'] = $template;



		$terms = get_object_term_cache($post->ID, $taxonomy);

		if ( empty($terms) )

			$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);



		$links = array();



		foreach ( $terms as $term )

			$links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>";



		if ( $links )

			$taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);

	}

	return $taxonomies;

}

1851