Support » Fixing WordPress » Displaying Future/Scheduled Posts

  • I would like to display a number of posts where they are set to occur in the future, i.e. write and post-date an entry by editing the timestamp – which then adds it to scheduled entries in the dashboard – and then have it show up already in my “events” page without waiting for the post’s timestamp to be exceeded and the scheduled post posted.

    How can I accomplish this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Jeremy Clark

    (@jeremyclark13)

    Member

    Maybe this plugin will do what you want. I’m assuming this is for a band or something like that.
    http://wordpress.org/extend/plugins/gigpress/

    I also use wordpress as a calendar to display future events… To do so, I use this plugin :

    http://wordpress.org/extend/plugins/the-future-is-now/

    It works well and it’s very light.

    You can also tweek your loop in your category page to stop display posts when the events are done… I found this piece code on this forum and it works well…

    <?php
    $now = current_time('mysql');
    $future_posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date > '$now' ORDER BY post_date ASC");
    
    if($future_posts) : foreach($future_posts as $post) : setup_postdata($post);
    
    ?>

    — DO YOUR STUFF (date, title, author, etc…) —

    <?php endforeach; ?>
    <?php endif; ?>

    Same thing with the RSS feed, it’s also possible to don’t send an event when it’s done.

    If you want some more information, just ask here… I use a standalone WP installation as a calendar. It’s also possible to tweak the archives to show future month, the calendar to highlight and link future dates, etc, etc…

    S.

    Thanks for those pointers, I’ll try them out.

    Hmm. That code snippet doesn’t work for me: it displays the new items, but three times, although it did hide the old ones.

    Where should the code go? This is my template:

    <?php get_header(); ?>
    
    <div id="container">
    <h2 class="post-title-single">Programme of Events</h2>
    	<div id="content" class="narrowcolumn">
    
    <?php $posts = query_posts( $query_string . '&orderby=date&order=asc' ); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    		<div id="post-<?php the_ID(); ?>" class="post">
    			<div class="post-container">
    				<div class="post-content">
    					<h2 class="post-title"><a href="<?php the_permalink() ?>" title="View the details for <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    					<div class="post-entry">
    						<?php the_content('<span class="more-link">Full meeting details &raquo;</span>'); ?>
    						<?php link_pages('<p style="margin:-1em 0 0 0;"><strong>Pages: ', '</strong></p>', 'number'); ?>
    						<!-- <?php trackback_rdf(); ?> -->
    					</div><!-- END POST-ENTRY -->
    				</div><!-- END POST-CONTENT  -->
    			</div><!-- END-CONTAINER -->
    			<div class="post-header">
    <h3 class="post-date">Event Type</h3>
    <!--                    <h3 class="post-date"><?php the_time('Y m d') ?></h3> -->
    				<p class="post-categories"><?php the_category('<br />') ?></p>
    <!--				<p class="post-comments"><?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); ?></p>
    				<p class="post-permalink"><a href="<?php the_permalink() ?>" title="Permalink to <?php the_title(); ?>" rel="permalink">Link</a></p> -->
    				<?php edit_post_link('Edit', '<p class="post-edit">', '</p>'); ?>
    			</div><!-- END POST-FOOTER -->
    		</div><!-- END POST -->
    <?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="nav-left"><?php next_posts_link('&laquo; Older posts') ?></div>
    			<div class="nav-right"><?php previous_posts_link('Newer posts &raquo;') ?></div>
    		</div><!-- END NAVIGATION -->
    
    <?php else : ?>
    
    		<div id="post-error" class="post single-post">
    			<h2 class="post-title-single">Not Found</h2>
    			<div class="post-entry">
    				<p>Apologies. But something you were looking for just can't be found. Please have a look around and try searching for what you're looking for.</p>
    			</div><!-- END POST-ENTRY  -->
    		</div><!-- END POST -->
    
    <?php endif; ?>
    </div><!-- END CONTENT -->
    </div><!-- END CONTAINER  -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    This is how I display future dates from my ‘Gigs’ category, without resorting to plugins or modifying core WP code …

    <?php
    $my_query = new WP_Query('category_name=gigs&post_status=future&order=ASC');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID;
    ?>

    Works in later versions of WP 2.xx.

    For full details …
    http://www.keithmillington.co.uk/wordpress/?p=22

    mrlive158

    (@mrlive158)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Displaying Future/Scheduled Posts’ is closed to new replies.