This is my own solution, improvements welcome 🙂
Check for term ID and assign to variable.
$term_id = (has_term('activity_1','activity-tax') ? 1 : (has_term('activity_2','activity-tax') ? 2 : (has_term('activity_3','activity-tax') ? 3 : '')));
Use term ID variable in my get_posts parameters.
$args = array(
'post_type' => 'activity-post',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'activity-tax',
'field' => 'term_id',
'terms' => $term_id) // Only the ID I want
)
);
$posts = get_posts($args);
Run over each post and create a Multiple Array of Meta Data.
$custom_post = array();
foreach ($posts as $post) {
$custom_post[] = get_post_custom($post->ID);
}
Finally get the array’s meta data I want.
foreach ( $custom_post as $key => $value ) {
echo $value['date'][0].'<br />';
echo $value['duration'][0].'<br />';
echo $value['paypal'][0];
}
Related Posts:
- Advanced search form with filters for custom taxonomies and custom fields
- Custom Meta Boxes – Nonce Issue – Move to trash issue
- Show metabox in custom-post-template depending on taxonomy term?
- Displaying Metabox value (custom post type taxonomy)
- How can I display my custom metaboxes on a custom post template?
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- Count posts with specific term_meta
- Does WordPress limit the length of slug names for Post Meta or Terms?
- How to duplicate entire custom post type
- Metabox not show in categories custom post type cmb2
- Display different information of a custom post type
- Filter posts by tax (dropdown) and meta value
- how to show records that don’t have custom meta value
- best way to use custom taxonomy, post type and meta in a job system
- WordPress CPT Taxonomy Dashboard Search – How to include taxonomy in search?
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Should I use a custom taxonomy or custom post type for grouping a list of panels associated with a group of tests?
- Saving Child Terms on front end not setting parent
- Order posts by meta value hiding posts instead of re-ordering
- Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
- WordPress custom post type
- Values inside a custom field to determine which category posts to display
- Advanced search form with filters for custom taxonomies and custom fields
- Automatically add custom taxonomy when meta value gets to a set number or beyond
- Meta query with boolean true/false value
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Combining Multiple Taxonomies in one URL
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Two Custom Post Types, Share Two Taxonomies
- How do I remove all the metaboxes for a custom post type?
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- ‘No pages found’ in Dashboard after registering custom taxonomy
- Querying Posts by Taxonomy From Alternate Network Site
- How to display recent posts added in custom post types
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- Permalinks when filtering multiple custom post types by single taxonomy
- Filter custom post type archive page with custom taxonomies (categories) with AJAX
- How-to leverage WordPress for creating Extended Social Profiles
- How can I filter by taxonomy on a custom post type’s page?
- How To Create A Custom Taxonomy 404 Page
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- Query Multiple Taxominies Across Multiple Post type’s
- Custom Post hierarchical to custom taxonomy
- Loop custom taxonomy to get lists of cutom post types?
- Conditional Query of Custom Post Type and custom taxonomy
- Is $object_type truly required with register_taxonomy()?
- Specific query for custom post type
- Suggested Post and Taxonomy structure
- Display post content with respect to its title?
- Use custom walker to add taxonomy terms to main nav menu
- WP_Query orderby and tax_query
- Show fields based on taxonomy selection in editor
- Permalinks: custom structure for taxonomy – tags?
- Creating custom post type with custom taxonomy and custom fields programatically
- Disable custom taxonomy on admin bar
- how to get this tax_query working?
- How to see posts in taxonomy endpoint
- Add term slug in URL of custom post type details page
- Custom post type and custom taxonomy 404 on page 2
- Ideas on how to organize a project [closed]
- How should I structure complex content hierarchies?
- Querying two different post types with the same taxonomony
- Get all metadata for a given custom post type
- Arduous WordPress Custom Post Type Permalink Path
- Convert Custom Taxonomy Posts to Normal Posts
- Advanced custom field – posted fields from custom post type
- Function to return values from metabox
- Add a meta field to the list of results for a custom post type
- Order custom posts by taxonomy, then by meta_key
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- Custom fields for post or terms which don’t update on post update
- set object terms after some some time of published post – functions.php
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- How to use multiple Meta Field from CPT as Post permalink
- Display custom post types in dropdown with option “all”
- How to select custom posts thats are tagged with multiple taxonomies using wpdb
- Posts per Page on custom Taxonomy Template
- Set up Custom Taxonomy Archive Template File To Cover 3 Categories
- Taxonomy shows up twice on Custom Post Type
- Custom fields for taxonomies with custom value for each post
- Custom Post Type / Taxonomy / Term – what template to use to avoid 404-page?
- How to get post detail based on URL of the post
- Back, Next, and Previous links for the REFERRING term archive
- Query posts by multiple custom fields
- If custom taxonomy exist on post?
- Pagination not working (page/2 retunring 404 page)
- Get category list & taxonomy list from different post type using post id?
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- WordPress add taxonomies/terms list as a menu in archive page
- Custom post type based on existing one
- How to add base permalink to custom posts?
- How to add post reference field to a plugin?
- Add different meta box based on taxonomy
- Parent cpt/child custom post type URL permalink relationship
- Query Only Show Text on Posts With Certain Taxonomy Tag
- How to make a single Menu Item call another Mega Menu for Custom Post Types and Custom Taxonomies?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- Problem with shortcode