Caption shortcodes not including caption as attribute

Find the line /* Remove in-line styling in function.php. Comment out: /* add_shortcode(‘wp_caption’, ‘fixed_img_caption_shortcode’); add_shortcode(‘caption’, ‘fixed_img_caption_shortcode’); function fixed_img_caption_shortcode($attr, $content = null) { // Allow plugins/themes to override the default caption template. $output = apply_filters(‘img_caption_shortcode’, ”, $attr, $content); if ( $output != ” ) return $output; extract(shortcode_atts(array( ‘id’=> ”, ‘align’ => ‘alignnone’, ‘width’ => ”, ‘caption’ … Read more

PHP code to call image Caption, Alternative Text, and Decription?

WordPress stores image (attachment) data as follows: Description: post_content field Caption: post_excerpt field Alt: _wp_attachment_image_alt meta value And in code, that translates to: // Description echo $post->post_content; // Raw the_content(); // Caption (description as fallback) the_excerpt(); // Caption (explicitly) echo $post->post_excerpt; // Raw if ( has_excerpt() ) { the_excerpt(); } // Alt echo get_post_meta( $post->ID, … Read more

Automatically add image caption with values from a post parent field?

In the filter, you will need to find the post parent of $post, get the value of the custom field of parent post and then add that value to $post[‘post_excerpt’] (where the caption is stored): add_filter(‘attachment_fields_to_save’, ‘wpse_insert_custom_caption’, 10, 2); function insert_custom_default_caption($post, $attachment) { //Check if the $post is attached to a parent post if( $post->post_parent … Read more

Add attribute to caption shortcode from custom attachment field

Here’s a solution that leverages the shortcode_atts_{shortcode} filter, where caption is the shortcode in this case. This works by pulling the attachment id from $out[‘id’] then getting the value of the class via get_post_meta( $attachment_id, ‘img_class_field’, true ). With this approach, it is not necessary to modify the output of the caption shortcode in the … Read more

HTML tags in WordPress image caption

I’m glad that better support should be added in version 3.4 but for now I’ve fixed the issue by changing the behaviour of image insertion so that it doesn’t use the shortcode. Here’s what I added to functions.php: add_filter( ‘disable_captions’, create_function(‘$a’, ‘return true;’) ); function image_send_to_editor_2($html, $id, $caption, $title, $align, $url, $size, $alt) { if … Read more

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

That caption shortcode is built into WordPress. It should generate the same markup for any theme, unless the theme or a plugin has unregistered it and registered a replacement. I don’t know if that is the case with your theme or with TwentyEleven. Look for ‘img_caption_shortcode’ in your theme files, probably functions.php. If your theme … Read more

Include captions

st Note: // Prepare the code for safety $images = $wpdb->get_col( $wpdb->prepare( ” SELECT ID FROM %s WHERE post_type=”attachment” AND ID IN ( %s ) ORDER BY menu_order ASC “, $wpdb->posts, $meta ) ); nd Note: Look into what you already got: // Inside the foreach loop echo ‘<pre>’; var_dump( $att ); echo ‘<pre>’; rd … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)