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
- Custom post type and custom taxonomy with the same slug using the file page taxonomy only as directory
- What is the best practice for displaying my plugin content in themes?
- Categorize custom post type
- WordPress request fiter order by related post’s post_title
- How do I display the taxonomy for a custom post type in an array
- Pretty URL for custom search for custom post type
- Custom taxonomy rewrite with query var returns %2F in URL
- WP Rewrite Rule Issue while using Custom post type & taxonomy
- How to list custom taxonomies in the back end
- Several CPT’s with same Taxonomy name but with different Terms for each
- Remove slug in URL custom post type
- Custom Permalinks with CPT and Hierarchical Taxonomies
- How to conditionally redirect to the post from a taxonomy page?
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- Sort and filter custom post type posts by custom taxonomy
- How do I display the grand child items of a taxonomy term?
- How to edit this code to get the categories in achieve page?
- Taxonomies relations
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Get general taxonomy name for a Custom Post Type
- Display Custom Taxonomy Alphabetically
- Import data from CSV with custom taxomony empty
- WordPress uses url different from defined in rewrite arg of custom post type
- Custom Post Type Loop with Query Var
- Full Custom Post Type List Organised by two Taxonomies
- Is it possible to use have_posts function to list custom post type posts inside a category?
- WordPress Doesn’t Generate Taxonomy Archive
- URL rewriting for CTP assigned entity
- How to have this permalink structure: post_type/postname/custom_inner_page
- Suggested Post and Taxonomy structure
- How do I require the specification of term in a custom post type and custom taxonomy?
- Custom Post, set object Taxonomy terms in plugin
- Query Custom Post Type Taxonomy term with multiple parameters
- Display post content with respect to its title?
- Hierarchy and access control for Custom Post Types (CPT)
- Update database from Quick Edit according to Checkbox state of Custom Post Type
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Auto Complete Search
- Custom Post Type Pagination Paginates Only in URL Structure
- Set post terms for multiple posts
- Load Custom_post_type categories post with ajax
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
- Custom taxonomy returns 404
- Get terms that contain posts that in turn belong to other terms?
- WP-API select custom taxonomy when creating a post
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- First custom field value (out of several) displayed twice after query
- Custom post with more than one custom taxonomy
- Dynamic Custom Fields
- How to get custom posts sub category link
- Custom while loop for hierarchical display of a taxonomy
- Terms showing up in object cache on unrelated pages
- Show Custom Post Type meta boxes only on Page Edit
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Get the taxonomy of a post hierarchically
- Adding custom taxonomy in same menu place with two custom post types
- How to make custom taxonomy into drop down select in a custom metabox
- Including taxonomy term before post type breaks top level pages
- Correct procedure for advanced permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- List Taxonomy Terms based on another Taxonomy
- How to get the intersection of two terms both from different custom taxonomies
- CPT’s with landing page instead of archive – Url Rewrite?
- Template for all categories of a custom post type?
- How to change permalink to include custom post type
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- posttype/taxonomy/term archive page 404 error
- How to add attributes to taxonomies that may be different from post to post?
- Display taxonomy terms, child terms and posts in a template
- Custom filter function not working with Custom post type
- Custom post type, permalinks, taxonomies and blog posts
- How to group posts and get a mixed posts and groups view?
- Custom post type permalink tag 404
- How to make front end form only accept certain values