For a non-blogging project I’m working on I integrated WordPress into the website to use some of the functionality such as recent news and future dated events. I needed to display a list of future dated events with linked titles and the time left to the event in a sidebar. Similar to what you currently see in the WordPress Dashbord. I needed the post to display if the title permalink was clicked, but I didn’t want the post to display anywhere else such as categories or recent posts. WordPress by default does not allow the viewing of future dated posts.
Here’s how I created a fairly complete solution.
First I added the following code where I wanted the future dated events to display.
[php]
< ?php
$today = current_time('mysql', 1);
if ( $scheduled = $wpdb->get_results(”SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_date_gmt > ‘$today’”) ) :
echo “
3 Responses
AsceticMonk
April 15th, 2005 at 6:46 pm
1Cool! In some sense, it resembles to my recent plug-in Coming Soon, which is a plug-in to display drafts and accompanied with a progress meter.
Michael Moncur
April 16th, 2005 at 12:02 am
2Thanks for the link! I’m glad this plug-in is turning out to be useful to more people than just me.
Wordpress Cookbook View future posts
April 17th, 2005 at 9:30 am
3[...]
Further Information
Comments
The problem
http://www.bloggingpro.com/archives/2005/04/15/wordpress-plugin-view-future-posts/
The solution
http://www.bloggingpro.c [...]