{"id":1188406,"date":"2016-11-06T10:03:30","date_gmt":"2016-11-06T18:03:30","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/"},"modified":"2016-11-06T10:03:30","modified_gmt":"2016-11-06T18:03:30","slug":"thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/","title":{"rendered":"thumbnail image in week view widget &#8211; make it link to event and not `\/`&#8230;"},"content":{"rendered":"<p>Hi,<br \/>\nWe added thumbnails to the output of the week view following the directions in the themers-guide and that works great; but we need to link the image to the event, the way the heading does. How would we do that?<\/p>\n<p>So far, we&#8217;ve tried copying these two functions from general.php and link.php into our functions.php (changing the names to avoid conflict\u2026)<\/p>\n<p><code>function tribe_event_featured_image( $post_id = null, $size = 'full', $link = true ) {<br \/>\n        if ( is_null( $post_id ) ) {<br \/>\n            $post_id = get_the_ID();<br \/>\n        }<\/p>\n<p>        \/**<br \/>\n         * Provides an opportunity to modify the featured image size.<br \/>\n         *<br \/>\n         * @param string $size<br \/>\n         * @param int    $post_id<br \/>\n         *\/<br \/>\n        $image_html     = get_the_post_thumbnail( $post_id, apply_filters( 'tribe_event_featured_image_size', $size, $post_id ) );<br \/>\n        $featured_image = '';<\/p>\n<p>        \/**<br \/>\n         * Controls whether the featured image should be wrapped in a link<br \/>\n         * or not.<br \/>\n         *<br \/>\n         * @param bool $link<br \/>\n         *\/<br \/>\n        if ( ! empty( $image_html ) &amp;&amp; apply_filters( 'tribe_event_featured_image_link', $link ) ) {<br \/>\n            $featured_image .= '&lt;div class=\"tribe-events-event-image\"&gt;<a href=\"' . esc_url( tribe_get_event_link() ) . '\">' . $image_html . '<\/a>&lt;\/div&gt;';<br \/>\n        } elseif ( ! empty( $image_html ) ) {<br \/>\n            $featured_image .= '&lt;div class=\"tribe-events-event-image\"&gt;' . $image_html . '&lt;\/div&gt;';<br \/>\n        }<\/p>\n<p>        \/**<br \/>\n         * Provides an opportunity to modify the featured image HTML.<br \/>\n         *<br \/>\n         * @param string $featured_image<br \/>\n         * @param int    $post_id<br \/>\n         * @param string $size<br \/>\n         *\/<br \/>\n        return apply_filters( 'tribe_event_featured_image', $featured_image, $post_id, $size );<br \/>\n    }<\/p>\n<p>function tribe_get_event_link( $postId = null, $full_link = false ) {<br \/>\n$url = Tribe__Events__Main::instance()-&gt;getLink( 'single', $postId );<\/p>\n<p>        if ( '' != get_option( 'permalink_structure' ) ) $url = trailingslashit( $url );<\/p>\n<p>        if ( $full_link ) {<br \/>\n            $title_args = array( 'post' =&gt; $postId, 'echo' =&gt; false );<br \/>\n            $name = get_the_title( $postId );<br \/>\n            $attr_title = the_title_attribute( $title_args );<br \/>\n            $link = ! empty( $url ) &amp;&amp; ! empty( $name ) ? '<a href=\"' . esc_url( $url ) . '\">' . $name . '<\/a>' : false;<br \/>\n        } else {<br \/>\n            $link = $url;<br \/>\n        }<\/p>\n<p>        return apply_filters( 'tribe_get_event_link', $link, $postId, $full_link, $url );<\/code><\/p>\n<p>IN OUR FUNCTIONS.PHP FILE WE HAVE: <\/p>\n<p><code>In our functions file we have:<\/p>\n<p>function iw_tribe_get_event_link( $postId = null, $full_link = true ) {<\/p>\n<p>$url = Tribe__Events__Main::instance()-&gt;getLink( 'single', $postId );<\/p>\n<p>if ( '' != get_option( 'permalink_structure' ) ) $url = trailingslashit( $url );<\/p>\n<p>if ( $full_link ) {<br \/>\n$title_args = array( 'post' =&gt; $postId, 'echo' =&gt; false );<br \/>\n$name = get_the_title( $postId );<br \/>\n$attr_title = the_title_attribute( $title_args );<br \/>\n$link = ! empty( $url ) &amp;&amp; ! empty( $name ) ? '<a href=\"' . esc_url( $url ) . '\">' . $name . '<\/a>' : false;<br \/>\n} else {<br \/>\n$link = $url;<br \/>\n}<\/p>\n<p>return apply_filters( 'tribe_get_event_link', $link, $postId, $full_link, $url );<br \/>\n}<\/p>\n<p>function iw_tribe_event_featured_image( $post_id = null, $size = 'full', $link = true ) {<br \/>\nif ( is_null( $post_id ) ) {<br \/>\n$post_id = get_the_ID();<br \/>\n}<\/p>\n<p>\/**<br \/>\n* Provides an opportunity to modify the featured image size.<br \/>\n*<br \/>\n* @param string $size<br \/>\n* @param int $post_id<br \/>\n*\/<br \/>\n$image_html = get_the_post_thumbnail( $post_id, apply_filters( 'tribe_event_featured_image_size', $size, $post_id ) );<br \/>\n$featured_image = '';<\/p>\n<p>\/**<br \/>\n* Controls whether the featured image should be wrapped in a link<br \/>\n* or not.<br \/>\n*<br \/>\n* @param bool $link<br \/>\n*\/<br \/>\nif ( ! empty( $image_html ) &amp;&amp; apply_filters( 'tribe_event_featured_image_link', $link ) ) {<br \/>\n$featured_image .= '&lt;div class=\"tribe-events-event-image\"&gt;<a href=\"' . esc_url( iw_tribe_get_event_link() ) . '\">' . $image_html . '<\/a>&lt;\/div&gt;';<br \/>\n} elseif ( ! empty( $image_html ) ) {<br \/>\n$featured_image .= '&lt;div class=\"tribe-events-event-image\"&gt;' . $image_html . '&lt;br&gt;'.$link.'&lt;\/div&gt;';<br \/>\n}<\/p>\n<p>\/**<br \/>\n* Provides an opportunity to modify the featured image HTML.<br \/>\n*<br \/>\n* @param string $featured_image<br \/>\n* @param int $post_id<br \/>\n* @param string $size<br \/>\n*\/<br \/>\nreturn apply_filters( 'tribe_event_featured_image', $featured_image, $post_id, $size );<br \/>\n}<\/p>\n<p>And in within our theme we have, in single-event.php:<\/p>\n<p>&lt;div id=\"tribe-events-event-&lt;?php echo esc_attr( $event-&gt;ID ); ?&gt;\" class=\"&lt;?php tribe_events_event_classes( $event-&gt;ID ) ?&gt; tribe-this-week-event\" &gt;<\/p>\n<p><a>ID ) ); ?&gt;\" rel=\"bookmark\"&gt;<br \/>\n&lt;?php<br \/>\necho iw_tribe_event_featured_image($event-&gt;ID, 'thumbnail');<br \/>\n?&gt;<br \/>\n<\/a><\/p>\n<h2>\n<a>ID ) ); ?&gt;\" rel=\"bookmark\"&gt;&lt;?php echo esc_html( $event-&gt;post_title ); ?&gt;<\/a><br \/>\n<\/h2>\n<p>&lt;div class=\"duration\"&gt;<br \/>\n&lt;?php echo tribe_events_event_schedule_details( $event-&gt;ID ) ?&gt;<\/p>\n<p>&lt;\/div&gt;<\/p>\n<p>&lt;div class=\"fn org tribe-venue\"&gt;<br \/>\n&lt;?php echo tribe_get_venue_link( $event-&gt;ID ); ?&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>&lt;\/div&gt;<\/code><\/p>\n","protected":false},"template":"","class_list":["post-1188406","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>thumbnail image in week view widget - make it link to event and not `\/`... -<\/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\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"thumbnail image in week view widget - make it link to event and not `\/`... -\" \/>\n<meta property=\"og:description\" content=\"Hi, We added thumbnails to the output of the week view following the directions in the themers-guide and that works great; but we need to link the image to the event, the way the heading does. How would we do that? So far, we&#8217;ve tried copying these two functions from general.php and link.php into our [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/\" \/>\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=\"3 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\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/\",\"name\":\"thumbnail image in week view widget - make it link to event and not `\/`... -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-11-06T18:03:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/#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\":\"thumbnail image in week view widget &#8211; make it link to event and not `\/`&#8230;\"}]},{\"@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":"thumbnail image in week view widget - make it link to event and not `\/`... -","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\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/","og_locale":"en_US","og_type":"article","og_title":"thumbnail image in week view widget - make it link to event and not `\/`... -","og_description":"Hi, We added thumbnails to the output of the week view following the directions in the themers-guide and that works great; but we need to link the image to the event, the way the heading does. How would we do that? So far, we&#8217;ve tried copying these two functions from general.php and link.php into our [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/","name":"thumbnail image in week view widget - make it link to event and not `\/`... -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-11-06T18:03:30+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not\/#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":"thumbnail image in week view widget &#8211; make it link to event and not `\/`&#8230;"}]},{"@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\/1188406","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\/1188406\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1188406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}