Questions tagged [captions]

In WordPress images are special types of posts. The caption of an image is stored as the excerpt of that post.

Filter by
Sorted by
Tagged with
0 votes
1 answer
18 views

Place image caption outside of figure tag (Gutenburg Image Markup)

I format my single.php images to a perceived 3:2 ratio like this: <figure style="position:relative; width:100%; padding-bottom:66%;"> <img style="position:absolute; width:100%; ...
user avatar
0 votes
0 answers
10 views

How to join Caption AND Description Meta Fields as one combined-caption in Image Block

Use case: Inserting Image Block (inapplicable for others, like Gallery Block). I'd like to use caption (post_excerpt) as real description of an image (what it shows), and also append additional info, ...
user avatar
0 votes
0 answers
47 views

Not able to remove caption shortcode from the content

[caption id="attachment_6" align="alignright" width="300"]...Some Text...[/caption] I am unable to remove caption shortcode from the content of the post. I have tried ...
user avatar
0 votes
0 answers
87 views

How to modify image caption in posts?

I am trying to modify the caption of images in posts by filtering img_caption_shortcode, and then displaying the content using the_content(). I want to add bylines/credit on images, so I have created ...
user avatar
  • 111
0 votes
1 answer
143 views

how automatically show the image title before the image caption/description in a wordpress gallery?

I am using a simple Wp 5.x gallery like this [gallery size="full" columns="1" ids="6304,6305,6306,6307,6308,6309"] The gallery shows me the images and the captions/...
user avatar
0 votes
1 answer
158 views

How to Display Image Caption but Not Alt Text

I'm trying to display images with their caption, but when I do it displays both the caption and that alt text. I've tried to use unset( $fields['image_alt'] ); to hide the alt text, but it does ...
user avatar
  • 1
1 vote
1 answer
197 views

Add post-thumbnail after first paragraph including the caption

