WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Add Custom Fields to Media

Allows users to add custom fields to the media uploader and access those fields in template files. Great for adding copyrights etc. This plugin is ma

How do I see the results?

Includes the following functions to help improve your website:

  • thisismyurl_get_custom_media_field( $attachment_id, $unique_field_id ) - Fetches the value
  • thisismyurl_has_custom_media_field( $attachment_id, $unique_field_id ) - Returns boolean value
  • thisismyurl_custom_media_field( $attachment_id, $unique_field_id ) - Displays the value

How do I add a photo credit to a featured image?

Here's my code snippet for adding a photo credit directly under a featured image.

if ( thisismyurl_has_custom_media_field() ) {

    $credit_name = thisismyurl_get_custom_media_field( get_post_thumbnail_id( $post->ID ), 'credit_name' );
    $credit_url = thisismyurl_get_custom_media_field( get_post_thumbnail_id( $post->ID ), 'credit_url' );

    if ( empty( $credit_name ) )
        $credit_name = $credit_url;

    if ( !empty( $credit_url ) )
        $credit_text = '<a href="' . $credit_url . '" title="' . $credit_name . '">' . $credit_name . '</a>';
    else
        $credit_text = $credit_name;

    $credit_text =  '<div class="media-credit">' . $credit_text . '</div>';

    echo $credit_text;
}

Note that I named my Unique ID's credit_name and credit_url in this example, and am fetching the them based on the ID returned for the Post feature image using get_post_thumbnail_id( $post->ID ).

Why does this plugin have thisismyurl_ before the function name?

Each plugin added to WordPress has the potential to conflict with the core, theme, or other plugins. To ensure this plugin adds only unique code to your website, the prefix thisismyurl_ is added to each function. thisismyurl is my personal domain, as well as my @thisismyurl alias on Twitter. If you'd like to ask me questions about the plugin, please feel free to Tweet me.

Where can I get more information, or technical support for this plugin?

Technical support is available for free from the WordPress community on wordpress.org.

Requires: 3.2.0 or higher
Compatible up to: 3.5.2
Last Updated: 2013-6-21
Downloads: 2,036

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1