Pulling ACF from CPT UI
-
Hello,
I have a custom taxonomy called “company,” which is in a plugin I had developed. The field is in several locations, one being the user’s profile. For example, User A is tied to Company A(one of the options from the custom taxonomy). I have several ACF fields that I have attached to the taxonomy, for example, the companies brand color, logo, and favicon. So my issue is trying to pull the ACF fields from the taxonomy that the user is attached to. For example, if User A is tied to Company A, Company A’s branding (color/logo/favicon) will be pulled.
Thanks!
P.S. I am new to PHP, but I have coded this to pull the ACF from the user’s profile. I would really appreciate it if we can edit this code to fit my above issue.
//Pulls Color from users profile add_action( "wp_head", "primary_color"); add_action("admin_head","primary_color"); function primary_color(){ $branding = get_field('primary_brand_color',"user_" . get_current_user_id()); //Fallback color: ABCO green if (empty($branding)) $branding ='#029776'; echo '<style type="text/css"> :root{--branding:'.$branding.';} </style>'; }
- The topic ‘Pulling ACF from CPT UI’ is closed to new replies.