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
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int or object | $post | Post ID or object of attachment | yes | The global $post object |
the_media_credit( $post )
Template tag to print the media credit as plain text for some media attachment.
Parameters
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int or object | $post | Post ID or object of attachment | yes | The global $post object |
get_media_credit_url( $post )
Template tag to return the media credit URL as plain text for some media attachment.
Parameters
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int or object | $post | Post ID or object of attachment | yes | The global $post object |
the_media_credit_url( $post )
Template tag to print the media credit URL as plain text for some media attachment.
Parameters
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int or object | $post | Post ID or object of attachment | yes | The 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
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int or object | $post | Post ID or object of attachment | yes | The global $post object |
boolean | $include_default_credit | Flag to decide if default credits (owner) should be returned as well | yes | true |
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
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int or object | $post | Post ID or object of attachment | yes | The 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
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int | $id | The user ID of a WordPress user | no |
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
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int | $id | The user ID of a WordPress user | no |
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
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int | $author_id | no | ||
boolean | $sidebar | Display as sidebar or inline. | yes | true |
int | $limit | yes | 10 | |
boolean | $link_without_parent | yes | false | |
string | $header | yes | “<h3>Recent Media</h3>”(translated) | |
boolean | $exclude_unattached | yes | true |
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
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int | $author_id | no | ||
boolean | $include_posts | yes | true | |
int | $limit | yes | 0 | |
boolean | $exclude_unattached | yes | true |
author_media( $author_id, $limit, $exclude_unattached )
Template tag to return the recently added media attachments for a given author.
Parameters
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int | $author_id | no | ||
int | $limit | yes | 0 | |
boolean | $exclude_unattached | yes | true |
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
Type | Name | Description | Optional | Default |
int or object | $post | Post ID or object of attachment | yes | The global $post object |
Return Value
Return: string The post author display name.
Type | Description |
---|---|
string | The post author display name |
get_freeform_media_credit( $post )
Deprecated. Retrieve the freeform media credit for a given post/attachment.
Parameters
Type | Name | Description | Optional | Default |
---|---|---|---|---|
int or object | $post | Post ID or object of attachment | yes | The global $post object |
Return Value
Type | Description |
---|---|
string | The freeform credit (or the empty string) |