Support

Account

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;