I have created a mailer template for my my single post.
I can view the mailer version of my post using a url variable ?mailer
I've configured the above using the code below within my single.php...
if ( isset($_GET["mailer"]) ) {
get_template_part( 'mailer/template', 'post' );
} else {
/**
* @package WordPress
* @subpackage Josh 2014
* @since MyTheme 1.0
*/
get_header();
Quite simple really.
I then use the get_permalink().'/?mailer'
which I then pass to campaign monitor to import my mailer template by url.
Within my mailer/template-single.php I use this the basic loop to pull in my post data.
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
?>
<!-- MY POST -->
<?php
endwhile;
endif;
?>
Everything above is working OK.
My problem I have ran into today is with scheduled posts.
I would like to be able to view my post still (when not logged in) in the mailer template only, and not on the website.
So I amended the code in my mailer template to this...
<?php
$args = array(
'post_status' => array('publish','pending','draft','future','private')
);
query_posts( $args );
if ( have_posts() ) :
while ( have_posts() ) : the_post();
?>
<!-- MY POST -->
<?php
endwhile;
endif;
?>
I then visited my scheduled post permalink with my mailer variable in a new browser where I am not logged in. And I just get 404 error on my site.
http://www.mywebsite.com/scheduled-test-post/?mailer
So I'm guessing my query_posts above is not working.
Does any one have any ideas in how to amend my query to show scheduled posts in my mailer template?