• Hey guys.. I am needing to check to see what the next day is that does NOT have a post scheduled. I am using:

    http://pastebin.com/z66bjcqp

    And this works great…for published posts! Every other google search ive seen seems to imply this is OK and should show the posts..
    To clarify, I do NOT want to SHOW the posts, I only want to check to see if there is one scheduled for that day. My insert function is correctly scheduling the posts but I cannot find them!

    Any idea what Im doing wrong? Is this something I will need to use wpdb for?

    Thanks,
    Evan

Viewing 1 replies (of 1 total)
  • Thread Starter ohhai

    (@ohhai)

    Nevermind! Dissected a few plugins to see how others did it and got this..

    function findAvail() {
    
    		global $wpdb;
    		$posts = $wpdb->get_results("SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date DESC"); //need limit? add LIMIT 10
    
    	$day = $posts[0] -> post_date;
    	$freeDay = date("Y-m-d", strtotime($day. '+ 1 day'));  //Calculate next day with no scheduled post
    	return $freeDay; // Found it!
    }

    Hope it helps someone else! This was exactly what I was looking for.

Viewing 1 replies (of 1 total)
  • The topic ‘get_posts not showing future posts’ is closed to new replies.