Home Forums Plugin Support WP User Frontend Pro Repeating fields

This topic is: resolved

This topic contains 7 replies, has 2 voices, and was last updated by  R 5 years, 10 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2511

    R
    Participant
    Post count: 12

    Question by repeating fields. Tell me, how to display them in the template? Option, automatic insertion is not satisfied.

    #2539

    Tareq Hasan
    Keymaster
    Post count: 2831

    Here's a little example, insert it to your themes single.php. Give the right meta_key in that code. I hope you can customize it a little by yourself 🙂
    [php]
    $repeat_field = get_post_meta( $post->ID, ‘meta_key_insert_here', true );
    if ( $repeat_field ) {
    foreach ($repeat_field as $field) {
    echo "Value: $field <br>";
    }
    }
    [/php]

    #2548

    R
    Participant
    Post count: 12

     
    Nothing displays…Meta-key I have made. And there is a problem: if this field contains the text, comma-separated – they split up and each passage between the comma becomes a separate field.

    #2549

    R
    Participant
    Post count: 12

     

    Problem 2: after editing form via's front end she gets out of the category.
    #2602

    Tareq Hasan
    Keymaster
    Post count: 2831

    I've updated the documentation on how to show the meta fields. Take a look.

    #2658

    R
    Participant
    Post count: 12

    All right. Now displaying these fields.
    But after comma all cut off. Can this be somehow fixed a? These fields I want to use for entering addresses, and according to the standard they are written: “Сity, street, house.”

    #2671

    Tareq Hasan
    Keymaster
    Post count: 2831

    Hmm, I never thought of that. I separated those fields with the comma, may be the decision wasn't right. Although there is a quick fix, open up ‘`/class/render-form.php`' and see line 11. Change the comma to something unique, may be pipe (`|`). So it should be like this:
    `static $separator = ‘| ‘;`

    Now you need to change the sign in these codes too. For example: `$values = explode( ‘, ‘, $repeat_field );` should be `$values = explode( ‘| ‘, $repeat_field );`

    #2675

    R
    Participant
    Post count: 12

    Tareq, Thank you. It would be nice if in future versions you could choose a separator in the settings.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Repeating fields’ is closed to new replies.