It’s a bad use of Query you may look at this post
In this case use a secondary query with your own instance of WP Query. query_posts() is not recommanded here cause it overrides the main query.
<?php $args = array(
'post_type' => 'instrument',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
);
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) :
while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<div class="col-sm-2">
<a href="https://wordpress.stackexchange.com/questions/232360/<?php the_permalink(); ?>">
<?php the_post_thumbnail( 'medium' ); ?>
</a>
</div><!--.col-sm-2-->
<?php endwhile;
wp_reset_postdata();
endif; ?>
Related Posts:
- Get custom post type by category in a page template
- How do you output custom code between posts in the loop?
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Weird problem happening with custom taxonmy when creating/updating posts
- List custom taxonomy specific to one custom post type
- Control content before and after custom post type loop
- Creating a non-hierarchical Taxonomy that behaves like categories
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- How do I ensure that post_type and Taxonomy use the same slug?
- Combine multiple separate lists into one
- Show parent category and subcategory once in while loop
- CPT: multiple loops with different terms
- Add active class to foundation 6 tabs while looping categories
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- WordPress Custom Post Type and sort by Tags
- Order by custom field attribute
- Looping taxonomy in taxonomy?
- Inserting two categories
- Display all posts in a custom post type, grouped by a custom taxonomy
- How do I append multiple taxonomies to the URL?
- WordPress Custom Post Types with a page as a parent?
- Get Custom Taxonomy ID within loop
- Custom post status not working
- Custom Taxonomy with Custom Post Type Finds No Posts
- Associating an “author” with a custom taxonomy
- TV Show database – Best way for structuring it?
- Correct way to use a form to to filter custom posts by taxonomy terms?
- Showing current taxonomy terms
- Categories under custom post types doesn’t show properly
- Order custom posts by taxonomy?
- Ajax filter with custom taxonomies
- Show ACF field from custom taxonomy and display on the single template
- How to append element after thumbnail
- Best practice for adding posts in bulk
- ‘category__and’ for custom taxonomy?
- WP 3.1 getting tax_query to work in query_posts()
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- List terms from Custom Taxonomy
- Impossible to get Attachments Outside WordPress?
- Programmatically adding posts
- Keep main articles and author blogs seprerate, News / Magazine like site
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- Why is my custom loop not filtering correctly nor paginating?
- Custom post types with custom directories
- WP_Query search posts by custom post type and custom taxonomy
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Display custom field of specific post where post title matches variable
- How to customize admin posts based on the user who is logged in
- Show Two custom Post type and their posts on category page
- wp_query to find posts by year and month
- How to create an advanced filter search?
- Create a random unique 6 digit number as custom field for custom post type
- How to output wordpress custom tags separated by comma?
- Custom Post Type Loop within Shortcode
- How to insert content from another Custom Post type into Post?
- Get rewrite slug of custom post type in template
- get_template_part for each level of taxonomy term
- Filter by custom taxonomy slug on a custom post type
- Normal pages as children of my Custom Post Type
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Only show posts from a certain category?
- Very Slow Page – How to Optimize # of Queries?
- Display CPT posts based on specific taxonomy
- How to display selected taxonomies by their parent
- Custom Field Order by Last Name and First Name
- get_posts of Custom Post Type AND Custom Taxonomy
- WordPress Genesis custom taxonomy archive shows 3 repeats of each post
- Custom Post Type Loop throws 500 error when used in widget
- Am unable to reset a query properly
- get_attached_media() on author page not working
- Received nothing after executing AJAX post function
- How to make sure content doesn’t display if selection is empty
- How to customize a permalink (URL) structure?
- CPT + CMB2: data not displaying for only first post in loop
- Get next and previous 3 posts in a term in single post page
- Get custom post type list for every category shortcode
- Loop custom taxonomy to get lists of cutom post types?
- How do i calculate the total of values of custom fields in custom post types?
- Custom loop with multiple taxonomy queries
- I would like to have different styles for my posts based on the content of each post
- Checking if Post Title is Unique as Loop Criteria
- Custom post type multiple loop by taxonomy term
- A question on creating filters for custom posts using taxonomy
- Conditional Query of Custom Post Type and custom taxonomy
- Show a Category X’s custom post type on Category X archive page?
- Custom Tag Description unable to display just below and outside of the Loop
- How do I move/order posts with a tag to the end?
- Display all taxonomy terms, add class if term applies to current post
- WordPress sort search results by custom order
- Return the latest post from a custom Taxonomy and Post Type
- 404 error when navigating to a taxonomy page with Cyrillic, what’s wrong?
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Hide parent categories when clicked, and show it’s childs
- Group CPT posts by custom taxonomy
- How to start a new post with custom Taxonomies already set?
- What’s the WP way to load remaining custom posts?