This topic contains 3 replies, has 2 voices, and was last updated by  Steve 1 month ago.

  • Author
    Posts
  • #9455

    dahnsnake
    Participant

    Hi, First of all I love Piklist <3! This is the first time I could not figure something out on my onw. I made created this code with the last array a group with add more (or repeater) functionality. I would like to know how I can loop through the group ‘writer’. So the loop creates a new div with the new data when the add more functionality is used. This way I would like the user to be able to add more writers to a book :). I saw this one but I could not figure it out: https://piklist.com/support/topic/repeater-field/

    `piklist(‘field’, array(
    ‘type’ => ‘group’
    ,’label’ => __(‘Blok boek en schrijvers’)
    ,’description’ => __(‘Het tweede blok met het boek “hou je kop erbij” en de schrijvers eronder.’)
    ,’fields’ => array(
    array(
    ‘type’ => ‘text’
    ,’field’ => ‘home-book-title’
    ,’label’ => __(‘Titel’)
    ,’columns’ => 4
    ,’attributes’ => array(
    ‘placeholder’ => ‘Titel’
    )
    )
    ,array(
    ‘type’ => ‘text’
    ,’field’ => ‘home-book-button’
    ,’label’ => __(‘Link onder tekst’)
    ,’columns’ => 4
    ,’attributes’ => array(
    ‘placeholder’ => ‘Knop’
    )
    )
    ,array(
    ‘type’ => ‘text’
    ,’field’ => ‘home-book-button2′
    ,’label’ => __(‘Knop onder schrijvers’)
    ,’columns’ => 4
    ,’attributes’ => array(
    ‘placeholder’ => ‘Knop’
    )
    )
    ,array(
    ‘type’ => ‘editor’
    ,’field’ => ‘home-book-introduction’
    ,’label’ => __(‘Introductie bij het boek’)
    ,’columns’ => 12
    ,’attributes’ => array(
    ‘placeholder’ => ‘Introductie’
    )
    )
    ,array(
    ‘type’ => ‘group’
    ,’field’ => ‘writer’
    ,’label’ => __(‘Schrijver’)
    ,’add_more’ => true
    ,’fields’ => array(
    array(
    ‘type’ => ‘text’
    ,’field’ => ‘writerName’
    ,’label’ => __(‘Naam’)
    ,’columns’ => 4
    ,’attributes’ => array(
    ‘placeholder’ => ‘Naam’
    )
    )
    ,array(
    ‘type’ => ‘text’
    ,’field’ => ‘writer-linkedin’
    ,’label’ => __(‘LinkedIn’)
    ,’columns’ => 4
    ,’attributes’ => array(
    ‘placeholder’ => ‘LinkedIn’
    )
    )
    )
    )
    )
    ));

  • #9457

    dahnsnake
    Participant

    Anyone :D?

  • #9461

    Steve
    Keymaster

    There is a bug with this type of field that should be addressed in the next major release of Piklist.

    For the time being, I suggest you remove ,’field’ => ‘writer’. Piklist will keep the values of writerName and writer-linkedin in order, so you can pull each using get_post_meta and sync the keys.

    Let me know if you still have questions.

  • #9462

    Steve
    Keymaster

    There is a bug with this type of field that should be addressed in the next major release of Piklist.

    For the time being, I suggest you remove ,’field’ => ‘writer’. Piklist will keep the values of writerName and writer-linkedin in order, so you can pull each using get_post_meta and sync the keys.

    Let me know if you still have questions.

You must be logged in to reply to this topic.