http://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/ prety much covers what you’re after I believe.
So in your example
while ( $projects->have_posts() ) {
$projects->the_post();
$category_classes = array();
$categories = get_the_terms( get_the_ID(), 'project_category' );
if ( $categories ) {
foreach ( $categories as $category ) {
$categories_included[] = $category->term_id;
$color = get_field('color', 'project_category_'.$category->term_id);
}
}
You can also pass a term to get_field and the_field, so you could also use the following depending on your version of ACF as I believe much older versions don’t support passing terms
$color = get_field('color', $category);
Related Posts:
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Get Custom Field Values by Another Custom Field in WordPress
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- ACF – Retrieve custom taxonomy from a relationship field
- Display Custom Field or Custom Taxonomy in front page /post/product
- Custom Sort Order for Custom Post Type Taxonomy
- How to Add Custom Fields to a Custom Post Type?
- clients list using wordpress
- Filtering a WP_Query meta_query by numeric values isn’t working
- Creating Photo Gallery System with Custom Post Type
- Filter a custom field based on selection of another custom field (ACF) [closed]
- How to do a custom bookmarks post type?
- ACF Relationships in Custom Post Type Permalink
- How to select one major category (or custom taxonomy) for a custom post type?
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Custom Taxonomy order by Custom Field
- front end radio custom taxonomy with custom post type
- Is there any performance consideration when using Custom Post Types?
- What is better: Custom Fields vs Custom Taxonomies with Terms for perfomance, scalability and better user experience
- How loop through posts based on custom fields
- Show ACF field from custom taxonomy and display on the single template
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- How to add custom fields to admin UI and REST API response?
- Display posts if a custom field value is equal to another custom field value
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Query Custom Post Types by date (custom field) range
- Create 3 Level Relations with ACF and WordPress
- Custom Post type and Custom Field WP_Query
- How to change post featured image using a custom field of category?
- How to bulk copy custom fields between custom posts?
- wp_query check if integer exists in custom field’s array
- WP_Query order by custom field, then randomly order some of results
- Meta Query Not Returning Output Despite Having Matching Values
- Dynamic dropdown select values depending on other custom field value
- How to render a custom post type template with custom fields using shortcode
- Query Custom Post Type Taxonomy term with multiple parameters
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- First custom field value (out of several) displayed twice after query
- How to group posts and get a mixed posts and groups view?
- Multiple Frontend Filters Using Advanced Custom Fields
- Integrate Custom Post Type Events into Calendar
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Displaying custom field according to date
- Query based on custom fields start and end date
- Custom post type’s extra fields – how to handle?
- How to get a custom type post data when it has a connection with another custom type post?
- List of users that clicked a ‘Join’ button at single post
- Targeting categories in custom fields
- Custom taxonomies to define versions of a product
- Custome fields not displayed
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- How to define the template for custom posts?
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- How do I replace the post title with a custom field?
- Reusable metabox backend and frontend
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- Custom post type name and assigning custom taxonomy
- Group by custom field value (start and end times)
- Custom post types, disable fields
- Building a Portfolio and need some direction
- Custom post types category
- Custom Taxonomy dont save in a frontend form for post a custom post
- Excerpt length: get first paragraph
- How to display posttypes and taxonomy in standard posts, not in a separate label?
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Should i use custom post type for a custom footer?
- Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- How do I ensure that post_type and Taxonomy use the same slug?
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- Custom taxonomy terms as children of multiple custom post types
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Create if else for post types in WP_Query ‘post__in’ values
- How to access repeater field of a custom field?
- wp_insert_post deleting previous post custom meta
- Some posts not displaying by taxonomy term
- PHP Warning with Custom Fields
- How to display custom post type pagination buttons when processing AJAX request
- filter using custom fields
- Adding a Section for Visitors
- Display custom tax in “while” loop
- Custom taxonomy template for custom fields loop [closed]
- Best way to have one product in both rental and sale parent category
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Fixed custom fields depending on posttype/category
- What’s the most efficient way to get two queries based on an if statement?
- Automatically convert standard posts with custom fields to custom post types
- Need some suggestion/help with custom post types project
- predefined custom field on registration page
- Show Custom Post Type taxonomy term that matches custom field
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Advanced search form with filters for custom taxonomies and custom fields
- How to show animal lineage/pedigree in WordPress?
- Custom Post type as Taxonomy
- How to change order of custom post types. I want Featured post to come first
- ACF Relationship: Group posts by parent category term, then child [closed]
- Retrieve a post with its ACF repeater fields in wordpress
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- Custom taxonomy meta fields