Template Tags

Please use only these Media Credit template tags in your themes. Previous versions of the Media Credit plugin have not distinguished between the public API and private helper functions, but from version 3.0 forward, only the functions documented here will be available.

get_media_credit( $post )

Template tag to return the media credit as plain text for some media attachment.

Parameters

TypeNameDescriptionOptionalDefault
int or object$postPost ID or object of attachmentyesThe global $post object

the_media_credit( $post )

Template tag to print the media credit as plain text for some media attachment.

Parameters

TypeNameDescriptionOptionalDefault
int or object$postPost ID or object of attachmentyesThe global $post object

get_media_credit_url( $post )

Template tag to return the media credit URL as plain text for some media attachment.

Parameters

TypeNameDescriptionOptionalDefault
int or object$postPost ID or object of attachmentyesThe global $post object

the_media_credit_url( $post )

Template tag to print the media credit URL as plain text for some media attachment.

Parameters

TypeNameDescriptionOptionalDefault
int or object$postPost ID or object of attachmentyesThe global $post object

get_media_credit_html( $post, $include_default_credit )

Template tag to return the media credit as HTML with a link to the author page if one exists for some media attachment.

Parameters

TypeNameDescriptionOptionalDefault
int or object$postPost ID or object of attachmentyesThe global $post object
boolean$include_default_creditFlag to decide if default credits (owner) should be returned as wellyestrue

the_media_credit_html( $post )

Template tag to print the media credit as HTML with a link to the author page if one exists for some media attachment.

Parameters

TypeNameDescriptionOptionalDefault
int or object$postPost ID or object of attachmentyesThe global $post object

get_media_credit_html_by_user_ID( $id )

Template tag to return the media credit as HTML with a link to the author page if one exists for a WordPress user.

Parameters

TypeNameDescriptionOptionalDefault
int$idThe user ID of a WordPress userno

the_media_credit_html_by_user_ID( $id )

Template tag to print the media credit as HTML with a link to the author page if one exists for a WordPress user.

Parameters

TypeNameDescriptionOptionalDefault
int$idThe user ID of a WordPress userno

display_author_media( $author_id, $sidebar, $limit, $link_without_parent , $header, $exclude_unattached )

Template tag to display the recently added media attachments for given author.

Parameters

TypeNameDescriptionOptionalDefault
int$author_idno
boolean$sidebarDisplay as sidebar or inline.yestrue
int$limityes10
boolean$link_without_parentyesfalse
string$headeryes“<h3>Recent Media</h3>”(translated)
boolean$exclude_unattachedyestrue

author_media_and_posts( $author_id, $include_posts, $limit, $exclude_unattached )

Template tag to return the recently added media attachments and posts for a given author.

Parameters

TypeNameDescriptionOptionalDefault
int$author_idno
boolean$include_postsyestrue
int$limityes0
boolean$exclude_unattachedyestrue

author_media( $author_id, $limit, $exclude_unattached )

Template tag to return the recently added media attachments for a given author.

Parameters

TypeNameDescriptionOptionalDefault
int$author_idno
int$limityes0
boolean$exclude_unattachedyestrue

Deprecated Functions

These template tags and helper functions are retained only for compatibility with previous versions of Media Credit. Do not use them for new projects. They may be removed in future versions.

get_wpuser_media_credit( $post )

Deprecated. Retrieve the default media credit for a given post/attachment (i.e. the post author).

Parameters

TypeNameDescriptionOptionalDefault
int or object$postPost ID or object of attachmentyesThe global $post object

Return Value

Return: string The post author display name.

TypeDescription
stringThe post author display name

get_freeform_media_credit( $post )

Deprecated. Retrieve the freeform media credit for a given post/attachment.

Parameters

TypeNameDescriptionOptionalDefault
int or object$postPost ID or object of attachmentyesThe global $post object

Return Value

TypeDescription
stringThe freeform credit (or the empty string)
|