As Toscho mentionned above, you didn’t close your if
and while
. When in doubt, indent your codes to avoid confusion.
$my_query = new WP_Query( $args );
if ($my_query->have_posts()) :
while($my_query->have_posts()) :
$my_query->the_post();
endwhile;
endif;
wp_reset_postdata();
/* The 2nd Query (without global var) */
$query2 = new WP_Query( $args2 );
// The 2nd Loop
if ($query2->have_posts()) :
while($query2->have_posts()) :
$query2->the_post();
endwhile;
endif;
wp_reset_postdata();
Also, you don’t need to use wp_reset_query()
with WP_Query. This question deals with that issue.
Related Posts:
- How do I exclude a custom taxonomy from the post loop
- display posts with same taxonomy term
- Including all terms in wordpress tax_query
- Display one post from each term in a custom taxonomy [closed]
- Exclude taxonomy term from all loops, but having it on widget
- Using WP_Query and Query_post for the loop?
- Custom Taxonomy + JQuery Tabs
- Loop posts without any taxonomy
- Query custom taxonomy by term id?
- If Custom Taxonomy
- How can I reduce amount of ifs and else ifs in this specific block of code?
- Returning One custom taxonomy term name
- When filtering query on custom taxonomy; main menu dissapears
- Why can’t I use an array of term slugs in WP_Query?
- wp_query not resetting, last post hanging
- Problem with wordpress pagination
- How to do a particular wp_query taxonomy search
- Why isn’t the ‘no results’ being shown when a query returns no results?
- Reverse order of posts in a certain taxonomy archive?
- display posts of custom post type with custom taxonomy
- Loop to display ONLY custom taxonomy parent information [closed]
- Check if a post has term inside loop
- Loop through custom taxanomy in post and display custom fields from posts
- Query Posts that have Custom Taxonomy
- Query Taxonomy By Page Title
- List all Custom Post Type posts excluding certain Taxnomy term
- pre_get_posts post_meta event
- Wp_query…a type of term a different div
- check if a taxnomy queried in $wp_query?
- Taxonomy.php how to show post only in current taxonomy with wp_query?
- WP_Query tax_query – Show results if child has parent X
- Query custom taxonomy for category including children
- List terms of custom taxonomy if matches other taxonomy
- Proper way to create taxonomy queries
- how to use tax_query to apply both terms or one if one is empty
- Get current page term title to use in WP_Query
- passing moree than one value of slugs in taxonomy using variable
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Only display latest custom taxonomy post
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Template file renders on local install, not on web
- how to get the post id in the option tag
- How to get the term description in a taxonomy term archive query?
- Chaining Taxonomy Queries
- Need equivalent of single_term_slug
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- What is the most efficient way to execute recursive complex queries?
- Problem with sorting in custom child taxonomy archive page
- is there a way of getting term children that only shows those from two taxonomies
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Main query disturb pre_get_post by category query
- display ACF repater field in archive page
- How to add a shortcode function that returns the taxonomy slug of the actual post within the loop
- How do I stop the same post showing multiple times in a archive?
- Group posts in a category based on tags in custom taxonomy
- How to loop custom posts that have an exact match in taxonomy terms?
- How to show category list in WordPress
- Get post meta value outside of the loop
- ACF – Get unique values of array
- Remove Custom metabox from particular page template is used
- Custom taxonomy shows full articles
- Change the Page Title of the Archive Page for Portfolio Tags
- Is it possible to sort the post based on a custom field?
- Output slugs to use as class names for every taxonomy a post is attached to
- Custom post types not displaying per category
- Multi level archive
- List active taxonomy terms
- index.php Not Showing Custom Posts / Terms
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- sort Posts by custom user filed
- Loop with Custom Post Type and Taxonomies
- How to get name of custom taxonomy
- Query pages by child term
- Post data in separate divs with incrementing class using WP_Query
- Custom post type archive organized by category
- How do you move custom fields to custom taxonomies using WP Queries
- WordPress hiding posts without content on custom taxonomy query. How to solve?
- Run next query based on first query’s term
- Query Number of Loaded Posts in Loop
- Get the original menu item name string instead of the label
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Order posts with custom taxonomy array
- Trying to achieve row posts below category with multiple loops in custom tax
- Getting grandchildren of a post with a specified custom taxonomy?
- Taxonomy Parameters in WP Query to get posts from two different taxonomies
- WordPress show posts from children terms of a taxonomy term
- Advanced AND tax_query in sidebar with 2 taxonomies
- stdClass::$labels /wp-includes/general-template.php undefined
- How to query posts that are not related to any term of a taxonomy?
- Using wp_query is it possible to orderby taxonomy?
- Using post type archive page for taxonomy archive
- How to limit posts to 1 from each term with tax_query?
- Catergory args causing loop not to show
- Loop custom post type by taxonomy (Category)
- Get custom taxonomy value of post and output posts in same taxonomy
- display custom post type from register taxonomy
- tax_query not working properly with get_posts
- add_rewrite_rule pagination 404 error on page 4 and above
- How do I create a term for every value of a post meta?