This topic contains 7 reply and 2 voices, and was last updated by R 6 years, 6 months ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
April 19, 2013 at 5:11 am 2511
R Question by repeating fields. Tell me, how to display them in the template? Option, automatic insertion is not satisfied.
April 19, 2013 at 10:54 am 2539
Tareq Hasan Tareq Hasan

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]

April 19, 2013 at 12:14 pm 2548
R R

 
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.

April 19, 2013 at 12:17 pm 2549
R R

 

Problem 2: after editing form via’s front end she gets out of the category.
April 20, 2013 at 4:18 am 2602
Tareq Hasan Tareq Hasan

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

April 22, 2013 at 6:20 am 2658
R R

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.”

April 22, 2013 at 10:50 am 2671
Tareq Hasan Tareq Hasan

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 );`

April 22, 2013 at 11:09 am 2675
R R

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

Viewing 7 Posts - 1 through 7 (of 7 total)