Articles of captions

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( ‘label’ => __( ‘Image class’, ‘text-domain’ ), ‘input’ => ‘text’, ‘value’ => get_post_meta( $post->ID, ‘img_class_field’, true ) ); return $form_fields; } add_filter( ‘attachment_fields_to_edit’, ‘add_img_class’, 10, 2 ); function […]

HTML tags in WordPress image caption

I’m developing a client website with WordPress (3.3) but have found that the image caption feature strips out any HTML tags. The resulting caption is plain text which makes proper image crediting difficult. Also being a client website, WYSIWYG editing is required. For example if my shortcode is: The tags are stripped from the caption […]

How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)

I’ve created my own theme based on a very lean template. My theme is not parsing the markup to the correct html. It’s just showing the text without any markup around it. Here are the relevant observations for my situation: When editing the post it shows in “Text” mode, and a nice image with caption […]

Multi-line captions on attachments

How can I change the ‘Caption’ text input to text area, to allow for multi line captions on media uploads?

Is there a way to define a default caption to all uploaded images

As the title of this answer say, I want to define a default caption to all uploaded images in my WordPress… Is there a way to do something like this?

Include captions

I’m using the Meta Box plugin, everything works fine. I’m using it to create gallery function on some custom post type, and I’m able to display the uploaded images using this code: global $wpdb; $meta = get_post_meta( get_the_ID(), ‘meta_key’, false ); if ( ! is_array( $meta ) ) $meta = ( array ) $meta; if […]

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 want get anyone and display. <?php $gallery = get_post_gallery_images( $post ); foreach( $gallery as $image_url ) : ?> <div class=”item” style=”background-image: url(‘<?php […]

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 occurences of the same image in other galleries as well. Pretty much the same question was asked here : How to […]

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=”attachment_xyz” class=”wp-caption alignleft my_new_class”… Adding, in this case, my_new_class. Thanks, Scott

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 the addition of the caption it adds a div wrapper with an inline style width of […]