Home › Forums › General Issues › css div different color for each line › Reply To: css div different color for each line
Good evening,
I searched as you said I found the solution
But I have to adapt all my codes as I was otherwise doing for display.
However, there is one thing I can not do,
I have a title for my group
And when my group completes the title is displayed it’s normal
But I would like that when my group is empty, that the title is not displayed
echo '<h3 class="uppercase" data-text-color="primary"> MY GROUPE </h3>';
Can you help me?
Here is my final code
<?php
$group_ID = 30117;
$fields = array();
$fields = apply_filters('acf/field_group/get_fields', $fields, $group_ID);
if( $fields )
{
echo '<div class="row">';
echo '<div class="product-footer">';
echo '<div class="col large-12">';
echo '<h3 class="uppercase" data-text-color="primary"> MY GROUPE </h3>';
foreach( $fields as $field_name => $field )
{
if ($i % 2 != 0)
$rowColor = "#f2f2f2";
else
$rowColor = "#ffffff";
{
$value = get_field( $field['name'] );
if( $value && $value != 'no') {
echo '<div style="background:' . $rowColor . ';height:35px;width:100%;padding:5px 5px 5px 0px;">';
echo '<div style="width:40%;float:left;"><b>'. $field['label'] .'</b></div>';
echo '<div style="width:60%;float:left;">' . $value . '</div>';
echo '</div>';
$i++;
}
}
}
echo '</div>';
echo '</div>';
echo '</div>';
}
?>
thanks you
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.