Support

Account

Home Forums ACF PRO shortcode Reply To: shortcode

  • I think you have to use get_sub_field instead of the_sub_field

    function horairesEte() {
    	if( have_rows('horaires_ete', 'option') ):
    		while ( have_rows('horaires_ete', 'option') ) : the_row();
    			return '<span class="jours">'.get_sub_field('jours').'</span><span class="ouverture">'.get_sub_field('ouverture').'</span>-<span class="fermeture">'.get_sub_field('fermeture').'</span>';
    		endwhile; 
    	endif;
    }
    add_shortcode('horaires_ete', 'horairesEte');