Hi,
The PHP is working fine, it’s your actual query that is wrong. I have tested the PHP is working, you can see it outputs my text test
.
I would advise you strongly to not use query_posts
, I would build the post query using WP Query. Ref: https://codex.wordpress.org/Class_Reference/WP_Query. The query will need to be reset after the while loop, wp_reset_postdata();
.
If you need help building the query using WP_Query
, please use this as an example for future posts:
// WP_Query arguments
$args = array (
'post_type' => array( 'post' ),
'post_status' => array( 'future' ),
);
// The Query
$custom_query = new WP_Query( $args );
// The Loop
if ( $custom_query->have_posts() ) {
while ( $custom_query->have_posts() ) {
$custom_query->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
Thanks,
David.