WordPress.org

Ready to get started?Download WordPress

Forums

Posting forward events (3 posts)

  1. geofftswin
    Member
    Posted 5 years ago #

    OK,
    I can display events in the future, by either use of the "Future" in the code, or by adjusting the code to convert Future - Published.

    The former causes problems if not logged in, in that the links don't work.

    The latter option works, however, I cannot manage to get events that are now past to disappear.

    My code at present is:

    <?php
    global $post;
    $mpyposts = get_posts('numberposts=5&category=8&order=ASC');
    foreach ($mpyposts as $post):
    setup_postdata($post); ?>
    <li>
    <?php the_date(); ?><br />
    <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    </li>
    <?php endforeach; ?>

    I assume that I need an if function of the type
    IF the_date() > today THEN display entry ELSE do nothing

    but I cannot figure out how to get it to work - any ideas?

  2. Cristiano
    Member
    Posted 5 years ago #

    I need to do the same thing!

    There is some tag to get the "today" date in WP 2.7??

    Thanks!!

  3. Cristiano
    Member
    Posted 5 years ago #

    I tried:

    <?php if ( have_posts() && the_date() > time() ) : ?>

    Nothing happens...

Topic Closed

This topic has been closed to new replies.

About this Topic