{"id":1188748,"date":"2016-11-07T11:27:43","date_gmt":"2016-11-07T19:27:43","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/"},"modified":"2016-11-07T11:27:43","modified_gmt":"2016-11-07T19:27:43","slug":"link-featured-image-to-event","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/","title":{"rendered":"Link featured image to event"},"content":{"rendered":"<p>Hi<br \/>\nWe added the featured image to the Pro week-view and now need to have the image link to the event when clicked. Right now it just links to the home page?<br \/>\nWe moved single-events.php to our theme according to your Themer\u2019s Guide and added:<br \/>\necho tribe_event_featured_image($event-&gt;ID, &#8216;thumbnail&#8217;, false);<br \/>\nto the output. We added false because when this parameter was set to true, it linked to the homepage instead of the respective event page.<br \/>\nWe tried copying the tribe_event_featured_image() from general.php to our functions.php (renaming it to avoid conflict) file to see if we could change the url but we couldn&#8217;t figure it out. We also copied tribe_get_event_link( $postId = null, $full_link = true ) to our functions.php file&#8230;<\/p>\n<p>It seems like we should just be able to wrap the image in the same link as the heading tag, but we can&#8217;t get our heads around the filters&#8230;<br \/>\n$link is defined in function tribe_get_event_link but why does it seem to return &#8216;\/&#8217;?<\/p>\n<p>function 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}<\/p>\n<p>\t\t\/**<br \/>\n\t\t * Provides an opportunity to modify the featured image size.<br \/>\n\t\t *<br \/>\n\t\t * @param string $size<br \/>\n\t\t * @param int    $post_id<br \/>\n\t\t *\/<br \/>\n\t\t$image_html     = get_the_post_thumbnail( $post_id, apply_filters( &#8216;tribe_event_featured_image_size&#8217;, $size, $post_id ) );<br \/>\n\t\t$featured_image = &#8221;;<\/p>\n<p>\t\t\/**<br \/>\n\t\t * Controls whether the featured image should be wrapped in a link<br \/>\n\t\t * or not.<br \/>\n\t\t *<br \/>\n\t\t * @param bool $link<br \/>\n\t\t *\/<br \/>\n\t\tif ( ! empty( $image_html ) &amp;&amp; apply_filters( &#8216;tribe_event_featured_image_link&#8217;, $link ) ) {<br \/>\n\t\t\t$featured_image .= &#8216;&lt;div class=&#8221;tribe-events-event-image&#8221;&gt;<a href=\"' . esc_url( tribe_get_event_link() ) . '\">&#8216; . $image_html . &#8216;<\/a>&lt;\/div&gt;&#8217;;<br \/>\n\t\t} elseif ( ! empty( $image_html ) ) {<br \/>\n\t\t\t$featured_image .= &#8216;&lt;div class=&#8221;tribe-events-event-image&#8221;&gt;&#8217; . $image_html . &#8216;&lt;\/div&gt;&#8217;;<br \/>\n\t\t}<\/p>\n<p>\t\t\/**<br \/>\n\t\t * Provides an opportunity to modify the featured image HTML.<br \/>\n\t\t *<br \/>\n\t\t * @param string $featured_image<br \/>\n\t\t * @param int    $post_id<br \/>\n\t\t * @param string $size<br \/>\n\t\t *\/<br \/>\n\t\treturn apply_filters( &#8216;tribe_event_featured_image&#8217;, $featured_image, $post_id, $size );<br \/>\n\t}<\/p>\n<p>function tribe_get_event_link( $postId = null, $full_link = false ) {<\/p>\n<p>\t\t$url = Tribe__Events__Main::instance()-&gt;getLink( &#8216;single&#8217;, $postId );<\/p>\n<p>\t\tif ( &#8221; != get_option( &#8216;permalink_structure&#8217; ) ) $url = trailingslashit( $url );<\/p>\n<p>\t\tif ( $full_link ) {<br \/>\n\t\t\t$title_args = array( &#8216;post&#8217; =&gt; $postId, &#8216;echo&#8217; =&gt; false );<br \/>\n\t\t\t$name = get_the_title( $postId );<br \/>\n\t\t\t$attr_title = the_title_attribute( $title_args );<br \/>\n\t\t\t$link = ! empty( $url ) &amp;&amp; ! empty( $name ) ? &#8216;<a href=\"' . esc_url( $url ) . '\">&#8216; . $name . &#8216;<\/a>&#8216; : false;<br \/>\n\t\t} else {<br \/>\n\t\t\t$link = $url;<br \/>\n\t\t}<\/p>\n<p>\t\treturn apply_filters( &#8216;tribe_get_event_link&#8217;, $link, $postId, $full_link, $url );<br \/>\n\t}<\/p>\n","protected":false},"template":"","class_list":["post-1188748","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>Link featured image to event -<\/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\/link-featured-image-to-event\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Link featured image to event -\" \/>\n<meta property=\"og:description\" content=\"Hi We added the featured image to the Pro week-view and now need to have the image link to the event when clicked. Right now it just links to the home page? We moved single-events.php to our theme according to your Themer\u2019s Guide and added: echo tribe_event_featured_image($event-&gt;ID, &#8216;thumbnail&#8217;, false); to the output. We added false [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/\" \/>\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\/link-featured-image-to-event\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/\",\"name\":\"Link featured image to event -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-11-07T19:27:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/#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\":\"Link featured image to event\"}]},{\"@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":"Link featured image to event -","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\/link-featured-image-to-event\/","og_locale":"en_US","og_type":"article","og_title":"Link featured image to event -","og_description":"Hi We added the featured image to the Pro week-view and now need to have the image link to the event when clicked. Right now it just links to the home page? We moved single-events.php to our theme according to your Themer\u2019s Guide and added: echo tribe_event_featured_image($event-&gt;ID, &#8216;thumbnail&#8217;, false); to the output. We added false [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/","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\/link-featured-image-to-event\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/","name":"Link featured image to event -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-11-07T19:27:43+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/link-featured-image-to-event\/#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":"Link featured image to event"}]},{"@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\/1188748","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":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1188748\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1188748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}