For loop of repeatable fields
-
Hi!
I have extended the user options with some field, which I’m displaying in the author.php with the following pattern:
$post_id = get_the_ID();
$user_id = get_the_author_meta('ID', get_post_field('post_author', $post_id));
$space_title = get_user_meta($user_id, 'space_title', true);
...
# Display part follow this pattern:
<?php if ($space_title) : ?>
<p class="space_title">
<?= $space_title ?>
</p>
<?php endif; ?>Now, I added the possibility to add a list of links through a repeatable text field, but I can’t figure out how to loop through the entries, because
$space_links = get_user_meta($user_id, 'space_links', true);
returns just a string of the first item submitted.A naif attempt to make it an array
$space_links = array(get_user_meta($user_id, 'space_links', true));
had no good outcome.Any suggestion?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.