How to display featured image caption only if exists?

I am a “little late” but this solution worked great for me. It will show the div only if the caption is not empty. <?php $get_description = get_post(get_post_thumbnail_id())->post_excerpt; the_post_thumbnail(); if(!empty($get_description)){//If description is not empty show the div echo ‘<div class=”featured_caption”>’ . $get_description . ‘</div>’; } ?>

Seeking recommendations on Gallery plugins , specifically captioning thumbnails [closed]

Have you tried this for NextGen? – Excerpt (many other useful tips at the linked thread): ENABLING CAPTIONS BELOW GALLERY IMAGES When you add a gallery to a post/page, you get this by default: [nggallery id=1] You need to add this: [nggallery id=1 template=caption] GETTING THE CAPTIONS YOU JUST ENABLED TO SHOW-UP When importing …

Read more

Wrap a post image with a div if it doesn’t have a caption

You could try with if(is_admin()){ add_filter(‘image_send_to_editor’, ‘wrap_my_div’, 10, 8); function wrap_my_div($html, $id, $caption, $title, $align, $url, $size, $alt) { if( isset($caption) && $caption ) return $html; else return ‘<div class=”mydiv” id=”mydiv-‘.$id.'”>’.$html.'</div>’; } }

Move caption in on attachment page

In a theme image.php is the template that displays a single image attachment. There are many similar templates for other attachment types. The Codex has more information about attachment display templates. If you don’t have an image.php template you can quickly make one by making a copy of single.php and renaming it. Then you can …

Read more

How to add a credit line to a photo caption

I tried to do this once and almost got almost. Here’s what I did learn. Depending on your needs, this solution may be workable. You can append content to media when it’s inserted into the editor using the get_image_tag filter: /** * Filter to get caption and append image information to it. * * @return …

Read more

Dynamically adding Captions to images

The media uploader wraps the image and caption in the shortcode. There is a filter called img_caption_shortcode that can do what you want. The caption itself is passed as part of an array to the shortcode handler, as is the image id. add_filter( ‘img_caption_shortcode’, ‘wwm_img_caption_filter’, 10, 3 ); function wwm_img_caption_filter( $empty, $attr, $content ) { …

Read more

How to change images size after theme modification?

To change values inside the content can you search/replace in the database, but it is hard to update all values, if the values are different. For a search/replace can you use a plugin or helper. The helper is very good for all ToDos in Search/Replace context. The plugin is useful for search/replace in different tables.