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
0answers
6 views

Force user to input image caption when uploading an image

How can I force the user to input an image caption when uploading a picture via the Add Media button in the document edit view? See picture. It should not be possible to upload an image without a ...
0
votes
0answers
12 views

How to auto add image caption from image alt?

How to automatically copy image alt to caption/description in WordPress?
0
votes
1answer
454 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 ...
0
votes
1answer
570 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 ...
1
vote
1answer
584 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 ...
0
votes
1answer
866 views

Remove Captions from Custom Gallery function.php

I like to prevent captions from being outputted in my custom gallery function. I could easily just hide it using CSS but it doesn't feel right. The caption is being sent from media.php this line. ...
0
votes
1answer
900 views

Dynamically adding Captions to images

I have a site where the author has included Amazon Affiliate links. They've done this by adding the URL to product images. I'm wondering if there's a way to add a function that will automatically add ...
7
votes
1answer
882 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 ...
1
vote
0answers
23 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 ...
0
votes
0answers
20 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> <...
1
vote
0answers
19 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: ...
0
votes
0answers
15 views

Disabling/Remove Caption Field for uploads in admin

Can someone please assist me. I've been trying to disable/hide the caption field for uploads in admin. Using the functions file in the child theme so that it doesn't get overwritten when WordPress ...
0
votes
3answers
451 views

How to edit caption for images and exclude it from excerption query?

I have 2 questions for caption for images: - how to edti them with bold, italics and so on? I do it, but it doesn't work. - if the image is first, how to exclude caption from excerpt in query ...
1
vote
0answers
145 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. ...
0
votes
1answer
25 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?
10
votes
3answers
11k views

make Wordpress image captions responsive

This webpage contains images inserted by Wordpress. The code used to insert the first image is: [caption id="attachment_887" align="alignnone" width="604"] <a href="http://steven.doig.com.au/...
0
votes
2answers
23 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 ...
1
vote
3answers
1k views

Removing height and width from images with a caption

I am using WordPress with Twitter Bootstrap 3 and have an issue when it comes to images with captions. Images with captions are given a height and width attribute which stops them from being ...
9
votes
1answer
23k views

Get Image Description

I'm trying to make a post split in 2 columns. The first and left one is going to be any image inside the post, and the second and right one will be the_content() (excluding the images). So as of now ...
2
votes
2answers
3k views

Add extra class to wp-caption?

How do you add a new class to the HTML generated when an image with captions is added? For example, from this: <div id="attachment_xyz" class="wp-caption alignleft"... to this: <div id="...
3
votes
4answers
2k 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....
6
votes
1answer
8k 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 ...
1
vote
2answers
6k views

Turn off image captions in gallery view?

I've set up my loop-attachment.php to show the gallery of thumbnails above the main, selected image using this code from the WordPress Codex: <?php $gallery_shortcode = '[gallery id="' . ...
1
vote
1answer
217 views

Way to add captions to gallery images by code

I am creating posts by using wp_insert_post function. It works fine as I provide values in array required. Sometimes it is required to create a post having gallery. Without any problem, it also works ...
2
votes
2answers
467 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 ...
0
votes
1answer
145 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); ...
2
votes
1answer
1k 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 ...
0
votes
1answer
366 views

WP Gallery showing captions twice

I am using standard WP gallery to display images. I have added caption to every image, image title was not changed so it is same like file name. When I open one image in gallery it shows caption text ...
1
vote
2answers
552 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( ...
0
votes
1answer
114 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 ...
0
votes
0answers
64 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 ...
2
votes
1answer
37 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 ...
1
vote
3answers
3k views

Caption shortcodes not including caption as attribute

I recently installed the bonpress theme and am having trouble with the captions showing correctly. The more I try to understand how captions are supposed to work in Wordpress, the more I suspect ...
2
votes
2answers
13k 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 ...
0
votes
1answer
361 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 ...
0
votes
1answer
103 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 ...
0
votes
1answer
36 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 ...
0
votes
1answer
72 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 ...
4
votes
2answers
574 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.
1
vote
2answers
2k views

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. [caption id="attachment_44" align="alignnone" width="216"]<a href="image ...
1
vote
2answers
1k views

Getting Featured Image Caption to Only Show if Populated

I'm trying to hide the featured image caption from showing. Currently, it'll show build the div (but not populate it because it's empty). What I'd like to do, ideally, is only show the div if someone ...
0
votes
1answer
7k 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 ...
0
votes
1answer
507 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 ...
2
votes
4answers
1k views

Caption in Page adding unwanted 10px to width

I'm trying to create an image with a caption in a Page I'm working with. In the image options, I have it aligned right, with an image width of 220. Without the caption I have no problems, however with ...
8
votes
1answer
95 views

Multi user site and image captions

On multi user sites when authors select images from the media library they can choose images that other authors have uploaded. The problem is that they can edit the caption and it changes it for both ...
0
votes
1answer
700 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 ...
0
votes
1answer
197 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 ...
0
votes
1answer
230 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( ...
0
votes
1answer
790 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=...
3
votes
1answer
238 views

Drag images with caption in WP editor

Whenever I insert an image without a caption in the post, the editor makes it an object that I can select and move around / scale. Whenever I insert an image with a caption, it inserts fine. I can ...