WordPress.org

Forums

Events Calendar
Show Events Date Issue (1 post)

  1. masok88
    Member
    Posted 4 years ago #

    Hi,

    I've currently got a part of my home page showing 4 upcoming events, I want it to show the events closest to todays date.. and it is apart from their the events furthest from todays date it seems.. heres the code.

    <?php
    			$todaysDate = date('Y-m-d G:i:s');
    			$cal_query = new wp_query('post_type=sp_events&posts_per_page=4&order=aesc&meta_key=_EventStartDate&meta_compare=>=&meta_value='.$todaysDate.'');
    			while ($cal_query->have_posts()) : $cal_query->the_post(); ?>
    					<li>
    						<span class="date"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo sp_get_start_date( null, false ); ?></a></span>
    						<p class="aggregator-entry"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php if (strlen($post->post_title) > 38) {
    echo substr(the_title($before = '', $after = '', FALSE), 0, 38) . '...'; } else {
    the_title();
    } ?></a></p>
    					</li>
    				<?php $alt = ( empty( $alt ) ) ? ' alt' : '';?>
    					<?php endwhile; // posts ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic