Support » Plugin: Event Organiser » Add "running" class to list event

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    It should add ‘eo-event-running’ if the event (occurrence) has already started, but not yet finished.

    (If its not, could be a bug – but I doubt it 😉 ).

    Take a look at the source, but it does filter the classes via eventorganiser_event_classes – so use that rather than editing the plug-in files.

    Source: https://github.com/stephenharris/Event-Organiser/blob/2.1.2/includes/event-organiser-event-functions.php#L765

    Theoretically i haven’t any occurrence events, so for this i can’t get the running status.

    maybe a php trick could do the magic? 🙂

    the problem is due to my custom shortcode-event-list.php file

    <?php
    /**
     * Event List Widget: Standard List
     *
     * The template is used for displaying the [eo_event] shortcode *unless* it is wrapped around a placeholder: e.g. [eo_event] {placeholder} [/eo_event].
     *
     * You can use this to edit how the output of the eo_event shortcode. See http://wp-event-organiser.com/documentation/shortcodes/event-list-shortcode/
     * For the event list widget see widget-event-list.php
     *
     * For a list of available functions (outputting dates, venue details etc) see http://wp-event-organiser.com/documentation/function-reference/
     *
     ***************** NOTICE: *****************
     *  Do not make changes to this file. Any changes made to this file
     * will be overwritten if the plug-in is updated.
     *
     * To overwrite this template with your own, make a copy of it (with the same name)
     * in your theme directory. See http://wp-event-organiser.com/documentation/editing-the-templates/ for more information
     *
     * WordPress will automatically prioritise the template in your theme directory.
     ***************** NOTICE: *****************
     *
     * @package Event Organiser (plug-in)
     * @since 1.7
     */
    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'];
    $classes = $eo_event_loop_args['class'];
    
    ?>
    
    <?php if( $eo_event_loop->have_posts() ): ?>
    
    <h4 class="eo-month">Prossimi eventi del Club</h4>
    	<ul id="<?php echo esc_attr($id);?>" class="<?php echo esc_attr($classes);?>" > 
    
    		<?php while( $eo_event_loop->have_posts() ): $eo_event_loop->the_post(); ?>
    
    			<?php
    				//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));?>">
    				<p class="eo-date"><span class="day"><?php echo __('','eventorganiser') . ' '.eo_get_the_start('d'); ?></span><br/>
    				<?php echo __('','eventorganiser') . ' '.eo_get_the_start('M'); ?></p>
    			<div class="title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php the_title(); ?></a></div>
    			</li>
    
    		<?php endwhile; ?>
    
    	</ul>
    
    <?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; ?>

    is it possible to keep this settings but adding the running class?

    if i edit the event-organiser-event-functions.php file, should i put it in my theme folder?

    thanks in advance

    Plugin Author Stephen Harris

    (@stephenharris)

    if i edit the event-organiser-event-functions.php file, should i put it in my theme folder?

    No, only templates. All other code should go in a site utility plug-in or your theme’s functions.php.

    Theoretically i haven’t any occurrence events, so for this i can’t get the running status.

    Do you mean that all your events are ‘single’? In which case you do, just single occurrence events.

    Each occurrence will be assigned one of the classes eo-event-future / eo-event-past / eo-event-running. Depending on it whether the occurrence has already finished, whether it hasn’t started yet – or its started and not finished.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add "running" class to list event’ is closed to new replies.