• Resolved xionn

    (@xionn)


    I can display the day of the week using – <?php eo_the_start(‘l d F Y’); ?> but when using the code below I don’t seem to be able to display the day of the week.

    <?php
    $events = eo_get_events(array(
    ‘numberposts’=>2,
    ‘tax_query’=>array( array(
    ‘taxonomy’=>’event-category’,
    ‘operator’ => ‘IN’,
    ‘field’=>’slug’,
    ‘terms’=>array(‘sermons’, ‘events’)
    ))
    ));

    if($events):

    foreach ($events as $event):

    $return= ‘<h2 class=”event-title”>’.eo_format_date($event->StartDate, get_option(‘date_format’)).'</h2><p>’.$event->post_title.'</p>’;
    echo $return;

    endforeach;
    endif
    ?>
    Can anyone help?

    https://www.ads-software.com/extend/plugins/event-organiser/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi xionn,
    This is because you are using get_option('date_format') – which uses the date format saved in your site’s General Settings page – to format the date.

    I would do the following:

    $events = eo_get_events(...);
    if($events):
        global $post;
        $temp = $post;
        foreach ($events as $post):
            $return= '<h2 class="event-title">'.eo_get_the_start('l d F Y').'</h2><p>'.get_the_title().'</p>';
            echo $return;
        endforeach;
        //Rest global $post;
        $post =$temp;
    endif

    ?>

    Thread Starter xionn

    (@xionn)

    Stephen,

    Thanks, the code works well.

    much appreciated.

    Hi – I would also like to display dates in this format, for example: Friday, June 28, 2013. I’m new to web programming though and don’t know where to put this code. Where exactly should this code be pasted? Is there an easier way to do this? This seems like a basic feature to include day of the week.

    Thank you!

    Plugin Author Stephen Harris

    (@stephenharris)

    dcupery – yes you can but how depends where you want the format changed …

    Widgets and shortcodes will accept date format options. If you’re referring to the event pages, then you’ll need to edit the templates.

    All date formats are in php format: https://php.net/manual/en/function.date.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Event Organiser] display day of the week using eo_get_events(array’ is closed to new replies.