Tem­plate Tags

Please use on­ly these Me­dia Cred­it tem­plate tags in your themes. Pre­vi­ous ver­sions of the Me­dia Cred­it plu­g­in have not dis­tin­guished be­tween the pub­lic API and pri­vate helper func­tions, but from ver­sion 3.0 for­ward, on­ly the func­tions doc­u­ment­ed here will be available.

get_​media_​credit( $post )

Tem­plate tag to re­turn the me­dia cred­it as plain text for some me­dia attachment.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int or object $post Post ID or ob­ject of attachment yes The glob­al $post object

the_​media_​credit( $post )

Tem­plate tag to print the me­dia cred­it as plain text for some me­dia attachment.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int or object $post Post ID or ob­ject of attachment yes The glob­al $post object

get_​media_​credit_​url( $post )

Tem­plate tag to re­turn the me­dia cred­it URL as plain text for some me­dia attachment.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int or object $post Post ID or ob­ject of attachment yes The glob­al $post object

the_​media_​credit_​url( $post )

Tem­plate tag to print the me­dia cred­it URL as plain text for some me­dia attachment.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int or object $post Post ID or ob­ject of attachment yes The glob­al $post object

get_​media_​credit_​html( $post, $include_​default_​credit )

Tem­plate tag to re­turn the me­dia cred­it as HTML with a link to the au­thor page if one ex­ists for some me­dia attachment.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int or object $post Post ID or ob­ject of attachment yes The glob­al $post object
boolean $include_​default_​credit Flag to de­cide if de­fault cred­its (own­er) should be re­turned as well yes true

the_​media_​credit_​html( $post )

Tem­plate tag to print the me­dia cred­it as HTML with a link to the au­thor page if one ex­ists for some me­dia attachment.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int or object $post Post ID or ob­ject of attachment yes The glob­al $post object

get_​media_​credit_​html_​by_​user_​ID( $id )

Tem­plate tag to re­turn the me­dia cred­it as HTML with a link to the au­thor page if one ex­ists for a Word­Press user.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int $id The user ID of a Word­Press user no

the_​media_​credit_​html_​by_​user_​ID( $id )

Tem­plate tag to print the me­dia cred­it as HTML with a link to the au­thor page if one ex­ists for a Word­Press user.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int $id The user ID of a Word­Press user no

display_​author_​media( $author_​id, $side­bar, $lim­it, $link_​without_​parent , $head­er, $exclude_​unattached )

Tem­plate tag to dis­play the re­cent­ly added me­dia at­tach­ments for giv­en author.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int $author_​id no
boolean $side­bar Dis­play as side­bar or inline. yes true
int $lim­it yes 10
boolean $link_​without_​parent yes false
string $head­er yes “<h3>Recent Media</h3>”(translated)
boolean $exclude_​unattached yes true

author_​media_​and_​posts( $author_​id, $include_​posts, $lim­it, $exclude_​unattached )

Tem­plate tag to re­turn the re­cent­ly added me­dia at­tach­ments and posts for a giv­en author.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int $author_​id no
boolean $include_​posts yes true
int $lim­it yes 0
boolean $exclude_​unattached yes true

author_​media( $author_​id, $lim­it, $exclude_​unattached )

Tem­plate tag to re­turn the re­cent­ly added me­dia at­tach­ments for a giv­en author.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int $author_​id no
int $lim­it yes 0
boolean $exclude_​unattached yes true

Dep­re­cat­ed Functions

These tem­plate tags and helper func­tions are re­tained on­ly for com­pat­i­bil­i­ty with pre­vi­ous ver­sions of Me­dia Cred­it. Do not use them for new projects. They may be re­moved in fu­ture versions.

get_​wpuser_​media_​credit( $post )

Dep­re­cat­ed. Re­trieve the de­fault me­dia cred­it for a giv­en post/​attachment (i.e. the post author).

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int or object $post Post ID or ob­ject of attachment yes The glob­al $post object

Re­turn Value

Re­turn: string The post au­thor dis­play name.

Type De­scrip­tion
string The post au­thor dis­play name

get_​freeform_​media_​credit( $post )

Dep­re­cat­ed. Re­trieve the freeform me­dia cred­it for a giv­en post/​attachment.

Pa­ra­me­ters

Type Name De­scrip­tion Op­tion­al De­fault
int or object $post Post ID or ob­ject of attachment yes The glob­al $post object

Re­turn Value

Type De­scrip­tion
string The freeform cred­it (or the emp­ty string)