Support

Account

Home Forums Add-ons Repeater Field List all subfield values alphabeticaly

Helping

List all subfield values alphabeticaly

  • Sorry for creating a new topic.
    I had another marked as solved but it wasn`t solved 100% and now I have another question.

    This is my other thread
    http://support.advancedcustomfields.com/forums/topic/echo-repeater-field-alphabetically-query_posts/

    For an Eventsite I`d like to display all artists ever played in that club. Those artists are in a repeater (row = artists / subfield = artistname)

    The problem with the alphabetical order you can see at the other topic.
    There I need help with the absolute alphabetical order without dependence of posts.

    The new question:
    Is there a way to disable dublicates?
    If a Band has played more than once it should only appear once in this list.

  • Don’t know if you’ve found a solution for this. If you’re going to try to eliminate duplicated then you’ll need to loop through your list before or after you sort it and take them out. As a simple example:

    
    $already_shown = array();
    foreach ($array as $value) {
      // i'm using isset() because it's faster than in_array()
      if (!isset($already_shown[$value'])) {
        $already_shown[$value] = $value;
        // code to show your value here
      } // end if not already shown
    } // end foreach
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.