Support » Plugins » [Plugin: The Events Calendar] Querying for Upcoming and Past events: both showing all events

  • Here’s the markup:

    <h1>Upcoming Events</h1>
    		<?php $upcoming_query = new WP_Query('cat=4&eventDisplay=upcoming'); ?>
    			<?php while ($upcoming_query->have_posts()) : $upcoming_query->the_post(); ?>
    				<div class="post" id="post-<?php the_ID(); ?>">
    				<h3><?php the_title(); ?></h3>
    				<div class="entry">
    				<span class="the-date"><?php echo the_event_start_date(); ?></span>
    				<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    				</div>
    			<?php endwhile; ?>
    	<h1>Past Events</h1>
    		<?php $past_query = new WP_Query('cat=4&eventDisplay=past'); ?>
    			<?php while ($upcoming_query->have_posts()) : $upcoming_query->the_post(); ?>
    				<div class="post" id="post-<?php the_ID(); ?>">
    				<h3><?php the_title(); ?></h3>
    				<div class="entry">
    				<span class="the-date"><?php echo the_event_start_date(); ?></span>
    				<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    				</div>
    			<?php endwhile; ?>

    But both lists are just showing all events … I can’t find any support for using custom queries … thoughts or suggestions?

    http://wordpress.org/extend/plugins/the-events-calendar/

Viewing 4 replies - 1 through 4 (of 4 total)
  • um … nevermind guys

    haha … copy/paste stupidity

    Actually, back on. I fixed the problem above, but still both are showing all events.

    in case there’s any confusion, here’s the repaired code:

    <h1>Upcoming Events</h1>
    		<?php $upcoming_query = new WP_Query('cat=4&eventDisplay=upcoming'); ?>
    			<?php while ($upcoming_query->have_posts()) : $upcoming_query->the_post(); ?>
    				<div class="post" id="post-<?php the_ID(); ?>">
    				<h3><?php the_title(); ?></h3>
    				<div class="entry">
    				<span class="the-date"><?php echo the_event_start_date(); ?></span>
    				<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    				</div>
    			<?php endwhile; ?>
    	<h1>Past Events</h1>
    		<?php $past_query = new WP_Query('cat=4&eventDisplay=past'); ?>
    			<?php while ($past_query->have_posts()) : $past_query->the_post(); ?>
    				<div class="post" id="post-<?php the_ID(); ?>">
    				<h3><?php the_title(); ?></h3>
    				<div class="entry">
    				<span class="the-date"><?php echo the_event_start_date(); ?></span>
    				<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    				</div>
    			<?php endwhile; ?>

    Thanks in advance.

    Ok. So, just in case anyone else runs into this problem. I figured it out. It doesn’t work if you use a query object. So just query_posts(etc…) and you’re fine.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: The Events Calendar] Querying for Upcoming and Past events: both showing all events’ is closed to new replies.