WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
showing all or past events? (5 posts)

  1. oohtruck
    Member
    Posted 3 years ago #

    How can I show a list of my past events, or rather all the events? This is the code i'm currently using:

    <?php query_posts($query_string . '&category_name=events'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    		<?php if(the_event_start_date(null, false, mdY) >= date(mdY)) : ?>
    		<li class="event">
    			<?php if ( is_new_event_day() ) : ?><h4 class="event-day"><?php echo the_event_start_date( null, false ); ?></h4><?php endif; ?>
    			<div class="event-content">
    				<?php the_title('<h2 class="event-title"><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?>
    
    				<?php the_excerpt() ?>
    			</div>
    		</li>
    	<?php endif; ?>
    <?php endwhile; else: ?>
    	<p>No Events</p>
    <?php endif; ?>
  2. oohtruck
    Member
    Posted 3 years ago #

    anyone?

  3. oohtruck
    Member
    Posted 3 years ago #

    at all?

  4. ciaranm
    Member
    Posted 3 years ago #

    Hi There

    Try deleting this line:

    <?php if(the_event_start_date(null, false, mdY) >= date(mdY)) : ?>

    I seemed to work for me. I was using your code and trying to figure out how to list more than 2 events on my homepage here: http://darwinhub.com/

    Do you know how I could list more than 2 events? here is my code...

    <?php query_posts($query_string . '&category_name=events&showposts=5'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    		<?php if(the_event_start_date(null, false, mdY) >= date(mdY)) : ?>
    		<ul>
    			<div class="event-content">
    				<?php the_title('<div class="event-title"><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></div>'); ?>
                    <?php if ( is_new_event_day() ) : ?><div class="event-day"><?php echo the_event_start_date( null, false ); ?></div><?php endif; ?>
    			</div>
    		</ul>
    	<?php endif; ?>
    <?php endwhile; else: ?>
    	<p>Sorry, no events list. Got events coming up? List an event here.</p>
    <?php endif; ?>

    Thanks!

  5. oohtruck
    Member
    Posted 3 years ago #

    Not sure...

    I did delete the line you suggested though, and now it shows the only two events that are listed as "ongoing", but still not all of them.

    this is the code:

    <?php query_posts($query_string . '&category_name=events'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    		<?php if(the_event_start_date(null, false, mdY) >= date(mdY)) : ?>
    		<li class="event">
    			<?php if ( is_new_event_day() ) : ?><h4 class="event-day"><?php echo the_event_start_date( null, false ); ?></h4><?php endif; ?>
    			<div class="event-content">
    				<?php the_title('<h2 class="event-title"><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?>
    
    				<?php the_excerpt() ?>
    			</div>
    		</li>
    	<?php endif; ?>
    <?php endwhile; else: ?>
    	<p>No Events</p>
    <?php endif; ?>

    any ideas on how i can get ALL my old events to show up?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic