WordPress.org

Ready to get started?Download WordPress

Forums

How to show next future post? (9 posts)

  1. RUDEWORKS
    Member
    Posted 7 years ago #

    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?

  2. RUDEWORKS
    Member
    Posted 7 years ago #

    Free cakes for help!

    :-p

  3. RUDEWORKS
    Member
    Posted 7 years ago #

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

  4. mattclegg
    Member
    Posted 7 years ago #

    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

  5. RUDEWORKS
    Member
    Posted 7 years ago #

    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?

  6. lotech
    Member
    Posted 6 years ago #

    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?

  7. Vincent Mimoun-Prat
    Member
    Posted 6 years ago #

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

  8. lotech
    Member
    Posted 6 years ago #

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

  9. shacker
    Member
    Posted 6 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic