WordPress.org

Support

Support » How-To and Troubleshooting » How to show next future post?

How to show next future post?

  • Hi, I’ve been trying to find a solution for a problem I have. I need a loop that displays the next post from the actual date, I found this solution to make future posts actual publised posts:

    http://wordpress.org/support/topic/105447?replies=9

    It is for a website that promotes events, so, I’d like to add the next event at the top of the homepage as a post. I figure that the best way to do this is enabling future posts and playing with the publishing dates.

    Any sugestion?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Free cakes for help!

    :-p

    I’ve been searching for some info and I think I could play with some query_post with offset. Anyone there?

    It seems the status of the post will be set to future if its in the future & not to publish -so if its not published its not viewable (by non-logged in users)… or is it?

    I have edited query.php (starting at line 1083) to;

    if ( ('publish' != $status) ) {
    			 if ('future' == $status) {$this->is_preview = true;}else{
    				if ( ! is_user_logged_in() ) {
    					// User must be logged in to view unpublished posts.
    					$this->posts = array();
    				} else {
    					if ('draft' == $status) {
    						// User must have edit permissions on the draft to preview.
    						if (! current_user_can('edit_post', $this->posts[0]->ID)) {
    							$this->posts = array();
    						} else {
    							$this->is_preview = true;
    							$this->posts[0]->post_date = current_time('mysql');
    						}
    					}  else if ('future' == $status) {
    						$this->is_preview = true;
    						if (!current_user_can('edit_post', $this->posts[0]->ID)) {
    							$this->posts = array ( );
    						}
    					} else {
    						if (! current_user_can('read_post', $this->posts[0]->ID))
    							$this->posts = array();
    					}
    				}
    				}
    			}

    Future posts are now viewable by all when published and not by date

    Hope this helps

    Thanks for the reply! With your hack now I’m able to see the future posts even if I’m not logged in.

    Now the thing is that I need to show the next post to be published in the home, something like an “offset=-1” 🙂

    Is there a way to do this?

    I’m also trying to work out a similar mod – we’ve got future posts showing via modding posts.php and that might also the way to do it to show only some posts in the future.

    Something like –
    if post = (GMT <) and post count of posts GMT < with PUBLISH as status = 3 then set post status = future.

    Unfortunately I’m no coder but if someone could turn this into the right syntax it should/could/might work? Anyone?

    This might be of interest for a full solution :
    http://www.vincentprat.info/wordpress/2007/08/03/wordpress-future-post-bug/

    That links broken – can you relink or post the information here.
    Many thanks

    shacker

    @shacker

    Here’s a much better way to accomplish this:
    http://comox.textdrive.com/pipermail/wp-hackers/2007-November/016104.html

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to show next future post?’ is closed to new replies.
Skip to toolbar