Home › Forums › General Issues › strip out duplicate content from an array › Reply To: strip out duplicate content from an array
Is $qualite
a regular array or an associative array?
One idea would to be to store the value of each $qualite
in a variable and check the new one against it before outputting it. Example:
$qualite = get_field( 'qualite', $modele->ID);
if( $qualite ):
$unique = '';
foreach( $qualite as $qualite ):
if ( $unique != $qualite ) :
echo '<dd class="filtr" data-filter=".'. $qualite->ID . '">'.get_the_title( $qualite->ID ) .'</dd>';
$unique = $qualite;
else : endif;
endforeach;
endif;
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.