Home › Forums › Front-end Issues › Calling custom 'color' field from custom taxonomy › Reply To: Calling custom 'color' field from custom taxonomy
Elliot –
Here is the full section of code.
<?php if(get_field('pro_perf')) {
while(has_sub_field('pro_perf')) {
$date_id = 1;
echo '<p> ' . get_sub_field('pro_perf_date') . '<br /> ';
if(get_sub_field('pro_perf_time_repeat')) {
while(has_sub_field('pro_perf_time_repeat')) {
if($date_id <= 1 ) {
$date_tags = get_sub_field('pro_perf_time_tag');
if($date_tags) {
foreach($date_tags as $date_tag) {
$t_data = get_option("event_tag_$date_tag->term_id_term_color");
echo $t_data;
echo '<span class="tagbox" style="background:' . $color . ';">' . $date_tag->slug . '</span>';
}
echo '<a class="date" href="' . get_sub_field('pro_perf_time_link') . '">' . get_sub_field('pro_perf_time') . '</a>';
} else {
echo '<a class="date" href="' . get_sub_field('pro_perf_time_link') . '">' . get_sub_field('pro_perf_time') . '</a>';
}
} else {
$date_tags = get_sub_field('pro_perf_time_tag');
if($date_tags) {
foreach($datetags as $datetag) {
echo '<span class="tagbox"> ' . $date_tag->slug . ' </span>';
}
echo ' | <a class="date" href="' . get_sub_field('pro_perf_time_link') . '">' . get_sub_field('pro_perf_time') . '</a>';
} else {
echo ' | <a class="date" href="' . get_sub_field('pro_perf_time_link') . '">' . get_sub_field('pro_perf_time') . '</a>';
}
}
$date_id ++;
}
}
echo '</p>';
}
}?>
Also, to answer your other questions, in my rushed state to post, I did not see the code button as an option. I am also fairly new to forums like this and the truth is it was just laziness and frustration but in the future I will make sure to properly address those issues and be a better community member.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc
— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.