get_author_name

Definition:
function get_author_name( $auth_id = false ) {}

Retrieve the specified author’s preferred display name.

Parameters

  • int $auth_id: The ID of the author.

Return values

returns:The author’s display name.

Source code

function get_author_name( $auth_id = false ) {

	_deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' );

	return get_the_author_meta('display_name', $auth_id);

}

1170

get_author_link

Definition:
function get_author_link($echo = false, $author_id, $author_nicename = '') {}

Returns or Prints link to the author’s posts.

Parameters

  • bool $echo: Optional.
  • int $author_id: Required.
  • string $author_nicename: Optional.

Source code

function get_author_link($echo = false, $author_id, $author_nicename = '') {

	_deprecated_function( __FUNCTION__, '2.1', 'get_author_posts_url()' );



	$link = get_author_posts_url($author_id, $author_nicename);



	if ( $echo )

		echo $link;

	return $link;

}

1168

get_author_feed_link

Definition:
function get_author_feed_link( $author_id, $feed = '' ) {}

Retrieve the feed link for a given author.
Returns a link to the feed for all posts by a given author. A specific feed can be requested or left blank to get the default feed.

Parameters

  • int $author_id: ID of an author.
  • string $feed: Optional. Feed type.

Return values

returns:Link to the feed for the author specified by $author_id.

Defined filters

  • author_feed_link
    apply_filters('author_feed_link', $link, $feed)

Source code

function get_author_feed_link( $author_id, $feed = '' ) {

	$author_id = (int) $author_id;

	$permalink_structure = get_option('permalink_structure');



	if ( empty($feed) )

		$feed = get_default_feed();



	if ( '' == $permalink_structure ) {

		$link = home_url("?feed=$feed&author=" . $author_id);

	} else {

		$link = get_author_posts_url($author_id);

		if ( $feed == get_default_feed() )

			$feed_link = 'feed';

		else

			$feed_link = "feed/$feed";



		$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');

	}



	$link = apply_filters('author_feed_link', $link, $feed);



	return $link;

}

1166

get_attachment_template

Definition:
function get_attachment_template() {}

Retrieve path of attachment template in current or parent template.
The attachment path first checks if the first part of the mime type exists. The second check is for the second part of the mime type. The last check is for both types separated by an underscore. If neither are found then the file ‘attachment.php’ is checked and returned.

Source code

function get_attachment_template() {

	global $posts;

	$type = explode('/', $posts[0]->post_mime_type);

	if ( $template = get_query_template($type[0]) )

		return $template;

	elseif ( $template = get_query_template($type[1]) )

		return $template;

	elseif ( $template = get_query_template("$type[0]_$type[1]") )

		return $template;

	else

		return get_query_template('attachment');

}

1164

get_attachment_taxonomies

Definition:
function get_attachment_taxonomies($attachment) {}

Retrieve taxonomies attached to the attachment.

Parameters

  • int|array|object $attachment: Attachment ID, Attachment data array, or Attachment data object.

Return values

returns:Empty array on failure. List of taxonomies on success.

Source code

function get_attachment_taxonomies($attachment) {

	if ( is_int( $attachment ) )

		$attachment = get_post($attachment);

	else if ( is_array($attachment) )

		$attachment = (object) $attachment;



	if ( ! is_object($attachment) )

		return array();



	$filename = basename($attachment->guid);



	$objects = array('attachment');



	if ( false !== strpos($filename, '.') )

		$objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);

	if ( !empty($attachment->post_mime_type) ) {

		$objects[] = 'attachment:' . $attachment->post_mime_type;

		if ( false !== strpos($attachment->post_mime_type, '/') )

			foreach ( explode('/', $attachment->post_mime_type) as $token )

				if ( !empty($token) )

					$objects[] = "attachment:$token";

	}



	$taxonomies = array();

	foreach ( $objects as $object )

		if ( $taxes = get_object_taxonomies($object) )

			$taxonomies = array_merge($taxonomies, $taxes);



	return array_unique($taxonomies);

}

1162