In single-posttype.php, I’m doing a custom query before the regular
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>.
[please mark any code in your post – see http://codex.wordpress.org/Forum_Welcome#Posting_Code ]
Before the custom query, I clone the wp_query:
$temp = clone $wp_query;
After the custom query, I set it back and erase postdata:
<?php $my_query = null; $my_query = clone $temp; ?> <?php wp_reset_postdata(); ?>
But the detail post that should be showing shows all the posts that the first query (custom query) finds.
What am I doing wrong?
Thanks a lot for your time, much obliged!
- The topic ‘Custom query before default query in single-posttype.php’ is closed to new replies.