Finally solved it! I needed to add this at the end of each loop 🙂
<?php $my_query = new WP_Query(array( 'category_name' => get_post_meta($post->ID, 'featured', true), 'posts_per_page' => 5, )); if ($my_query->have_posts()): ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?> content etc goes here
<?php endwhile; ?> <?php endif; ?><?php wp_reset_query(); ?>
many thanks
James
Related Posts:
- Return category slug / title from category ID
- Get posts from sites in Multisite?
- How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
- Order get_terms() By Custom Field
- get_field not displaying my custom field value
- Using categories & “stickyness” together
- Does the ‘cat’ argument in query_posts fetch posts from subcategories as well as the given ID?
- List posts by category exclude current post
- Add extra fields to Add New Category page
- Need help adding custom field to category
- adding custom fields to next and previous post link
- Display only the latest post from multiple categories
- Custom query with category exclusion and post-meta “whitelist”
- Sort category page with custom field
- Create a full width responsive header image per page
- Select category in custom query
- Display one latest post from multiple categories
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- Filter out posts before display category count
- Exclude category from loop not working
- How to put enctype=”multipart/form-data” in categories form?
- “NOT ONLY IN” taxonomy query operator?
- Add custom taxonomy under the category title
- Query posts by category AND custom field, then ORDERBY another custom field – help!
- Post count for category and tag
- Checking for two categories in query_posts
- How to query post like normal search would do. within search.php page
- How to call custom category field data in theme?
- Query Posts Exclude Entire Category
- query in category.php repeats itself
- how to query posts and auto assign category if post title has keyword
- How do I call posts with a certain tag?
- How to select posts from multiple categories and metavalues?
- Modify WordPress SQL Query to pull from within a category
- query order by category
- need to add custom field in more products
- Retrieving category’s color with get_term_meta
- How to change a post category when the ACF datepicker Field is today
- Get link which associated with a specific category and tag
- Listing Texts of Which Custom Field is Null
- How to “group” (categorize) the Pages together?
- Order by category titles
- Have parent category contain only one post?
- List posts in alphabetical order
- How to query categories with Advanced Custom Fields?
- Randomly load categories with latest post
- Set colors depending on category
- How do I query_posts in cat=1 AND not in cat=2
- List all posts in a category with query_post() function
- query_post order desc
- Exclude a category from a query that includes its parent category
- How to add custom color fields to the category edit page?
- Notice: Trying to get property of non-object in : custom fields category
- Show the latest post from child category?
- Pagination on category.php and tag.php not working
- Problem with different query loops (and “main loop”) on category template page!
- query_posts not reading correct categories
- Pagination for query_posts();
- echo get_post_meta of all post in a category to fill up a select field
- “Virtual category page” based on a custom field filter
- Posts from a category on homepage with category archieves page default css
- function query_posts disabling current_page_menu class
- query_posts by category_name and custom taxonomy
- ACF no print data [closed]
- Displaying a custom field in Category Archives
- wordpress taxonomy query posts
- Assign a custom post to a custom taxonomy based on custom field value
- PHP dynamical conditional post display
- Posts of specific category on page and excluded from index.htm
- new WP_Query issues
- how can i hide category?
- Displaying links to all posts of the same category on the post page
- Post not found when filtered by category ID
- Custom Fields Value As Taxonomy
- Update custom category fields front-end
- Exclude categories from postquery
- What is the best way to add an advanced / intermediate / beginner tag to a post
- Sort posts alphabetically by category/custom taxonomy, insert divider between different types
- query_post problem
- Add class to current post in query_post
- Adding tinymce to Custom Field boxes on Category edit page
- How can i add service category here? [duplicate]
- Different post slug based on archive
- Sort categories by custom field in WordPress admin
- Modifying category order
- Displaying data from custom fields on a specific category page
- How can I add different custom fields for each category in the same post?
- How to display custom fields as table in Woocommerce
- How to modify custom category field from front end?
- Ajax Category add doesn’t update the list table custom column
- Pagination does not work with query_posts()
- Assign a class to first element in category in loop
- How to display products with multiple conditions, product_id and category_id
- How to Manage and link certain custom taxonomy?
- Custom field picture instead of post thumbnail on category page
- How to loop through a custom field for each post, & display?
- Query post only from categories that have subcategories
- $args Orderby The number
- ACF plugin categories bug in WordPress 3.9
- Formating content in category.php