Here is a correct way:
<div id="category__product-grid" class="row">
<?php query_posts( array( 'cat' => array(6,-45), 'post__not_in' => array(-598), 'orderby' => 'title', 'order' => 'ASC' ) ); ?>
<?php
// The Loop
while ( have_posts() ) : the_post(); ?>
<div class="col-md-4 col-product-item">
<a href="https://wordpress.stackexchange.com/questions/321415/<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><div class="cat__featured-img"><?php the_post_thumbnail(); ?></div></a>
<h2><a href="https://wordpress.stackexchange.com/questions/321415/<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
</div>
<?php endwhile;
else: ?>
<p>Sorry, no posts matched your criteria.</p>
</div>
Related Posts:
- How do I remove a category from a wordpress loop>
- Inject post (from specific category) between posts in Loop
- Alter secondary loop to exclude posts from current page category
- User Defined order on get_categories?
- Custom Loop through category menu to include sub categories
- How to exclude specific category from the get_the_category(); array
- Filter Select results based on selection
- Alert Bar section within WP loop is displaying even though there are no posts
- Display category name only once inside loop
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- How to get the last category name of a child category?
- How to get current post category details inside “loop”?
- Problem with custom loop and wp_list_pluck [closed]
- Echoing a CSS class based on category of post in a list
- Do not duplicate posts with multiple categories in multiple loops
- Return to the beginning of the results of a for loop
- Error trying import one category on page
- Remove the_content From Loop
- Exclude a category ID from the following function
- retrieve thumbnail from post ID of best selling product in category
- Custom HTML structure in wp_list_categories
- How to add active class to custom menu using while loop and wp_list_pages
- Print html when custom field has value inside while loop
- Categories Template Assistance
- Error: array_map(): Argument #2
- Problems with function on function.php
- Use template for posts with a particular category grandparent
- How do I display the function the_content in this loop?
- How to get to a specific position in wp_query?
- Display all categories including sub categories
- Facebook “like” open graph meta in header.php
- Custom category code not showing all posts
- Using foreach loop breaks
- Loop with slider (slider not loading)
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Displaying Woocommerce Product Category in WordPress
- How can I add extra word in permalink when someone click download button?
- Woocommerce : Can’t get product info in loop
- Setting default category base on theme activation
- Let Users Choose Post Categories
- List posts that don’t have a specific tag?
- Can we count the WordPress Loop
- Display most popular posts of category
- get taxonomy thumbnail and use it as a variable in code
- Normal PHP array for exclude section of WordPress query?
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Is the 404 page automatically displayed if a loop returns nothing?
- Last class on last headline?
- Only show size attributes in product box woocommerce when available
- use loop to return blog details
- Argument for if term-> have child?
- How to add post meta in while loop?
- Php code error in wordpress if else statements [closed]
- Showing Subcategory Name/Link Instead of Parent Category
- WordPress custom taxonomy
- pagination broken – clicking next displays “page not found”
- Finding and removing duplicates within WP Arrays
- Using multiple variables to assign categories to an array
- Compare current post Category in select menu
- Get the list of post categories
- Woocommerce. Get a list of products in the current category on the archive page and product page
- How to show categories and date on posts
- How do I get pagination for get_posts() in WordPress or do I have to rewrite the whole code?
- Add a “custom field” to a category that can be retrieved when viewing the category page with get_post_meta
- Allow two posts (from different categories) to have the same slug
- Check if current post in loop is last on current page
- How to enable HTML tags in category description without breaking the category page
- Trying to show the category of a post in the post display
- Create category after theme setup and modify the default one
- adding or removing endforeach; throws error!
- Adding PHP to an if else loop
- Accordion headings cuts off to second line on collapsing a accordion heading (used acf repeater)
- WordPress Recent Posts – Loop
- ACF background-color per post in a WordPress loop
- Advertisement in Loop Posts wordpress
- All categories options or All categories not Populating
- Displaying 3 Category Posts differently
- Adding custom PHP to existing loop in Genesis
- How to Pass Current Taxonomy Terms into new WP_Query?
- How to list categories by page id in wordpress
- WordPress using get_term to retreive slug not working as expected
- Showing the project type in HREF
- Loop returns more items than exist?
- Modify category archive page loop on functions.php
- Front end post submissions do not get submitted in the category
- WP_Post is not from correct array
- Post formating on Home page
- divide custom field values in div every two values
- Limit ads appearing more than three times
- Trying to exclude posts from a category on the home page
- Pagination on Custom Loop
- Showing Subcategory’s Name and Link Instead of Parent Category’s
- Custom single.php files for different post formats
- Troubleshooting “loopback requests that take too long”
- Why does a meta_query break this WP_Query?
- Remove /category/ from category (archive) page URLs (without using a plugin)
- Help with if/else loop [closed]