[Plugin: Magic Fields] Return content only if a duplicate field in a group includes a specific value
-
I have created a group called ‘Contributor’ (may be duplicated). Within that group I have have two fields: ‘contributor_name’ (no duplicates) and ‘contributor_role’ (may be duplicated). I need to create a function that will allow me to list ONLY the names of contributors who have a value of “Artist” in the ‘contributor_role’ field. I could do this if it wasn’t a duplicate field using the following code:
if(!function_exists('contributor')){ function contributor(){ global $post; $Contributors = get_group('Contributor'); foreach($Contributors as $Contributor){ if($Contributor['contributor_role'][1] == 'Artist') { echo $Contributor['contributor_name'][1]; } } } }
How do I modify the code to account for the fact that some of my contributors have multiple roles?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘[Plugin: Magic Fields] Return content only if a duplicate field in a group includes a specific value’ is closed to new replies.