I would do this in two pieces.
-
Add this into your functions.php file to grab custom fields globally:
function get_custom_field($key, $echo = FALSE) { global $post; $custom_field = get_post_meta($post->ID, $key, true); if ($echo == FALSE) return $custom_field; echo $custom_field;
}
-
Build your query as follows:
I can’t seem to get markdown to play nice, so here’s the code in Pastie http://pastie.org/1294594
Related Posts:
- Get posts from sites in Multisite?
- Gutenberg editor add a custom category as wrapper for custom blocks
- How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
- How can I hide a category from Contributors in the edit/add new post screen?
- WordPress Multiple Category Search
- How to remove categories filter from wordpress admin?
- Decreasing the Memory Consumption of a WordPress Site?
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive
- How can I select a primary category?
- how to use a different domain/subdomain for authors/catagories on single site?
- Deleting default category in wordpress
- Delete a specific category when deleting a user
- 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
- How to list child categories in custom category template?
- Trash bin for categories
- How to set up sub-categories for author pages?
- View category in the preview of Theme Customizer
- Display only the latest post from multiple categories
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Block multiple categories from Blog
- How to have a static category/author page?
- Create single.php for specific category by category id
- Show posts of one category only with Custom Taxonomy on single.php
- Save metabox checkboxes values to custom content type
- Display one latest post from multiple categories
- Remove “Parent” Selection When Adding/Editing Categories?
- Return category slug / title from category ID
- Order Taxonomy Term by date created
- Apply custom category template to subcategories
- Hide post meta data on a specific category
- Exclude category from loop not working
- “NOT ONLY IN” taxonomy query operator?
- Format Brand value in Category view [closed]
- Add custom taxonomy under the category title
- How to show in search results posts with a particular tag in a particular category?
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- Remove ‘rel’ attributes from the_category() output
- Multiple menu items highlighted
- in_category() works in single.php but not in page.php?
- Use a wordpress page to display a certain category
- How to view WordPress’ default category IDs?
- Multiple Category Search
- How do I add a function on a specific post category?
- Query posts by category AND custom field, then ORDERBY another custom field – help!
- How to customize category template?
- Category-slug.php not being used
- Post count for category and tag
- How would I go about adding custom header images per category?
- Checking for two categories in query_posts
- How to query post like normal search would do. within search.php page
- Query Posts Exclude Entire Category
- 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?
- Automatically exclude categories from metabox based on title
- Modify WordPress SQL Query to pull from within a category
- query order by category
- Display posts separated by Category in Author’s page
- Get link which associated with a specific category and tag
- How to categorize posts under Category 1 and Category 2 which are separate lists of categories, and display them as separate lists in widgets
- How to organize custom categories for filtering and selecting
- Filtering *out* a taxonomy from the admin post list
- How to rewrite the post URL according to the category?
- How to build a simple nav system of custom post type categories and its posts?
- Order by category titles
- Have parent category contain only one post?
- List posts in alphabetical order
- Display thumbnails for certain category posts
- Keyword search in multiple categories
- Randomly load categories with latest post
- Is it possible to remove from default category widget?
- Set colors depending on category
- How do I query_posts in cat=1 AND not in cat=2
- How to customize my category pages
- 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 make the ‘delete’ button inactive on some categories?
- Show the latest post from child category?
- Two columns in homepage each with one 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();
- Multiple selection for wordpress widget
- Different CSS class by category
- how to nest specific category thumbnails inside different containers
- Wrong category nice name is displayed on archive page
- Posts from a category on homepage with category archieves page default css
- function query_posts disabling current_page_menu class
- How can i change what one category displays?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- query_posts by category_name and custom taxonomy
- How to let the user create a selection of categories via the backend
- Theme for subcategories
- Add code to header based on category for specific posts?
- How can I filter Query Loop to show only posts in current category?