• Hello!

    I’m trying to figure out how to output the dates in my custom event list template with eo_format_datetime_range like shown on http://plugin226.rssing.com/chan-12548603/all_p150.html.

    If I echo $date1 or $date2 in the template, the dates are shown and are correct, but the use of echo eo_format_datetime_range( $date1, $date2, $format, $seperator = ‘ – ‘, $is_rtl = null ); always fails.

    Here is my template:

    <?php
    /**
     * Add this to your theme for it to take affect.
     */
    
    global $eo_event_loop,$eo_event_loop_args;
    
    //Date % Time format for events
    $date_format = get_option('date_format');
    $time_format = get_option('time_format');
    
    //The list ID / classes
    $id = ( $eo_event_loop_args['id'] ? 'id="'.$eo_event_loop_args['id'].'"' : '' );
    $classes = $eo_event_loop_args['class'];
    
    $current_month = false;
    
    ?>
    
    <?php if( $eo_event_loop->have_posts() ): ?>
    
            <?php while( $eo_event_loop->have_posts() ): $eo_event_loop->the_post(); ?>
    
                <?php 
                if( $current_month != eo_get_the_start('m') ){
    
                        //End previous group
                        echo '</ul>';
                        //Start new group
                        echo '<h3>'.eo_get_the_start('F Y').'</h3>';
                        echo '<ul>';
                }
                $current_month = eo_get_the_start('m');
    
                //Generate HTML classes for this event
                $eo_event_classes = eo_get_event_classes(); 
    
                //For non-all-day events, include time format
                ///$format = ( eo_is_all_day() ? $date_format : $date_format. '--' .$time_format );
    
                ?>
    
                <li class="<?php echo esc_attr(implode(' ',$eo_event_classes)); ?>" >
                    <a href="<?php the_permalink();?>" title="<?php the_title_attribute(); ?>" >
                         <?php the_title(); ?>
                    </a> 
    <?php
    $date1 = eo_get_the_start('jS F Y');
    $date2 = eo_get_the_end('jS F Y');
    $format = 'jS F Y'; //Format date as "1st June 2015";
    
    //3.0.0+ only:
    echo eo_format_datetime_range( $date1, $date2, $format, $seperator = ' &ndash; ', $is_rtl = null );
    ?>
                    <?php echo __('<br>','eventorganiser') . ' '.eo_get_the_start($format). ' to ' .eo_get_the_end($time_format); ?>
                </li>
    
            <?php endwhile; ?>
    
    <?php elseif( ! empty($eo_event_loop_args['no_events']) ): ?>
    
        <ul id="<?php echo esc_attr($id);?>" class="<?php echo esc_attr($classes);?>" > 
            <li class="eo-no-events" > <?php echo $eo_event_loop_args['no_events']; ?> </li>
        </ul>
    
    <?php endif; ?>

    Hopefully somebody can help me with this as I am no programmer.

    Thanks a lot!
    Christian

The topic ‘Problems with eo_format_datetime_range’ is closed to new replies.