Guest User

Untitled

a guest
Sep 2nd, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. function get_image_caption() {
  2. global $page;
  3.  
  4. //handle video post format
  5. if (get_post_format($this->post->ID) == 'video') {
  6. //if it's a video post...
  7. $td_post_video = td_util::get_post_meta_array($this->post->ID, 'td_post_video');
  8.  
  9. //render the video if the post has a video in the featured video section of the post
  10. if (!empty($td_post_video['td_video']) && class_exists( 'td_video_support')) {
  11. return td_video_support::render_video($td_post_video['td_video']);
  12. }
  13. } else {
  14. //if it's a normal post, show the caption
  15.  
  16. if (!is_null($this->post_thumb_id)) {
  17. $featured_image_id = get_post_thumbnail_id($this->post->ID);
  18. $featured_image_info = td_util::attachment_get_full_info($featured_image_id);
  19.  
  20.  
  21. // caption - put html5 wrapper on when we have a caption
  22. if (!empty($featured_image_info['caption'])) {
  23.  
  24. $buffy = '';
  25. $buffy .= '<figcaption class="wp-caption-text">' . $featured_image_info['caption'] . '</figcaption>';
  26. $buffy .= '</figure>';
  27. }
  28.  
  29. $buffy .= '</div>';
  30.  
  31.  
  32. return $buffy;
  33. } else {
  34. return ''; //the post has no thumb
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment