How to join Caption AND Description Meta Fields as one combined-caption in Image Block
How to join Caption AND Description Meta Fields as one combined-caption in Image Block
How to join Caption AND Description Meta Fields as one combined-caption in Image Block
I control the aspect ratio/crop of my images with padding, like this. Though, new WP blocks styles clash with this method. Resulting in captions behind or on top of the image. By looping through each image block <figure class=”wp-block-image”> I was able to insert some markup of my choice, using this method Almost like the … Read more
As far as I know the only way to add styles to RSS feed items is by adding them inline (e.g. <p style=”color: #333; font-weight: bold;”>Hello World</p>). If you don’t specify any styling, then the reader app/website that the end-user is using applies its default styles. Certainly editing styles.css won’t make any difference, because that … Read more
From quick look caption seems to be stored as excerpt (rather than part of data in meta array), so you should use wp_update_post() to add it.
Can you try something along these lines and report back the result? <?php if(qtrans_getLanguage()==’en’): ?> // attachment if statement <?php else if(qtrans_getLanguage()==’fr’): ?> // attachment if statement <?php endif; ?> Technically you could omit the second else if statement and replace it just with <?php else : ?> assuming you only have two languages you … Read more
You’ll need to use the img_caption_shortcode filter to do this. Pretty certain the alignment of the image (floating left/right) is part of the caption so you’ll lose the ability to do that with this code. function imageOnly($deprecated, $attr, $content = null) { return do_shortcode( $content ); } add_filter( ‘img_caption_shortcode’, ‘imageOnly’, 10, 3 ); The do_shortcode … Read more
For your first question- HTML support for captions was a new feature in wordpress 3.4, if you have any version prior to that, it won’t work I’m not sure if i understood your 2nd question, but to exclude the caption from not displaying on the page, you’ll have to either delete the caption from the … Read more
First of all I don’t think that create a custom post type only for backgrounds is a right choose: backgrond are images and images already have their post type: attachment. If you have Worpress 3.5+ you can register a custom taxonomy for attachments, call it, e.g. ‘image_scope’ : register_taxonomy(‘image_scope’, ‘attachment’, $args ); for the $args … Read more
You need only a regex to catch the class from content, check if the class for you size is one of the assigned class and if so add to output, something like: function my_custom_img_caption_shortcode($a, $attr, $content = null) { extract( shortcode_atts( array( ‘id’ => ”, ‘align’ => ‘alignnone’, ‘width’ => ”, ‘caption’ => ” ), … Read more
Use the shortcode handler img_caption_shortcode to render the HTML for you, though you do need to pass it a width (which we can easily get with wp_get_attachement_image_src: function wpse_138126_thumbnail_caption( $html, $post_id, $post_thumbnail_id, $size, $attr ) { if ( $post = get_post( $post_thumbnail_id ) ) { if ( $size = wp_get_attachment_image_src( $post->ID, $size ) ) $width … Read more