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
- Using multiple variables to assign categories to an array
- Search.php gets metadata from first post
- Compare current post Category in select menu
- Get category id when SEO URL is turned on
- How to create Loop code for Menu using WordPress?
- Add class to every other posts using get_posts
- the_post(); prints out style text into my HTML?
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Problem in replacing the_content with the_excerpt()
- Show the categories the current post has
- Get the list of post categories
- Search AJAX Filters – Multiple Query Loops Into One Loop (Optimization)
- Wp Query : Order by distance lat,lon
- Remove Custom Post Category In WordPress Slug Using .Htaccess
- Display Sibling WooCommerce Product Categories on Archive Page
- Pagination at category doesnt work with same name of page
- Woocommerce. Get a list of products in the current category on the archive page and product page
- Counting number of posts in multiple (sub)categories using shortcode
- Wrong Number of Products When Hiding Subcategory Products From Showing In Parent Category
- How to show categories and date on posts
- display the months of a specific category
- I need to display posts in subcategory beside posts in main category
- Add Custom Category Description When Empty
- Order category posts by last word of custom field
- How to Add a cutsom slug to my custom author role
- How do I get pagination for get_posts() in WordPress or do I have to rewrite the whole code?
- How do I edit the terms output args or array data?
- Add a product category to a specific product via a button
- List sub categories and corresponding posts of a parent category
- Give ID to divs inside the loop
- Add a “custom field” to a category that can be retrieved when viewing the category page with get_post_meta
- Change category thumbnail size
- Allow two posts (from different categories) to have the same slug
- Get main parent category for post (WordPress/Advanced Custom Fields)
- Dropdown category field inside repeatable metabox
- Get nice name of category from slug (remove dashes of category)
- Products listing check if meta checkbox is checked
- Pagination contents not changing in Front page WordPress
- Display Visual Composer shortcode if a post belongs in specific categories
- Display articles with a different template in the home page | Solved |
- in_array not working on dev server but works on localhost
- How to Create Carousel Indicators in PHP Loop using wp_get_attachment_url function?
- How to output the taxonomies that are assigned to each custom post?
- Child-Theme Category View with modified permalinks (%category% removed)
- Get title of page containing post grid within the posts
- Check if current post in loop is last on current page
- admin panel – How to remove “delete” button from category editing page
- update_user_meta as multiple value but with same meta key
- Category Page Displaying all Pages
- Is there anyway I can call the year once?
- Get parent category name when only child category is applied to a product
- How to move a post from one category to another
- How to enable HTML tags in category description without breaking the category page
- Display all categories including sub categories under a list ul
- Multiple Tag Filtering
- Responsive loop with 3 columns inside row then 2 columns
- Foreach Loop Of Post Types With Nested If Else If Not Completing Process
- Looping through dummy posts and showing them in the main index.php
- Where does php code to load data go?
- Trying to show the category of a post in the post display
- Create category after theme setup and modify the default one
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Link to index.php from home.php?
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- Custom Loop.php having a loop inside a loop
- How to Link to category titles if it is in the single post content?
- Polylang and template files
- How can i show specific Category List?
- Notice: Undefined variable
- ACF – Get ID of relationship field in flexible content
- cURL needing to loop through all “next_page”
- Display page content in different sections – based on page break block?
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- Hide a specific category title from displaying on site
- How to show category just on specific pages?
- Latest posts feed with a specific post always first
- Show the subcategory name based on current product
- Show subcategory name selected in specific category woocoommerce
- How to output values from a loop into a javascript array
- WordPress Ajax filter: Create two loops for different output styles?
- How to display sticky post always at the top (before regular post) in wordpress?