Anything new in this topic? I would really love to have that without any external plugins(which probably doesn’t even work anymore).
Ok, i solved my problem. Seems like those two directives was not even required(i can use subfields as arrays).
The problem was with NAMES of those fields! I forgot _ symbol in between.
So the code at the end is:
function ssf(){
global $post;
$post_id = $post->id;
$rep = get_field('sourcepage', $post_id);
if ($rep && is_array($rep)) {
foreach ($rep as $item) {
$output .= '<span class="set blue">
<a class="btn-pbt pri ico" href="'.$item['link_przycisku'].'">'.$item['nazwa_przycisku'].'</a>
</span>';
}
}
return $output;
}
add_shortcode('guzik', 'ssf');
Already tested it before, but it’s the same.
You can look by yourself:
https://playernotes.pl/test/
Proper button should look like this:
Fields are filled ofc: