How to remove a empty in wp caption shortcode?
It is not a good practice to override the WordPress native functionality. Instead you can hide the empty elements using CSS p:empty { display: none; } This will the empty elements.
It is not a good practice to override the WordPress native functionality. Instead you can hide the empty elements using CSS p:empty { display: none; } This will the empty elements.
Text editor on WP caption [closed]
Yes, it stores the caption in it’s own place in the DB. I can’t quote the exact location but in WordPress, “Attachments” are a post type and it stores each attachment just like a post. For an attachment post type, it treats the Image Caption as the_excerpt the Image Description as the_content and the Image … Read more
Register the shortcode, ideally in a plugin or functions.php if you have to. add_shortcode(‘thumbnail’, ‘thumbnail_in_content’); function thumbnail_in_content($atts) { global $post; return get_the_post_thumbnail($post->ID); } Add the shortcode to you post content. [thumbnail] If you want more features, see this post or the pastebin. ADDING CAPTIONS AND LINKS add_shortcode(‘thumbnail’, ‘thumbnail_with_caption_shortcode’); function thumbnail_with_caption_shortcode($atts) { global $post; // Image … Read more
Say you have image foo.jpg and bar.jpg in your media library. foo.jpg has caption saying “foo”, and bar.jpg has caption saying “bar”. Create a gallery with those two images, they will show with “foo” and “bar” captions. Want to use them again with a different caption, but using a gallery? No problem. Make another gallery … Read more
I’ve tested this in WP 4.5 with the default author role and this issue doesn’t seem to exist anymore. My findings: 1 As an author you cannot edit media properties directly. 2 As an author you can edit media properties when you are inserting an image in a post. This will cause the image to … Read more
You’re going to want to use: @media (max-width: 988px){ .wp-caption { /* Force the box to be 100% */ width: 100% !important; } #content .wp-caption a img { /* Scale down if too big */ max-width: 99.03225806%; /* 614/620 */ height: auto; } }
function wp_get_attachment( $attachment_id ) { $attachment = get_post( $attachment_id ); return array( ‘alt’ => get_post_meta( $attachment->ID, ‘_wp_attachment_image_alt’, true ), ‘caption’ => $attachment->post_excerpt, ‘description’ => $attachment->post_content, ‘href’ => get_permalink( $attachment->ID ), ‘src’ => $attachment->guid, ‘title’ => $attachment->post_title ); } Source As sporkme explains later in the thread, this is dumped into your functions.php and can then … Read more