The function below is used to show the post thumbnail after the first paragraph. add_filter( 'the_content', 'insert_featured_image', 20 ); function insert_featured_image( $content ) { global $post;...
user avatar
  • 15
0 votes
1 answer
272 views

Omit image captions from get_the_content()

I use a theme that calls get_the_content() to display short excerpts of the latest blog posts on the home page. Now I noticed that the excerpt sometimes starts with an image caption, if the blog post ...
user avatar
0 votes
0 answers
92 views

How to auto add image caption from image alt?

How to automatically copy image alt to caption/description in WordPress?
user avatar
1 vote
0 answers
68 views

Move Image Captions Inside Link (<a> tag) if Added

I'm just looking for a relatively simple way to modify the default output when a standard post image with a caption is linked somewhere (generally to another page), so that the caption is included in ...
user avatar
  • 105
1 vote
1 answer
499 views

Can I nest a <figcaption> element within <a> tags from default wordpress?

I am making a page with Gutenberg but there is a problem that the link does not work within a . This is the code when I inspect: <figure> <a href="..."> <img> </a> <...
user avatar
1 vote
0 answers
123 views

How to add custom classes to figure element only if image has caption?

I want to add the 'wp-caption' class to the figure element only if the image has caption. How do I do that? I'm using the new gutenberg enviroment, if that affects anything. for example: form this: ...
user avatar
0 votes
1 answer
26 views

Unknow shortcode read on display site

I put the caption on a picture like this, the blog looks good, but in the compact view, I receive this problem I guess the editor can not read the HTML tag, Is anyone know what happened?
user avatar
  • 3
1 vote
0 answers
679 views

modify wordpress caption shortcode

I need to modify the Caption shortcode so that it renders the caption wrapper regardless if there is any caption text present. I've modified my Media content type with a custom field called Credit. ...
user avatar
  • 315
0 votes
2 answers
67 views

Is there a way to create referable automatic numbering in image captions?

I'm setting up a wordpress site for someone who is going to be continually editing and expanding the pages. Right now we have sometimes up to 50 images per page all manually labeled "figure x.x". He ...
user avatar
0 votes
1 answer
292 views

add_filter img_caption_shortcode not implemented

In a plugin I am creating, I need to change the output of the [caption]. I do this with (as from the Codex and other examples here) add_filter('img_caption_shortcode', 'caption_fix', 10, 3); ...
user avatar
2 votes
2 answers
855 views

Different captions for the same image in multiple galleries. Edit Image in Gallery locally

I would like to show different captions for the same image, used in multiple galleries. Apparently it is not possible to save the caption of an image without changing that caption in all other ...
user avatar
  • 71
2 votes
1 answer
3k views

wp_get_attachment_caption to pull Image Caption or alt

$output .= ' <img class="class1" src="'.$atts['to'].'" alt="The First Caption" width="100%" height="auto" >'; Instead of first caption, I ...
user avatar
1 vote
2 answers
813 views

Add attribute to caption shortcode from custom attachment field

I want to add class to caption shortcode, pulled from custom attachment field. I add the field via: function add_img_class( $form_fields, $post ) { $form_fields['img_class_field'] = array( ...
user avatar
  • 969
0 votes
1 answer
155 views

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 ...
user avatar
0 votes
0 answers
74 views

Adjust image caption within visal editor

once again I would like to ask you for your kind help. Basically I want to adjust the image caption below single post images. Instead of displaying the caption (post_excerpt), I would like to ...
user avatar
2 votes
1 answer
43 views

Adding a video description in a similar way to a image caption

I'm looking for a solution to add a short description to a embed video that will allow for it to be styled a bit like the one that is used for images. The only option I have found is using ...
user avatar
  • 59
3 votes
2 answers
22k views

How I can get image description/title/alt for gallery image?

I'm displaying a gallery image but I also want display the caption for image. I can get the info that we insert when us upload a image in WordPress Dashboard like "Title/Caption/ALT/Description". I ...
user avatar
  • 165
4 votes
4 answers
4k views

How to remove a empty <p></p> in wp caption shortcode?

I recently added a caption to my image in WordPress and now there is an empty <p></p> tag after <img> tag. It broke my style. Can anyone tell how to remove it? Thanks for the help.
user avatar
  • 51
0 votes
1 answer
559 views

How to hide / remove attachment "alt" or "caption" field in Admin?

Until WP 3.6 it was possible to remove the "alt" field (and also the "caption" field) before showing a post of type "attachment" through attachment_fields_to_edit hook. As you can see also here (user ...
user avatar
0 votes
1 answer
163 views

Image caption not rendering on some images - Shapely theme

I'm using Shapely theme v1.0.5 on top of Wordpress v4.7.1. I'm writing an article and everything was fine, until I noticed two images didn't have their captions rendered, while the others rendered ...
user avatar
0 votes
1 answer
56 views

Problem to return more than single line captions

I'm developing a gallery plugin that shows featured image as album cover. But I need to show some text info in this album cover. So I got the image title to be the name, its working ok. But for the ...
user avatar
0 votes
1 answer
131 views

Displaying “alt” attribute text as captions?

We are moving a large newspaper website from Drupal to WordPress and my last coding tweak involves displaying the legacy caption information from images in article posts. The caption information is ...
user avatar
  • 1
4 votes
2 answers
1k views

How to wrap Wordpress image captions inside H2, H3 tags?

I've searched Google and can find no mention of how to change Wordpress image captions to wrap the caption in a H2 or H3. How do we wrap image captions inside H2, H3 tags? Thanks.
user avatar
  • 1,662
0 votes
1 answer
1k views

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 ...
user avatar
0 votes
1 answer
1k views

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 ...
user avatar
  • 5
0 votes
1 answer
384 views

Add caption to thumbnails in content

Still trying to get the answer, i don't really know wordpress core (but i'm actually pretty good in PHP), I can't find how to add caption to my images in posts. I know we can use get_posts to any ...
user avatar
  • 111
0 votes
1 answer
1k views

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> [caption id=...
user avatar
0 votes
1 answer
459 views

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( ...
user avatar
1 vote
1 answer
669 views

Gallery IDS and Captions: hide/show on a per ID basis

I am aware of hiding captions in a gallery via css on figcaption, like .wp-caption-text/.gallery-caption for example. What I am looking for is a way to have custom control of hiding captions on ...
user avatar
1 vote
1 answer
167 views

Showing image description along with embedded links below post images

I have images in my Wordpress posts with the following field setup: Caption: This field contains the actual image caption to be displayed below the image. Description: This field contains photo ...
user avatar
0 votes
1 answer
9k views

How do I change the woocommerce product gallery to show all thumbnails instead of three at a time in a carousel?

I am building a site for a client and I can't seem to figure out how to remove the product gallery carousel setting. For the final result, I want to be able to see all the thumbnails at once and not ...
user avatar
  • 46
0 votes
1 answer
126 views

slider stripping out caption/excerpt line breaks

I ran into an issue where the slider I was using (Wonderplugin) was stripping out paragraph and other formatting tags on captions/descriptions, though they were working on the actual images in Posts.
user avatar
  • 167
6 votes
1 answer
17k views

Featured image shortcode

Each post currently requires the featured image to be duplicated within the post several times. Is there any way in which I could dynamically call the featured image back into the post rather than ...
user avatar
  • 61
0 votes
1 answer
508 views

Update caption for metabox gallery images

Just wondering how to make the caption on my metabox gallery images updatable. I have the caption on a textarea so it can be easily updated. I can change the contents of this textarea, cant seem to be ...
user avatar
0 votes
1 answer
598 views

How to show post format gallery metabox image caption in the post front end

After getting my images through a metabox for a gallery post format I have the following code to show them on the post front end: <?php if ( !empty( $images ) ) { foreach ( $images as ...
user avatar
0 votes
1 answer
1k views

Get image captions for images on gallery post format metabox

I have a post format gallery. I have created a metabox to add my images: function mytheme_show_post_gallery_metabox( $post ) { wp_nonce_field( 'mytheme_post_gallery_metabox', '...
user avatar
1 vote
1 answer
164 views

Replace image caption with its title and description

Is it possible to replace the caption text of an image with its title and description fields when inserting it in the editor? If so, how? Thanks in advance
user avatar
  • 1,607
6 votes
0 answers
431 views

Text editor on WP caption [closed]

I'm trying to add the visual editor to image captions in wordpress. I'm somewhat able to but there are a few issues. Here is a screenshot of what I currently have: a busy cat http://www.pba-online....
user avatar
  • 69
1 vote
1 answer
2k views

Add caption functionality to custom WordPress theme

Hi I am working from a custom theme created by my predecessor and I am trying to add caption functionality to the theme but I am have some trouble with it. Presently if I insert a image into a post ...
user avatar
  • 113
0 votes
1 answer
471 views

How to always add caption element to images - even if empty?

I want to add the caption ALWAYS to images, even if it is empty. This is my function to add the caption, but the caption element will not be generated when there is no content in it, how to add the ...
user avatar
0 votes
1 answer
229 views

Automatically Add Caption Shortcode to Image with Caption Field Filled In

I am hoping to be able to have the [caption] shortcode automatically get inserted into the post content area when you add in an image that has the caption field filled in. I believe this is supposed ...
user avatar
  • 239
7 votes
1 answer
1k views

How to have different captions for same image, for galleries?

Seems like I can't have the same image in different galleries with different captions. Is it possible to make that working in any way? Like if we could change the shortcut code that Wordpress is ...
user avatar
1 vote
1 answer
766 views

Forcing max-width for image captions

I've implemented a filter to my image captions based on this question I asked a few days ago. How can I slip into the caption the css style of max-width as well? I think it can be done with ...
user avatar
  • 155
0 votes
1 answer
760 views

Wordpress Caption Formatting

I'm trying to create a custom wordpress theme. Everything has gone fine, except image formatting in post content. Image captions are not displaying properly in newly created theme. I have already ...
user avatar
  • 111