Hallo
Ik ben aan het stoeien met Wordpress en custom fields.
Ik heb een repeater-field gemaakt (tour_program)
Met daarin de sub-fields (day_number, from_-_to en day_description)
De code om dit weer te geven lukt mij nog, maar nu wil ik het hele tourprogramma tussen de shortcodetags [expand][/expand] kunnen zetten. (om de tekst te kunnen uitvouwen mbv plugin)
Ik had het volgende bedacht, alleen nu zit elke dag van de tour in een expand-geval.
zie onderaan de tekst
http://i-junkie.nl/javiro/tour/8-days-highlights-northern-circuit/
Dit is de code die ik daarvoor heb
// check if the repeater field has rows of data
if( have_rows('tour_program') ):
// loop through the rows of data
while ( have_rows('tour_program') ) : the_row();
// display a sub field value within a shortcode
echo do_shortcode('[expand]'.get_sub_field('day_number').','.get_sub_field('from_-_to').','.get_sub_field('day_description') .'[/expand]');
endwhile;
else :
// no rows found
endif;
Dus hoe krijg ik alle dagen in één ?
Ik ben nu zo ver, maar verder kom ik niet
// check if the repeater field has rows of data
if( have_rows('tour_program') ):
$output='';
// loop through the rows of data
while ( have_rows('tour_program') ) : the_row();
// add a sub field value to the output
output += get_sub_field('day_number');
output += get_sub_field('from_-_to');
output += get_sub_field('day_description');
endwhile;
echo do_shortcode('[expand]'.$output.'[/expand]');
else :
// no rows found
endif;
Iemand die het weet?
Bedankt! In ieder geval voor het lezen!
2.417 views