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 avail­able.

get_​media_​credit( $post )

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

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int or ob­ject$postPost ID or ob­ject of at­tach­mentyesThe glob­al $post ob­ject

the_​media_​credit( $post )

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

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int or ob­ject$postPost ID or ob­ject of at­tach­mentyesThe glob­al $post ob­ject

get_​media_​credit_​url( $post )

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

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int or ob­ject$postPost ID or ob­ject of at­tach­mentyesThe glob­al $post ob­ject

the_​media_​credit_​url( $post )

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

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int or ob­ject$postPost ID or ob­ject of at­tach­mentyesThe glob­al $post ob­ject

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 at­tach­ment.

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int or ob­ject$postPost ID or ob­ject of at­tach­mentyesThe glob­al $post ob­ject
boolean$include_​default_​creditFlag to de­cide if de­fault cred­its (own­er) should be re­turned as wellyestrue

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 at­tach­ment.

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int or ob­ject$postPost ID or ob­ject of at­tach­mentyesThe glob­al $post ob­ject

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

TypeNameDe­scrip­tionOp­tion­alDe­fault
int$idThe user ID of a Word­Press userno

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

TypeNameDe­scrip­tionOp­tion­alDe­fault
int$idThe user ID of a Word­Press userno

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 au­thor.

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int$author_​idno
boolean$side­barDis­play as side­bar or in­line.yestrue
int$lim­ityes10
boolean$link_​without_​parentyesfalse
string$head­eryes“<h3>Recent Media</h3>”(translated)
boolean$exclude_​unattachedyestrue

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 au­thor.

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int$author_​idno
boolean$include_​postsyestrue
int$lim­ityes0
boolean$exclude_​unattachedyestrue

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 au­thor.

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int$author_​idno
int$lim­ityes0
boolean$exclude_​unattachedyestrue

Dep­re­cat­ed Func­tions

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 ver­sions.

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 au­thor).

Pa­ra­me­ters

TypeNameDe­scrip­tionOp­tion­alDe­fault
int or ob­ject$postPost ID or ob­ject of at­tach­mentyesThe glob­al $post ob­ject

Re­turn Val­ue

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

TypeDe­scrip­tion
stringThe 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

TypeNameDe­scrip­tionOp­tion­alDe­fault
int or ob­ject$postPost ID or ob­ject of at­tach­mentyesThe glob­al $post ob­ject

Re­turn Val­ue

TypeDe­scrip­tion
stringThe freeform cred­it (or the emp­ty string)
|