{"id":1161639,"date":"2016-09-08T11:15:05","date_gmt":"2016-09-08T18:15:05","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/"},"modified":"2016-09-08T11:15:05","modified_gmt":"2016-09-08T18:15:05","slug":"date-display-if-month-month","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/","title":{"rendered":"Date Display: If Month = Month"},"content":{"rendered":"<p>I am using a modified version of the code found on https:\/\/theeventscalendar.com\/support\/forums\/topic\/remove-times-from-event-schedule-details-function\/ to alter the date display.<\/p>\n<p>I&#8217;m curious if there is a way to have the date display differently if multi-day events have the same month (ex: October 1 &#8211; 5, 2016) than multi-day events that have different months (ex: October 28 &#8211; November 3, 2016).<\/p>\n<p>Here&#8217;s what I have so far:<\/p>\n<pre><code>\n\/**\n * Modifies tribe_events_event_schedule_details format\n *\n * @param string $schedule  the output HTML\n * @param int    $event_id  post ID of the event we are interested in\n * @param string $before    part of the HTML wrapper that was prepended\n * @param string $after     part of the HTML wrapper that was appended\n *\/\nfunction tribe_events_event_schedule_details_custom ( $schedule, $event_id = null, $before = &#039;&#039;, $after = &#039;&#039; ) {\n\n   $inner                    = &#039;&lt;span class=&quot;tribe-event-date-start&quot;&gt;&#039;;\n   $format                   = &#039;F j, Y&#039;;\n   $time_format              = get_option( &#039;time_format&#039; );\n   $datetime_separator       = tribe_get_option( &#039;dateTimeSeparator&#039;, &#039; @ &#039; );\n   $time_range_separator     = tribe_get_option( &#039;timeRangeSeparator&#039;, &#039; - &#039; );\n\n   $settings = array(\n      &#039;show_end_time&#039; =&gt; false,\n      &#039;time&#039;          =&gt; false,\n   );\n\n   \/**\n    * @var $show_end_time\n    * @var $time\n    *\/\n\n   if ( tribe_event_is_multiday( $event_id ) ) { \/\/ multi-date event\n\n   extract( $settings );\n      $format2ndday = apply_filters( &#039;tribe_format_second_date_in_range&#039;, $format, $event_id );\n\n      if ( tribe_event_is_all_day( $event_id ) ) {\n         $inner .= tribe_get_start_date( $event_id, true, &#039;F j&#039; );\n         $inner .= &#039;&lt;\/span&gt;&#039; . $time_range_separator;\n         $inner .= &#039;&lt;span class=&quot;tribe-event-date-end&quot;&gt;&#039;;\n\n         $end_date_full = tribe_get_end_date( $event_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT );\n         $end_date_full_timestamp = strtotime( $end_date_full );\n\n         \/\/ if the end date is &lt;= the beginning of the day, consider it the previous day\n         if ( $end_date_full_timestamp &lt;= strtotime( tribe_beginning_of_day( $end_date_full ) ) ) {\n            $end_date = tribe_format_date( $end_date_full_timestamp - DAY_IN_SECONDS, false, $format2ndday );\n         } else {\n            $end_date = tribe_get_end_date( $event_id, false, $format2ndday );\n         }\n\n         $inner .= $end_date;\n      } else {\n         $inner .= tribe_get_start_date( $event_id, false, &#039;F j&#039; ) . ( $time ? $datetime_separator . tribe_get_start_date( $event_id, false, $time_format ) : &#039;&#039; );\n         $inner .= &#039;&lt;\/span&gt;&#039; . $time_range_separator;\n         $inner .= &#039;&lt;span class=&quot;tribe-event-date-end&quot;&gt;&#039;;\n         \n\t\t $start_month = tribe_get_start_date($event_id, true, &#039;m&#039;);\n\t\t $end_month = tribe_get_end_date($event_id, true, &#039;m&#039;);\n\t\t \n\t\t if ( $start_month = $end_month ) {\n\t\t\t $inner .= tribe_get_end_date( $event_id, false, &#039; j, Y&#039; );\n\t\t } else {\n\t\t\t $inner .= tribe_get_end_date( $event_id, false, $format2ndday ) . ( $time ? $datetime_separator . tribe_get_end_date( $event_id, false, $time_format ) : &#039;&#039; );\n\t\t }\n\t\t \n\t  }\n   } elseif ( tribe_event_is_all_day( $event_id ) ) { \/\/ all day event\n      $inner .= tribe_get_start_date( $event_id, true, $format );\n   } else { \/\/ single day event   \n   \n         $inner .= tribe_get_start_date( $event_id, true, $format ) . &#039;&lt;\/span&gt;&#039;;\n         $inner .= &#039;&lt;span class=&quot;time&quot;&gt;&#039; . tribe_get_start_date( $event_id, true, &#039;g:i a&#039; );\n         $inner .= &#039; - &#039;;\n         $inner .= tribe_get_end_date( $event_id, true, &#039;g:i a&#039; );\n   }\n\n   $inner .= &#039;&lt;\/span&gt;&#039;;\n\n   \/**\n    * Provides an opportunity to modify the *inner* schedule details HTML (ie before it is\n    * wrapped).\n    *\n    * @param string $inner_html  the output HTML\n    * @param int    $event_id    post ID of the event we are interested in\n    *\/\n   $inner = apply_filters( &#039;tribe_events_event_schedule_details_inner&#039;, $inner, $event_id-&gt;ID );\n\n   \/\/ Wrap the schedule text\n   $schedule = $before . $inner . $after;\n\n   return $schedule;\n\n}\nadd_filter( &#039;tribe_events_event_schedule_details&#039;, &#039;tribe_events_event_schedule_details_custom&#039;, 10, 4 );\n<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-1161639","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>Date Display: If Month = Month -<\/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\/date-display-if-month-month\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Date Display: If Month = Month -\" \/>\n<meta property=\"og:description\" content=\"I am using a modified version of the code found on https:\/\/theeventscalendar.com\/support\/forums\/topic\/remove-times-from-event-schedule-details-function\/ to alter the date display. I&#8217;m curious if there is a way to have the date display differently if multi-day events have the same month (ex: October 1 &#8211; 5, 2016) than multi-day events that have different months (ex: October 28 &#8211; November [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/\" \/>\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\/date-display-if-month-month\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/\",\"name\":\"Date Display: If Month = Month -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-09-08T18:15:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/#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\":\"Date Display: If Month = Month\"}]},{\"@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":"Date Display: If Month = Month -","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\/date-display-if-month-month\/","og_locale":"en_US","og_type":"article","og_title":"Date Display: If Month = Month -","og_description":"I am using a modified version of the code found on https:\/\/theeventscalendar.com\/support\/forums\/topic\/remove-times-from-event-schedule-details-function\/ to alter the date display. I&#8217;m curious if there is a way to have the date display differently if multi-day events have the same month (ex: October 1 &#8211; 5, 2016) than multi-day events that have different months (ex: October 28 &#8211; November [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/","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\/date-display-if-month-month\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/","name":"Date Display: If Month = Month -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-09-08T18:15:05+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/date-display-if-month-month\/#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":"Date Display: If Month = Month"}]},{"@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\/1161639","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\/1161639\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1161639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}