{"id":956152,"date":"2015-04-16T16:31:37","date_gmt":"2015-04-16T23:31:37","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/"},"modified":"2015-04-21T20:44:56","modified_gmt":"2015-04-22T03:44:56","slug":"captions-for-featured-images-on-tribe_events-posts-not-displaying","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/","title":{"rendered":"Captions for featured images on tribe_events posts not displaying"},"content":{"rendered":"<p>Hi &#8211; our editors are creating captions for the featured images associated with events (tribe_events post type), but they&#8217;re not displaying using the same methods for rendering images on other posts.<\/p>\n<p>It looks like you have your own &#8216;featured image display&#8217; code in your template_tags.php file.  Any hints on how we can extend your function to return a caption?<\/p>\n<p>Our code that does it for other featured images:<\/p>\n<p>function get_the_feature_caption() {<br \/>\n  global $post;<br \/>\n  $thumbnail_id    = get_post_thumbnail_id($post-&gt;ID);<br \/>\n  $thumbnail_image = get_posts(array(&#8216;p&#8217; =&gt; $thumbnail_id, &#8216;post_type&#8217; =&gt; &#8216;attachment&#8217;));<br \/>\n  if ($thumbnail_image &amp;&amp; isset($thumbnail_image[0])) {<br \/>\n    if (! empty($thumbnail_image[0]-&gt;post_excerpt)) {<br \/>\n      $caption = $thumbnail_image[0]-&gt;post_excerpt;<br \/>\n    }<br \/>\n  }<br \/>\n  return $caption;<br \/>\n}<\/p>\n<p>function get_image_credit($post) {<br \/>\n  $featured_image_id = get_post_thumbnail_id($post);<br \/>\n  $caption = get_the_feature_caption($post);<br \/>\n  $image_credit = get_post_meta($featured_image_id, &#8216;image_credit&#8217;, true);<\/p>\n<p>  if (empty( $caption)) { $figclass=&#8217;credit-only&#8217;; }<\/p>\n<p>  if (! empty( $caption) || ! empty( $image_credit ) ) {<br \/>\n    if (! empty( $image_credit )) {<br \/>\n      $credit = &#8216;&lt;figcaption class=&#8221;&#8216; . $figclass . &#8216;&#8221;&gt;&lt;p&gt;&#8217; . $caption . &#8216; (&#8216; .$image_credit . &#8216;)&lt;\/p&gt;&lt;\/figcaption&gt;&#8217;;<br \/>\n    } else {<br \/>\n      $credit = &#8216;&lt;figcaption&gt;&lt;p&gt;&#8217; . $caption . &#8216;&lt;\/p&gt;&lt;\/figcaption&gt;&#8217;;<br \/>\n    }<br \/>\n    return $credit;<br \/>\n  }<br \/>\n}<\/p>\n<p>Your code for returning a featured image:<br \/>\n\tfunction tribe_event_featured_image( $post_id = null, $size = &#8216;full&#8217;, $link = true ) {<br \/>\n\t\tif ( is_null( $post_id ) ) {<br \/>\n\t\t\t$post_id = get_the_ID();<br \/>\n\t\t}<br \/>\n\t\t$image_src      = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), $size );<br \/>\n\t\t$featured_image = &#8221;;<\/p>\n<p>\t\t\/\/if link is not specifically excluded, then include <a><br \/>\n\t\tif ( ! empty( $image_src ) &amp;&amp; $link ) {<br \/>\n\t\t\t$featured_image .= &#8216;&lt;div class=&#8221;tribe-events-event-image&#8221;&gt;<a href=\"' . tribe_get_event_link() . '\" title=\"' . get_the_title( $post_id ) . '\"><img decoding=\"async\" src=\"' . $image_src[0] . '\" \/><\/a>&lt;\/div&gt;&#8217;;<br \/>\n\t\t} elseif ( ! empty( $image_src ) ) {<br \/>\n\t\t\t$featured_image .= &#8216;&lt;div class=&#8221;tribe-events-event-image&#8221;&gt;<img decoding=\"async\" src=\"' . $image_src[0] . '\" \/>&lt;\/div&gt;&#8217;;<br \/>\n\t\t}<\/p>\n<p>\t\treturn apply_filters( &#8216;tribe_event_featured_image&#8217;, $featured_image, $post_id, $size, $image_src );<br \/>\n\t}<\/p>\n","protected":false},"template":"","class_list":["post-956152","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Captions for featured images on tribe_events posts not displaying -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Captions for featured images on tribe_events posts not displaying -\" \/>\n<meta property=\"og:description\" content=\"Hi &#8211; our editors are creating captions for the featured images associated with events (tribe_events post type), but they&#8217;re not displaying using the same methods for rendering images on other posts. It looks like you have your own &#8216;featured image display&#8217; code in your template_tags.php file. Any hints on how we can extend your function [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-04-22T03:44:56+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/\",\"name\":\"Captions for featured images on tribe_events posts not displaying -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-04-16T23:31:37+00:00\",\"dateModified\":\"2015-04-22T03:44:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Captions for featured images on tribe_events posts not displaying\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Captions for featured images on tribe_events posts not displaying -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/","og_locale":"en_US","og_type":"article","og_title":"Captions for featured images on tribe_events posts not displaying -","og_description":"Hi &#8211; our editors are creating captions for the featured images associated with events (tribe_events post type), but they&#8217;re not displaying using the same methods for rendering images on other posts. It looks like you have your own &#8216;featured image display&#8217; code in your template_tags.php file. Any hints on how we can extend your function [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/","article_modified_time":"2015-04-22T03:44:56+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/","name":"Captions for featured images on tribe_events posts not displaying -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-04-16T23:31:37+00:00","dateModified":"2015-04-22T03:44:56+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/captions-for-featured-images-on-tribe_events-posts-not-displaying\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Captions for featured images on tribe_events posts not displaying"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/956152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/956152\/revisions"}],"predecessor-version":[{"id":956177,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/956152\/revisions\/956177"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=956152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}