• Resolved jeholden

    (@jeholden)


    I’m using the [events_list] shortcode to display events on the page.

      <div id="upcoming-events" class="upcoming-events active">
        <?php echo do_shortcode('[events_list tag="-132,-154"]'); // 132 account2, 154 live; ?>
      </div>

    The issue is that when the event spans 2 months, the end date does not show the month.

    First Steps To Success – April 2022
    April 29 – 1, 2022
    6:00pm CDT America/Chicago

    How can I get the date to show the end month if it’s different than the start month (April 29 – May 1)?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jeholden

    (@jeholden)

    I found where the date settings are set.

    <p class="event-date">#_{F j}{is_long} - #@_{j}{/is_long}, #Y<br />
                        #_{g:ia T e}</p>

    How would I add an ‘if’ statement in to show the end month if it’s different than the start month?

    Thread Starter jeholden

    (@jeholden)

    I added an additional conditional placeholder and support for nesting them.

    add_action('em_event_output_show_condition', 'my_em_two_month_event_date_show_condition', 1, 4);
    function my_em_two_month_event_date_show_condition($show, $condition, $full_match, $EM_Event){
    	$eventStart = date_create($EM_Event->event_start_date);
    	$eventEnd = date_create($EM_Event->event_end_date);
    
        if (( date_format($eventStart,"F") != date_format($eventEnd,"F") ) && preg_match('/is_2months/i',$condition)) {
            $show = true;
        }
        return $show;
    }

    New date display format

    <p class="event-date">#_{F j}{is_long} - {is_2months}#@_{F }{/is_2months}#@_{j}{/is_long}, #Y<br />
                        #_{g:ia T e}</p>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issue with date display for events spanning 2 months’ is closed to new replies.