• Hey all.

    I was wondering if theres a way to make posts that are scheduled, but not live yet show as “Post not up yet” or something similar, rather than just showing the page not found.

    I want to link posts together ie: Click here for next weeks post
    but make it obvious that its not live yet so people dont message me about errors in the site because they cant “Find” the page when its just not out yet.

    Thanks for any help

Viewing 1 replies (of 1 total)
  • I like that idea. I coded it in a custom plugin, but I think the same code will probably work in a child theme’s functions.php file.

    This hastily written and barely tested sample code checks that WordPress is about to display a single post in the category news and with a future date. In that case it changes the status to publish to make WordPress display the post, and it changes the title and content of the post. The changes are not stored in the database.

    function ny_post_results ($posts) {
    	if (count($posts) == 1
    		&& in_category('news', $posts[0])
    		&& $posts[0]->post_status == 'future') {
    			$posts[0]->post_status = 'publish';
    			$posts[0]->post_title = '<span style="color: gray;">Not yet published</span>';
    			$posts[0]->post_content = 'The post you are looking for has not been published yet.';
    			}
    	return $posts;
    	}
    add_filter('posts_results', 'ny_post_results');
Viewing 1 replies (of 1 total)
  • The topic ‘Make scheduled posts show as "Not Live Yet" rather than "Not Found"?’ is closed to new replies.