Articles of captions

Get post embedded image caption

I am trying to get the caption of post embedded images to then use on a lightbox. This is my code: function my_theme_prefix_content_gallery( $content ) { global $post; $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’=>’image’, ‘numberposts’ => 1, ‘post_status’ => null, ‘post_parent’ => $post->ID, ); $attachments = get_posts( $args ); if ( $attachments ) { […]

caption shortcode using image alt as caption

The img alt attribute is dsplaying as caption and laos the caption is displaying, I do not want to display the img alt attribute as caption , how can I remove it. my code <p> </p>

Custom field as featured image caption

The problem is: My featured image caption is not being shown since it is (still) stored in a custom field (called (wpcf-bildunterschrift). I can easily access the customfield, but not the field that WordPress stores its meta data for images in and since the meta data for the image isn’t stored with the image I […]

How to add a caption to an image attachment in a file list?

I’ve tried various things and can’t get the captions to show up in my gallery. I’m using CMB2’s file list to output image attachments. I hope this question is pertinent enough to this forum as I think I’m just missing some simple php or wordpress function. Currently, it does output the image and the empty […]

Shortcode function doesnt work without caption

I’m working on a site that has this function to output the caption of a picture and is credits/date but doesn’t work if only credits/date are definied and caption isnt. If thats the case the function will ignore the image and it wil be wrapped in a p tag which i think its generated by […]

add_filter img_caption_shortcode not implemented

In a plugin I am creating, I need to change the output of the is still in the output; instead of “new caption” is expected to be in the output. I have verified that the caption code is enabled with this code: if ( shortcode_exists(“caption”)) { die(“found caption shortcode”); } And the generated page dies […]

Displaying caption with featured image

I’d like to display captions with my featured images. This is another feature that should be available by default but for some reason is not. There are a few routines out there that claim to accomplish the task, but they come up blank for me. Is there any reliable way to display a caption with […]

Displaying an image's alt title and caption inside a fancybox window. Working, but showing the same alt and caption for each image

I’ve been at this for hours so maybe someone here can help 🙂 Basically I have a fancybox gallery that loads images attached to a post. As you can see below, I want to echo either the image’s caption or alt title into the fancybox window. Currently it works, but it only shows the alt […]

How to dynamically insert <a href> in the image caption?

So, below is the WordPress default generated code for a gallery item: <div id=’gallery-1′ class=’gallery galleryid-203 gallery-columns-3 gallery-size-thumbnail’> <dl class=’gallery-item’> <dt class=’gallery-icon landscape’> <a href=’image url’><img width=”150″ height=”120″ src=”thumbnail image” class=”attachment-thumbnail”/></a> </dt> <dd class=’wp-caption-text gallery-caption’>Caption Text</dd> </dl> </div> What I need, is to surround the caption text with the image url, so when the user […]

Remove inline width from figure

I add an image with caption to my page and need to increase <figure> width. But wordpress is adding an inline width. So, the DOM look like this: <figure id=”attachment_43″ aria-labelledby=”figcaption_attachment_43″ class=”wp-caption alignnone” style=”width: 216px”> <a href=””> <img src=”http://localhost/bordados/website/wp-content/uploads/2014/02/homeThumb01.jpg” alt=”Caption” width=”216″ height=”95″ class=”size-full wp-image-43″> </a> <figcaption id=”figcaption_attachment_43″ class=”wp-caption-text”>Caption.</figcaption> </figure> I try to remove width=”216″ from […]