{"id":1188724,"date":"2016-11-07T10:31:40","date_gmt":"2016-11-07T18:31:40","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2\/"},"modified":"2016-11-07T10:31:40","modified_gmt":"2016-11-07T18:31:40","slug":"thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2\/","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<pre><code>function tribe_event_featured_image( $post_id = null, $size = &#039;full&#039;, $link = true ) {\n        if ( is_null( $post_id ) ) {\n            $post_id = get_the_ID();\n        }\n \n        \/**\n         * Provides an opportunity to modify the featured image size.\n         *\n         * @param string $size\n         * @param int    $post_id\n         *\/\n        $image_html     = get_the_post_thumbnail( $post_id, apply_filters( &#039;tribe_event_featured_image_size&#039;, $size, $post_id ) );\n        $featured_image = &#039;&#039;;\n \n        \/**\n         * Controls whether the featured image should be wrapped in a link\n         * or not.\n         *\n         * @param bool $link\n         *\/\n        if ( ! empty( $image_html ) &amp;&amp; apply_filters( &#039;tribe_event_featured_image_link&#039;, $link ) ) {\n            $featured_image .= &#039;&lt;div class=&quot;tribe-events-event-image&quot;&gt;&lt;a href=&quot;&#039; . esc_url( tribe_get_event_link() ) . &#039;&quot;&gt;&#039; . $image_html . &#039;&lt;\/a&gt;&lt;\/div&gt;&#039;;\n        } elseif ( ! empty( $image_html ) ) {\n            $featured_image .= &#039;&lt;div class=&quot;tribe-events-event-image&quot;&gt;&#039; . $image_html . &#039;&lt;\/div&gt;&#039;;\n        }\n \n        \/**\n         * Provides an opportunity to modify the featured image HTML.\n         *\n         * @param string $featured_image\n         * @param int    $post_id\n         * @param string $size\n         *\/\n        return apply_filters( &#039;tribe_event_featured_image&#039;, $featured_image, $post_id, $size );\n    }\n \nfunction tribe_get_event_link( $postId = null, $full_link = false ) { \n$url = Tribe__Events__Main::instance()-&gt;getLink( &#039;single&#039;, $postId );\n \n        if ( &#039;&#039; != get_option( &#039;permalink_structure&#039; ) ) $url = trailingslashit( $url );\n \n        if ( $full_link ) {\n            $title_args = array( &#039;post&#039; =&gt; $postId, &#039;echo&#039; =&gt; false );\n            $name = get_the_title( $postId );\n            $attr_title = the_title_attribute( $title_args );\n            $link = ! empty( $url ) &amp;&amp; ! empty( $name ) ? &#039;&lt;a href=&quot;&#039; . esc_url( $url ) . &#039;&quot; title=&quot;&#039;.$attr_title.&#039;&quot;&quot;&gt;&#039; . $name . &#039;&lt;\/a&gt;&#039; : false;\n        } else {\n            $link = $url;\n        }\n \n        return apply_filters( &#039;tribe_get_event_link&#039;, $link, $postId, $full_link, $url );<\/code><\/pre>\n<p>IN OUR FUNCTIONS.PHP FILE WE HAVE: <\/p>\n<pre><code>In our functions file we have:\n\nfunction iw_tribe_get_event_link( $postId = null, $full_link = true ) {\n\n$url = Tribe__Events__Main::instance()-&gt;getLink( &#039;single&#039;, $postId );\n\nif ( &#039;&#039; != get_option( &#039;permalink_structure&#039; ) ) $url = trailingslashit( $url );\n\nif ( $full_link ) {\n$title_args = array( &#039;post&#039; =&gt; $postId, &#039;echo&#039; =&gt; false );\n$name = get_the_title( $postId );\n$attr_title = the_title_attribute( $title_args );\n$link = ! empty( $url ) &amp;&amp; ! empty( $name ) ? &#039;&lt;a href=&quot;&#039; . esc_url( $url ) . &#039;&quot; title=&quot;&#039;.$attr_title.&#039;&quot;&quot;&gt;&#039; . $name . &#039;&lt;\/a&gt;&#039; : false;\n} else {\n$link = $url;\n}\n\nreturn apply_filters( &#039;tribe_get_event_link&#039;, $link, $postId, $full_link, $url );\n}\n\nfunction iw_tribe_event_featured_image( $post_id = null, $size = &#039;full&#039;, $link = true ) {\nif ( is_null( $post_id ) ) {\n$post_id = get_the_ID();\n}\n\n\/**\n* Provides an opportunity to modify the featured image size.\n*\n* @param string $size\n* @param int $post_id\n*\/\n$image_html = get_the_post_thumbnail( $post_id, apply_filters( &#039;tribe_event_featured_image_size&#039;, $size, $post_id ) );\n$featured_image = &#039;&#039;;\n\n\/**\n* Controls whether the featured image should be wrapped in a link\n* or not.\n*\n* @param bool $link\n*\/\nif ( ! empty( $image_html ) &amp;&amp; apply_filters( &#039;tribe_event_featured_image_link&#039;, $link ) ) {\n$featured_image .= &#039;&lt;div class=&quot;tribe-events-event-image&quot;&gt;&lt;a href=&quot;&#039; . esc_url( iw_tribe_get_event_link() ) . &#039;&quot;&gt;&#039; . $image_html . &#039;&lt;\/a&gt;&lt;\/div&gt;&#039;;\n} elseif ( ! empty( $image_html ) ) {\n$featured_image .= &#039;&lt;div class=&quot;tribe-events-event-image&quot;&gt;&#039; . $image_html . &#039;&lt;br&gt;&#039;.$link.&#039;&lt;\/div&gt;&#039;;\n}\n\n\/**\n* Provides an opportunity to modify the featured image HTML.\n*\n* @param string $featured_image\n* @param int $post_id\n* @param string $size\n*\/\nreturn apply_filters( &#039;tribe_event_featured_image&#039;, $featured_image, $post_id, $size );\n}\n\nAnd in within our theme we have, in single-event.php:\n\n&lt;div id=&quot;tribe-events-event-&lt;?php echo esc_attr( $event-&gt;ID ); ?&gt;&quot; class=&quot;&lt;?php tribe_events_event_classes( $event-&gt;ID ) ?&gt; tribe-this-week-event&quot; &gt;\n\n&lt;a href=&quot;&lt;?php echo esc_url( tribe_get_event_link( $event-&gt;ID ) ); ?&gt;&quot; rel=&quot;bookmark&quot;&gt;\n&lt;?php\necho iw_tribe_event_featured_image($event-&gt;ID, &#039;thumbnail&#039;);\n?&gt;\n&lt;\/a&gt;\n\n&lt;h2 class=&quot;entry-title summary&quot;&gt;\n&lt;a href=&quot;&lt;?php echo esc_url( tribe_get_event_link( $event-&gt;ID ) ); ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;?php echo esc_html( $event-&gt;post_title ); ?&gt;&lt;\/a&gt;\n&lt;\/h2&gt;\n\n&lt;div class=&quot;duration&quot;&gt;\n&lt;?php echo tribe_events_event_schedule_details( $event-&gt;ID ) ?&gt;\n\n&lt;\/div&gt;\n\n&lt;div class=&quot;fn org tribe-venue&quot;&gt;\n&lt;?php echo tribe_get_venue_link( $event-&gt;ID ); ?&gt;\n&lt;\/div&gt;\n\n&lt;\/div&gt;<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-1188724","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-2\/\" \/>\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-2\/\" \/>\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=\"4 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-2\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2\/\",\"name\":\"thumbnail image in week view widget - make it link to event and not `\/`... -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-11-07T18:31:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2\/#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-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2\/#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\":\"Welcome!\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Pre-Sales Questions\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/\"},{\"@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-2\/","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-2\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 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-2\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2\/","name":"thumbnail image in week view widget - make it link to event and not `\/`... -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-11-07T18:31:40+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2\/#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-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/thumbnail-image-in-week-view-widget-make-it-link-to-event-and-not-2\/#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":"Welcome!","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/"},{"@type":"ListItem","position":4,"name":"Pre-Sales Questions","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/"},{"@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\/1188724","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\/1188724\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1188724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}