WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Media Credit

Adds a "Credit" field when uploading media to posts and displays it under the images on your blog to properly credit the artist.

I disabled the plugin and now unparsed [media-credit] shortcodes are appearing all over my site. Help!

Add this to your theme's functions.php file to get rid of those pesky media-credit shortcodes:

<?php
function ignore_media_credit_shortcode( $atts, $content = null ) {
    return $content;
}
global $shortcode_tags;
if ( !array_key_exists( 'media-credit', $shortcode_tags ) )
    add_shortcode('media-credit', 'ignore_media_credit_shortcode' );
?>

Also, I'd really appreciate it if you gave me some feedback as to why you disabled the plugin and how it could have better suited your needs.

Can I display all or recent media credited to a given author?

Indeed, just call the template tag <?php display_author_media($author_id); ?> in your theme's author.php (or elsewhere, if you want). The template tag has optional parameters if you want to customize the CSS or text. The default options will display thumbnails of the 10 most recent media items credited to the given user floated to the right with a width of 150px and a header of <h3>Recent Media</h3>.

These options can be changed with a more verbose call to the function: <?php display_author_media($author_id, $sidebar = true, $limit = 10, $link_without_parent = false, $header = "<h3>Recent Media</h3>", $exclude_unattached = true); ?>. This will make only the 10 most recent media items that are attached to a post display with the given header taking up the maximum width it's afforded. Each image will link to the post in which it appears, or the attachment page if it has no parent post (unless $link_without_parent is set to false). If you don't care about whether the media is attached to a post, change $exclude_unattached to false. This function as a whole will only display media uploaded and credited to a user after this plugin was installed.

More generally, can I insert media credit information into my themes with a template tag, for instance on category pages?

I'm so glad you asked; you certainly can! Just call <?php get_media_credit_html($post); ?> with an attachment_id (int) or post object for an attachment to get the media credit, including a link to the author page. To echo the results, call <?php the_media_credit_html($post); ?>.

Is there a template tag that just gives plain text rather than a link to the author page for users of my blog?

Yep! If you would prefer plain-text rather than a link for all media credit (and leaving out the separator and organization), call <?php get_media_credit($post); ?> which uses the same parameter as above. To echo the results, call <?php the_media_credit($post); ?>.

Can I link to an artist inside a media credit field?

You sure can. Just link to the artist's website in the name attribute in the media-credit shortcode, found in HTML view for a post, or directly when adding an image. For example, if your post contains:

[media-credit name="Artist" align="alignleft" width="300"]<img src="http://www.mysite.com/files/2010/09/image.jpg" width="300" height="450" class="size-300 wp-image-2" />[/media-credit]

change it to:

[media-credit name="<a href='http://www.artistwebsite.com/'>Artist</a>" align="alignleft" width="300"]<img src="http://www.mysite.com/files/2010/09/image.jpg" width="300" height="450" class="size-300 wp-image-2" />[/media-credit]

Note the link to http://www.artistwebsite.com above.

(Thanks to Mike Schuerlein for this excellent question!)

Feel free to get in touch with me about anything you'd like me to add to this list. E-mail me here.

Requires: 3.9 or higher
Compatible up to: 3.9
Last Updated: 2014-4-16
Downloads: 6,561

Ratings

4 stars
4 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1
100,1,1 0,2,0 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1
100,1,1 100,1,1
100,1,1
100,1,1
100,1,1 100,1,1
100,1,1
100,1,1
33,3,1
100,2,2
0,1,0
0,3,0
17,6,1
0,2,0
100,2,2
0,1,0
100,1,1