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?
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
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?
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
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 ...
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
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 ...
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 ...
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 ...
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 ...
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....
0
votes
1answer
360 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.
0
votes
1answer
506 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 ...
0
votes
1answer
699 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
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=...
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
453 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 ...
1
vote
1answer
146 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 ...
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
94 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.
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 ...
0
votes
1answer
338 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 ...
0
votes
1answer
472 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 ...
0
votes
1answer
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', '...
1
vote
1answer
128 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
6
votes
0answers
356 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....
1
vote
1answer
1k 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 ...
0
votes
1answer
348 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 ...
0
votes
1answer
222 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 ...
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
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
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
2k views

echo image caption

I am attempting to echo out my image captions in a Bootstrap Carousel. I have managed to get my images to display but unable to display my captions. I have attempted to use wp_get_attachment_metadata ...
1
vote
1answer
914 views

XML-RPC: How to add media caption to uploaded image?

I need to migrate non-WP data from an SQL database to posts in WP, and thought that using XML-RPC in a closed environment before deploying was a smart solution. This is my first WP project, so I'm ...
0
votes
1answer
258 views

Move captions under gallery images in twenty fourteen theme

The new twenty fourteen theme will only show captions on top of gallery thumbs. Is there something I can do in the functions (or copy from twenty ten) to make them visible all the time and show up ...
1
vote
1answer
2k views

How do I remove featured images and captions from a wordpress RSS feed?

I'm trying to remove featured images and captions from my feed and struggling to do it. As another question has identified it is very difficult to format captions and so as a newsletter feed I want to ...
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. ...
1
vote
1answer
1k views

How to add 'data-caption' inside an anchor tag

bellow is custom gallery code. function custom_gallery_shortcode( $attr = array(), $content = '' ) { $attr['itemtag'] = "li"; $attr['icontag'] = ""; $attr['...