{"id":1356007,"date":"2017-09-28T04:29:35","date_gmt":"2017-09-28T11:29:35","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/"},"modified":"2017-09-28T04:29:35","modified_gmt":"2017-09-28T11:29:35","slug":"function-to-display-end-date-only-if-its-a-different-month-than-start-date","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/","title":{"rendered":"Function to display end date only if it&#039;s a different month than start date"},"content":{"rendered":"<p>I am looking for a way to display an event&#8217;s end date only if the event spans over more than one month. Here is the code I&#8217;m working with:<\/p>\n<p><code><br \/>\n&lt;!-- Schedule &amp; Recurrence Details --&gt;<br \/>\n    &lt;div class=\"tribe-event-schedule-details\"&gt;<br \/>\n        &lt;div class=\"month\"&gt;<br \/>\n            &lt;span&gt;&lt;?php echo tribe_get_start_date( null, false, 'M' ); ?&gt;\t&lt;\/span&gt;<br \/>\n        &lt;\/div&gt;<\/p>\n<p>        &lt;div class=\"dates\"&gt;<br \/>\n        &lt;span class=\"start-date\"&gt;<br \/>\n            &lt;?php echo tribe_get_start_date( null, false, 'j' ); ?&gt;<br \/>\n        &lt;\/span&gt;<\/p>\n<p>        &lt;span class=\"end-date\"&gt;<br \/>\n        &lt;?php if ( tribe_event_is_multiday( $event ) ) : ?&gt;<br \/>\n            &lt;span class=\"sep\"&gt;-&lt;\/span&gt;<br \/>\n            &lt;?php echo tribe_get_end_date( null, false, 'j' ); ?&gt;<br \/>\n        &lt;?php endif; ?&gt;<br \/>\n        &lt;\/span&gt;<br \/>\n        &lt;\/div&gt;<br \/>\n    &lt;\/div&gt;<br \/>\n<\/code><\/p>\n<p>This has been working pretty well for me and yield results that look like <a href=\"https:\/\/imgur.com\/a\/nCBWn\" target=\"_blank\">this<\/a>. The problem I&#8217;m running into is with events that run over multiple months, where it ends up looking like <a href=\"https:\/\/imgur.com\/FdcVJpk\" target=\"_blank\">this<\/a> (and event that runs from September to October). <\/p>\n<p>I would like to be able to display the name of the end date&#8217;s month only in these instances. Is this possible?<\/p>\n","protected":false},"template":"","class_list":["post-1356007","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>Function to display end date only if it&#039;s a different month than start date -<\/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\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Function to display end date only if it&#039;s a different month than start date -\" \/>\n<meta property=\"og:description\" content=\"I am looking for a way to display an event&#8217;s end date only if the event spans over more than one month. Here is the code I&#8217;m working with: &lt;!-- Schedule &amp; Recurrence Details --&gt; &lt;div class=&quot;tribe-event-schedule-details&quot;&gt; &lt;div class=&quot;month&quot;&gt; &lt;span&gt;&lt;?php echo tribe_get_start_date( null, false, &#039;M&#039; ); ?&gt; &lt;\/span&gt; &lt;\/div&gt; &lt;div class=&quot;dates&quot;&gt; &lt;span class=&quot;start-date&quot;&gt; &lt;?php echo [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/\" \/>\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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/\",\"name\":\"Function to display end date only if it&#039;s a different month than start date -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-09-28T11:29:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/#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\":\"Function to display end date only if it&#039;s a different month than start date\"}]},{\"@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":"Function to display end date only if it&#039;s a different month than start date -","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\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/","og_locale":"en_US","og_type":"article","og_title":"Function to display end date only if it&#039;s a different month than start date -","og_description":"I am looking for a way to display an event&#8217;s end date only if the event spans over more than one month. Here is the code I&#8217;m working with: &lt;!-- Schedule &amp; Recurrence Details --&gt; &lt;div class=\"tribe-event-schedule-details\"&gt; &lt;div class=\"month\"&gt; &lt;span&gt;&lt;?php echo tribe_get_start_date( null, false, 'M' ); ?&gt; &lt;\/span&gt; &lt;\/div&gt; &lt;div class=\"dates\"&gt; &lt;span class=\"start-date\"&gt; &lt;?php echo [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/","name":"Function to display end date only if it&#039;s a different month than start date -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-09-28T11:29:35+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/function-to-display-end-date-only-if-its-a-different-month-than-start-date\/#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":"Function to display end date only if it&#039;s a different month than start date"}]},{"@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\/1356007","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\/1356007\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1356007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}