Support

Account

Home Forums General Issues Can't get values while creating loop for shortcode Reply To: Can't get values while creating loop for shortcode

  • 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');