Guest User

Untitled

a guest
Dec 17th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <figure id="attachment_123" class="panel wp-caption alignleft">
  2. <div class="panel-body">
  3. <a class="caption-link" href="http://localhost/alpha/wp-content/uploads/ORIGINAL-IMAGE.jpg" data-toggle="lightbox" data-title="Caption Text">
  4. <img class="alignleft size-tiny wp-image-123" src="http://localhost/alpha/wp-content/uploads/TINY.jpg" alt="" width="200" height="200" />
  5. </a>
  6. </div>
  7. <figcaption class="panel-footer caption wp-caption-text">Caption Text</figcaption>
  8. </figure>
  9.  
  10. <figure id="attachment_123" class="panel wp-caption alignleft">
  11. <div class="panel-body">
  12. <a class="caption-link" href="http://localhost/alpha/wp-content/uploads/LARGE-IMAGE.jpg" data-toggle="lightbox" data-title="Caption Text">
  13. <img class="alignleft size-tiny wp-image-123" src="http://localhost/alpha/wp-content/uploads/TINY.jpg" alt="" width="200" height="200" />
  14. </a>
  15. </div>
  16. <figcaption class="panel-footer caption wp-caption-text">Caption Text</figcaption>
  17. </figure>
  18.  
  19. function img_caption_shortcode( $attr, $content = null ) {
  20. // New-style shortcode with the caption inside the shortcode with the link and image tags.
  21. if ( ! isset( $attr['caption'] ) ) {
  22. if ( preg_match( '#((?:<a [^>]+>s*)?<img [^>]+>(?:s*</a>)?)(.*)#is', $content, $matches ) ) {
  23. $content = $matches[1];
  24. $attr['caption'] = trim( $matches[2] );
  25. }
  26. } elseif ( strpos( $attr['caption'], '<' ) !== false ) {
  27. $attr['caption'] = wp_kses( $attr['caption'], 'post' );
  28. }
Add Comment
Please, Sign In to add comment