WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: The Events Calendar] Querying for Upcoming and Past events: both showing all events (5 posts)

  1. agillette
    Member
    Posted 4 years ago #

    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/

  2. agillette
    Member
    Posted 4 years ago #

    um ... nevermind guys

    haha ... copy/paste stupidity

  3. agillette
    Member
    Posted 4 years ago #

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

  4. agillette
    Member
    Posted 4 years ago #

    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.

  5. agillette
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic