WordPress.org

Ready to get started?Download WordPress

Forums

Media Uploader WP 2.5 - Caption and Description (5 posts)

  1. artbycas
    Member
    Posted 6 years ago #

    Can anyone tell me what the function of the Caption and Description boxes in the WordPress 2.5 Media Uploader are? Neither of them show up near an image in the default theme. (I've noticed however, that the image Title shows up on hover on a Mac using Firefox.)

    My assumption is that the description is for accessibility/if the image doesn't load, but shouldn't there be a way to add a conditional comment into my theme's template to call the caption if present?

    Does anyone know the line of code I'd need to add and where to add it? I'd know how to style it out if I also knew a way to add a Div or Class element to it as well.

    And yes, I've looked at plugins that add a caption to an image - that's not what I'm looking for, if I can just add a call to the information I put into the uploader box in the "caption" field.

  2. sinelanguage0628
    Member
    Posted 6 years ago #

    I'm having the same issue. Can someone shed some light please?

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    If you link an image to "post" instead of to the image file, the caption and description both show up on that resulting page.

  4. msbrauer
    Member
    Posted 6 years ago #

    I spent quite a bit of time trying to find out how to do this. Seems like a lot of people want this functionality, but it's hard to find anyone that's done it. What worked for me is to modify the code here.

    And use $attachment->post_content to get the description. The full block of code that worked for me on my archive.php is

    <?php
    
    $args = array(
    	'post_type' => 'attachment',
    	'numberposts' => null,
    	'post_status' => null,
    	'post_parent' => $post->ID
    	);
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ($attachments as $attachment) {
    		echo $attachment->post_content;
    
    	}
    }
    
    ?>

    Hope that helps

  5. Mediatricks
    Member
    Posted 6 years ago #

    You can use the caption and description information neatly in plugins like Viva Zoom http://www.mediatricks.biz/zoom that uses HS to pop out your image and show the extra info.

Topic Closed

This topic has been closed to new replies.

About this Topic