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
29 views

Customize all image captions

Is there anyway to add smth like a SVG to all image captions of my website? Smth like the camera logo under this photo.
Poorya Ghorbani's user avatar
0 votes
0 answers
20 views

Permission to edit media files (photo captions, alt tags)

What permission is required for a user to be able to edit all media files in Wordpress? I'm trying to edit the captions and alt tags of some media files in Wordpress. I can see the media file in the &...
Michael Altfield's user avatar
1 vote
1 answer
578 views

PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in Stack trace:\n#0 [internal function]: img_caption_shortcode()

Why am I getting this error in my apache logs? ==> tech.michaelaltfield.net/error.log <== [Wed Aug 23 00:00:09.968658 2023] [php:error] [pid 459909] [client 0.0.0.0:0] PHP Fatal error: Uncaught ...
Michael Altfield's user avatar
0 votes
1 answer
28 views

Adding caption to all images inside an article

My client has decided he wants to add inside the article body, for each image, the caption below the img tag. I know WordPress has this shortcode built in, but since there are more than 300 articles, ...
Andrei Zamfira's user avatar
0 votes
1 answer
180 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%; ...
Austin Allen's user avatar
0 votes
0 answers
164 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 ...
Anshu Jindal's user avatar
0 votes
0 answers
351 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 ...
Niklas's user avatar
  • 111
0 votes
1 answer
226 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/...
Waldemar's user avatar
0 votes
1 answer
359 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 ...
frinci's user avatar
  • 1
1 vote
1 answer
327 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;...
lefty's user avatar
  • 15
0 votes
1 answer
480 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 ...
user1438038's user avatar
0 votes
0 answers
147 views

How to auto add image caption from image alt?

How to automatically copy image alt to caption/description in WordPress?
Seryozha's user avatar
1 vote
0 answers
74 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 ...
Kenny J's user avatar
  • 105
1 vote
1 answer
586 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> <...
Linh Nguyen's user avatar
1 vote
0 answers
209 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: ...
Fabio Silva's user avatar
0 votes
1 answer
28 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?
baonhg's user avatar
  • 3
1 vote
0 answers
786 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. ...
Slam's user avatar
  • 343
0 votes
2 answers
117 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 ...
Devin Curtis's user avatar
0 votes
1 answer
344 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); ...
Rick Hellewell's user avatar
2 votes
2 answers
887 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 ...
Graveto's user avatar
  • 71
2 votes
1 answer
5k 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 ...
WordCent's user avatar
  • 1,827
1 vote
2 answers
922 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( ...
Runnick's user avatar
  • 1,169
0 votes
1 answer
160 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 ...
user117426's user avatar
0 votes
0 answers
76 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 ...
Hans Wernersen's user avatar
2 votes
1 answer
51 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 ...
Josh's user avatar
  • 59
4 votes
2 answers
23k 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 ...
Zkk's user avatar
  • 175
4 votes
4 answers
5k 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.
Bao's user avatar
  • 51
0 votes
1 answer
691 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 ...
AmintaCode's user avatar
0 votes
1 answer
230 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 ...
JefersonFG's user avatar
0 votes
1 answer
60 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 ...
Marcelo Srougi's user avatar
0 votes
1 answer
139 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 ...
Chuck's 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.
Steve's user avatar
  • 1,677
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 ...
vittorio's 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 ...
BradH's user avatar
  • 5
0 votes
1 answer
418 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 ...
Matt Loye's 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=...
Prafulla Kumar Sahu's user avatar
0 votes
1 answer
584 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( ...
Madeirense's user avatar
1 vote
1 answer
715 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 ...
Pleasure Princess's user avatar
1 vote
1 answer
175 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 ...
TheLearner's 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 ...
Jordan's user avatar
  • 46
0 votes
1 answer
153 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.
ERM's user avatar
  • 277
7 votes
1 answer
19k 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 ...
Allan's user avatar
  • 71
0 votes
1 answer
578 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 ...
Madeirense's user avatar
0 votes
1 answer
646 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 ...
Madeirense's 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', '...
Madeirense's user avatar
1 vote
1 answer
224 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
leemon's user avatar
  • 1,806
6 votes
0 answers
445 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....
Lhen's user avatar
  • 69
1 vote
1 answer
3k 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 ...
Sai's user avatar
  • 113
0 votes
1 answer
529 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 ...
herrfischer's user avatar
0 votes
1 answer
239 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 ...
Andrew's user avatar
  • 239