0
I would like to get the separate value url placed on meta_key
, I have a custom field "Custom file" called mp3 then put the mp3 multiple fields would like to pick url of each value
this code below shows the url only of the last mp3 added:
<?php $minha_variavel = get_post_meta($post->ID, 'mp3', true); ?>
<?php if ($minha_variavel): ?>
<?php echo wp_get_attachment_url($minha_variavel); ?>
<?php endif; ?>
get_post_meta()
receives a boolean parameter called single, that determines whether the function return is a single value or an array of values. In your case, you are calling the function with that value astrue
. Try to leave it asfalse
.– Caio Felipe Pereira
Good morning ! set to false now displayed nothing in case I have to put the code inside a loop or not in case it is a field with multiple volumes
– Hemerson Prestes
if
$minha_variavel
for an array, you will have to traverse it in a loop– Caio Felipe Pereira