Fre­quent­ly Asked Questions

I dis­abled the plu­g­in and now un­parsed [media-​credit] short­codes are ap­pear­ing 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' );
?>

Al­so, I’d re­al­ly ap­pre­ci­ate it if you gave us some feed­back as to why you dis­abled the plu­g­in and how it could have bet­ter suit­ed your needs.

Can I dis­play all or re­cent me­dia cred­it­ed to a giv­en author?

In­deed, just call the tem­plate tag <?php display_author_media($author_id); ?> in your theme’s author.php (or else­where, if you want). The tem­plate tag has op­tion­al pa­ra­me­ters if you want to cus­tomize the CSS or text. The de­fault op­tions will dis­play thumb­nails of the 10 most re­cent me­dia items cred­it­ed to the giv­en user float­ed to the right with a width of 150px and a head­er of <h3>Recent Media</h3>.

These op­tions can be changed with a more ver­bose call to the func­tion: <?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 on­ly the 10 most re­cent me­dia items that are at­tached to a post dis­play with the giv­en head­er tak­ing up the max­i­mum width it’s af­ford­ed. Each im­age will link to the post in which it ap­pears, or the at­tach­ment page if it has no par­ent post (un­less $link_without_parent is set to false). If you don’t care about whether the me­dia is at­tached to a post, change $exclude_unattached to false. This func­tion as a whole will on­ly dis­play me­dia up­loaded and cred­it­ed to a user af­ter this plu­g­in was installed.

More gen­er­al­ly, can I in­sert me­dia cred­it in­for­ma­tion in­to my themes with a tem­plate tag, for in­stance on cat­e­go­ry pages?

I’m so glad you asked; you cer­tain­ly can! Just call <?php get_media_credit_html($post); ?> with an attachment_id (int) or post ob­ject for an at­tach­ment to get the me­dia cred­it, in­clud­ing a link to the au­thor page. To echo the re­sults, call <?php the_media_credit_html($post); ?>.

Is there a tem­plate tag that just gives plain text rather than a link to the au­thor page for users of my blog?
Can I link to an artist in­side a me­dia cred­it field?
Why do I get un­parsed [media-​credit] short­codes in my Facebook/​Twitter/​… pre­views with Jet­Pack Publicize?

Un­for­tu­nate­ly, this is a known bug in Jet­Pack that can on­ly be fixed by Au­tomat­tic. As a workaround, use a dif­fer­ent plu­g­in for post­ing to so­cial net­works. Al­ter­na­tive­ly, if you make sure that you haven’t got any im­ages with cred­its with­in the first 55 words of your ar­ti­cle, you should be fine, too.

Your ques­tion was not an­swered in the FAQ?

Feel free to get in touch with us about any­thing you’d like us to add to this list by leav­ing a mes­sage in the Word​Press​.org sup­port fo­rums.