WordPress.org

Ready to get started?Download WordPress

Forums

Event Organiser
[resolved] Past events still showing in list (4 posts)

  1. earthtojeremy
    Member
    Posted 2 years ago #

    I have "show past events in calendars, lists, etc." unchecked in the admin panel, but they still show up anyway. I figured out how to deal with this in the shortcode -- [eo_events event_start_after="now"] -- but I'm not sure what to do with regard to the php template files. The documentation refers to <?php eo_get_events($args) ?> but since this is not present in the default template files I'm not sure how to implement it. (The default templates use the basic WP <?php while ( have_posts() ) : the_post(); ?>, and it's not clear if <?php eo_get_events($args) ?> works inside of this loop, or if it has to be used separately.)

    Can you help me with the code, or do you know why the admin panel option wouldn't be working?

    Thanks a ton,
    Jeremy

    http://wordpress.org/extend/plugins/event-organiser/

  2. Stephen Harris
    Member
    Plugin Author

    Posted 2 years ago #

    The admin option is confusing. Calendars will always show past events.

    With the archives (post type and taxonomies), as well as eo_get_events, WP_Query instances, the widget and shortcode lists the default value for the 'showpastevents' argument should be whatever is set in the admin screen...

    You can over-ride the argument by using event_start_after parameter in eo_get_events or a WP_Query object, or showpastevents taking the value 1 or 0 (1 being 'true').

    Let me know if you're still experiencing problems - because it may be a bug. I'll run my own tests shortly too.

  3. earthtojeremy
    Member
    Posted 2 years ago #

    I guess I just don't understand where to put showpastevents=0. Here's the post loop code I'm using in archive-event.php:

    <div id="center-panel" class="box-shadow">
    				<?php if ( have_posts() ) : ?>
    				<?php
    				global $wp_query;
    				if ( $wp_query->max_num_pages > 1 ) : ?>
    				<?php endif; ?>
    
    				<?php /* Start the Loop */ ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>
    					<div id="post-<?php the_ID(''); ?>" <?php post_class(); ?>>
    
    						<div class="entry-header">
    							<h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    
                                <?php if ( has_post_thumbnail()) : ?>
       								<div class="event-thumb"><a href="<?php the_permalink(); ?>" title="" >
       								<?php the_post_thumbnail('event_thumb_size'); ?>
       								</a></div>
                                <div class="entry-meta-with-thumb">
                                <?php else: ?>
                                <div class="entry-meta">
    							<?php endif; ?>
    								<!-- Output the date of the occurrence-->
    								<div class="entry-meta-time">
    								<?php if(eo_is_all_day()):?>
    									<!-- Event is an all day event -->
    									<?php eo_the_start('F j, Y'); ?>
    								<?php else: ?>
    									<!-- Event is not an all day event - display time -->
    									<?php eo_the_start('F j, Y ยท g:i a'); ?>
    								<?php endif; ?>
    								</div>
    								<!-- If the event has a venue saved, display this-->
    								<div class="entry-meta-venue">
    								<?php if(eo_get_venue_name()):?>
    									<?php _e('@','eventorganiser');?> <a href="<?php eo_venue_link();?>"><?php eo_venue_name();?></a>
                                    <?php endif;?>
                                    	<br />
                                    <?php if(get_post_meta($post->ID, 'cover')):?>
    									$<?php echo get_post_meta($post->ID, 'cover', true); ?>
                                    <?php endif;?>
                                    </div>
                                    <?php echo (the_excerpt());?>
    							</div><!-- .entry-meta -->
    
    						</div><!-- .entry-header -->
    
    					</div>
    
        				<?php endwhile; ?><!----The Loop ends-->
    
    				<!---- If there are no events -->
    				<div id="post-0" class="post no-results not-found">
    					<div class="entry-header">
    						<h1 class="entry-title"><?php _e( 'No events found.', 'eventorganiser' ); ?></h1>
    					</div><!-- .entry-header -->
    
    					<div class="entry-content">
    						<p><?php _e( 'Apologies, but no results were found for the requested archive', 'eventorganiser' ); ?></p>
    					</div><!-- .entry-content -->
    				</div><!-- #post-0 -->
    
    			<?php endif; ?>
    
            	</div>

    It's based on the code from the default template, with some adjustments and additions. I only half know what I'm doing so any help would be much appreciated.

  4. earthtojeremy
    Member
    Posted 2 years ago #

    Nevermind -- it was the result of a huge oversight on my part. I accidentally made a test event that started on a past date, but ended on a date months in the future. That's why it kept showing up even though the start date had past (I don't display the end date on my site so I didn't notice until I looked at the admin page.)

    Sorry about that, thanks for you efforts.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic