{"id":1218019,"date":"2017-01-13T06:13:32","date_gmt":"2017-01-13T14:13:32","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/"},"modified":"2017-01-13T06:13:32","modified_gmt":"2017-01-13T14:13:32","slug":"mini-widget-date-link-direct-to-event-only-have-1-event-each-day","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/","title":{"rendered":"Mini widget date link direct to event (only have 1 event each day)"},"content":{"rendered":"<p>Hello,<\/p>\n<p>First of all, many thanks for great plugin and great support.<\/p>\n<p>I&#8217;m not a great coder, so I&#8217;m checking here for suggestion &#8211; or possible already available ideas &#8211; it might be an old problem.<\/p>\n<p>In my calendar I only have 1 event each day (mainly start &amp; end date events) &#8211; and when I click on the mini calendar-widget I need to do 2 clicks to get into the information about the event, since the first click shows the available events for the day &#8211; and in my case, only ever 1. <\/p>\n<p>I would like a little help figuring out how to make the mini widget calendar go straight to the event on a click. Hopefully something others have asked about before, so there might be a suggestion ready.<\/p>\n<p><a href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/events-calendar-widget-make-date-link-direct-to-event\/\" target=\"_blank\">This thread has the same problem<\/a>, although from 2014 and with mixed number of events each day &#8211; I only have one.<\/p>\n<p>Support there suggests this code, unfinished:<br \/>\n<code>\/**<br \/>\n * Incomplete function that lets you modify the day links for<br \/>\n * mini calendar table cells that contain events.<br \/>\n *<br \/>\n * @param $html<br \/>\n * @return mixed<br \/>\n *\/<br \/>\nfunction minical_custom_links( $html ) {<br \/>\n    \/\/ We only want to modify links!<br \/>\n    if ( false === strpos( $html, 'href=\"#\"' ) ) return $html;<br \/>\n    if ( false === strpos( $html, 'data-day' ) ) return $html;<\/p>\n<p>    \/\/ Get the date<br \/>\n    $matches = array();<br \/>\n    $match = preg_match( '#data-day=\"([0-9\\-]{10})\"#', $html, $matches );<\/p>\n<p>    \/\/ Did we find what we were looking for?<br \/>\n    if ( ! $match || ! isset( $matches[1] ) ) return $html;<br \/>\n    $date = $matches[1];<\/p>\n<p>    \/\/ At this point you'll need to weave some additional magic:<br \/>\n    \/\/ you now have a date ($date) that you know contains events -<br \/>\n    \/\/ you'll need to query to see how many it contains and either<br \/>\n    \/\/ return the original $html unmodified or else link directly<br \/>\n    \/\/ to the single event it contains ... good luck!<\/p>\n<p>    return $html; \/\/ Leaving this in place so as not to break things<br \/>\n}<\/p>\n<p>\/\/ Hook up our custom calendar widget links function<br \/>\nadd_filter( 'tribe_events_the_mini_calendar_day_link', 'minical_custom_links' );<\/code><\/p>\n<p>A great start, but since I&#8217;m not doing much other than dabble in the code, I&#8217;m having too much problem with the part left open.<\/p>\n<p><code> $date = $matches[1];<\/p>\n<p>    \/\/ At this point you'll need to weave some additional magic:<br \/>\n    \/\/ you now have a date ($date) that you know contains events -<br \/>\n    \/\/ you'll need to query to see how many it contains and either<br \/>\n    \/\/ return the original $html unmodified or else link directly<br \/>\n    \/\/ to the single event it contains ... good luck!<\/p>\n<p>    return $html; \/\/ Leaving this in place so as not to break things<\/code><\/p>\n<p>So my question is really, if there is someone that might have found a solution to this since 2014, or if support might be able to add or hint to some of that code supposed to be put in there to make the date link direct me straight to the only event for the day.<br \/>\nI have no need to find a query that checks how many events it contains, I pretty much just need the code to make it into a straight link for that event. <\/p>\n<p>Much to ask, I&#8217;m sure, but I&#8217;m at a loss for ideas &#8211; and feel that with this code above I am close.<\/p>\n<p>Thank you so much for any answer, in advance.<br \/>\n\ud83d\ude42<\/p>\n","protected":false},"template":"","class_list":["post-1218019","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>Mini widget date link direct to event (only have 1 event each day) -<\/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\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mini widget date link direct to event (only have 1 event each day) -\" \/>\n<meta property=\"og:description\" content=\"Hello, First of all, many thanks for great plugin and great support. I&#8217;m not a great coder, so I&#8217;m checking here for suggestion &#8211; or possible already available ideas &#8211; it might be an old problem. In my calendar I only have 1 event each day (mainly start &amp; end date events) &#8211; and when [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/\" \/>\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\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/\",\"name\":\"Mini widget date link direct to event (only have 1 event each day) -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-01-13T14:13:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/#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\":\"Mini widget date link direct to event (only have 1 event each day)\"}]},{\"@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":"Mini widget date link direct to event (only have 1 event each day) -","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\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/","og_locale":"en_US","og_type":"article","og_title":"Mini widget date link direct to event (only have 1 event each day) -","og_description":"Hello, First of all, many thanks for great plugin and great support. I&#8217;m not a great coder, so I&#8217;m checking here for suggestion &#8211; or possible already available ideas &#8211; it might be an old problem. In my calendar I only have 1 event each day (mainly start &amp; end date events) &#8211; and when [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/","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\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/","name":"Mini widget date link direct to event (only have 1 event each day) -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-01-13T14:13:32+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/mini-widget-date-link-direct-to-event-only-have-1-event-each-day\/#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":"Mini widget date link direct to event (only have 1 event each day)"}]},{"@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\/1218019","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\/1218019\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1218019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}