I have created a custom post type. The idea is that the posts from this custom post type will be displayed in the header of the home page, outside of the loop.
In my home page header file I have something like the following:
$type = 'home_page_header_posts'; $args = array('post_type' => $type, 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1, 'orderby' => 'menu_order', 'order' => 'ASC'); $query = new WP_Query($args);
Then I have a loop to loop through these posts and display them.
The problem is that when the main content is displayed, instead of showing the home page content what is shown is the content from the first post in my custom post type.
I have tried every thing I can find about how to reset the query and show the correct post.
ie: wp_reset_query, wp_wp_reset_postdata, I have tried reseting it and not reseting it as I saw that idea somewhere in my search. So I have tried all of the available methods that I can find, still nothing. I cannot get the correct page to display.
- The topic ‘Showing wrong page after querying custom post type’ is closed to new replies.