Try this
function cat_loop ($key){
$fashion_cat = array(
'category_name' => $key,
'posts_per_page' => 4,
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'post__not_in' => $already_posted,
'category__not_in' => $private_categories
);
// Add the loop.
}
cat_loop ('fashion');
cat_loop ('beauty');
cat_loop ('lifestyle');
put the loop in function which has variable for the category_name
and repeat it.
I hope this helps
Related Posts:
- Why is this coming back as null? Thats wrong. There is one post
- Two loops on archive page
- Check if loop has any categories?
- How to make search for posts using get method?
- Wp_query with 2 meta keys and array of meta values
- WP_QUERY wrong ammount of posts
- How to separate two columns from one content on a page template?
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- Second WP_Query loop shows data from main query
- active link for most recent post on vertical tabs
- Get author meta data with no published posts in author.php?
- Some doubts about how the main query and the custom query works in this custom theme?
- Using a custom WP_Query with get_template_part loop
- Loop within a loop?
- Use WP_Query with have_posts()?
- WP_Query for WooCommerce Products
- Display posts the match taxonomy term linked from wp_list_categoies?
- Merging a complex query with post_rewind and splitting posts into two columns
- Pagination Not working on Home Page with 2 Query
- meta_query not working properly
- Exclude post on loop by multiple meta key value
- Two queries on the same page with pagination
- Sort by meta key on archive page
- How to display 3 different loops in 3 columns on homepage
- Query sticky posts with thumbnails
- Show all parents and children in custom post type in right order
- Ignore post by meta value in the main query
- How to display future posts – modified query still yields 404
- WP_Query to get posts in a specific category and post format
- Can’t get drafts with WP_Query using post_status parameter
- How to retrieve current page WP_Query arguments?
- Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?
- How to limit WP_Query to one result on the loop?
- Sticky posts are not showing at the top of category posts
- Random loop with code to prevent duplicate output returns no output at all from time to time
- Storing query variable and then using wp_reset_query
- How to use offset in WP_Query
- Multiple loops without repeating content
- Group and list posts by custom taxonomy
- Show scheduled posts in main loop but not in WP_Query?
- Change query based on post type while staying in loop
- Filtering posts from different categories into different section by doing WP_Query only once
- Import wp users via one click demo option
- Get a list of posts with associated meta_value
- $WP_Query: How to display excerpt on first post only
- Custom taxonomy.php not working
- different for loop if screen resolution < 1000px
- Transient api Caches confused
- get_template_part causes 500 error
- sort and display posts by custom field (wp-query and the loop))
- WP_Query – Adding “offset” posts to the end of the loop
- wp_query is showing posts from other categories
- inserting content of 1 Post to in another with a template hierarchy
- how to handle the loop using filling bootstrap grid structure?
- Pagination for custom loop on custom page template is not displaying anything
- Filtering by multiple conditions in the loop
- How to access $wp_query object from array of posts given by get_posts?
- Display all attached image of every post of custom post type and link to original post
- wp-query, pull children of parent page
- I am officially missing something about transient posts
- Advise on Templates for Custom Queries
- How do I get the content of a custom instance of WP_Query?
- Query WP Page for Buddypress Group Home [closed]
- Using Ajax and WP_Query to load more posts on category page fails
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Show a message if there are no active posts in category
- Avoid removing duplicate posts
- Problem with my loops
- Repeat array inside array through while loop
- What’s causing an infinite loop?
- display the children of the post using the current page as the main parent
- Display 3 levels of categories on page
- Paging works correctly on local version, but not live?
- pages shortcode filtering by category
- Custom post type loop error: Trying to get property of non-object
- Meta Query if Values Don’t Exist
- Get post Number with local loop and template
- How to order posts, that have already been filtered by custom taxonomy, by their category names?
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Display three sequential posts on each page load, without repeating previous
- How to make a wordpress loop file that displays posts based on certain conditions
- Custom Theme Building & Permalinks
- Problems with WP_Query, Loop, a condition and Posts per Page
- WP_Query secondary query failing
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Issue in If else condition [closed]
- Pagination not working with WP_QUERY
- Custom search (wp query by custom fields)
- How do I display posts with specific value in a custom field into my loop?
- Limit the number of posts from a specific category on index.php
- Order by multiple meta keys on wordpress
- wp_query pagination links producing 404
- Display First posts without the default featured image
- Pagination problem with multiple loops on the same page
- Query for page content, and query for posts on the same page?
- Can’t seem to get an else statement correct? [closed]
- Output ACF field dynamicaly within a taxonomy loop [closed]
- How do I split a large query with a semi-expensive function included into multiple smaller queries
- Pagination only showed when no category is set in wp_query