Home Forums General Issues Repeater accordion


Repeater accordion

  • hi, can someone please show me what i am doing wrong here? This is a repeater field i am using to create an accordion. I can get only one button to display but with no content. how do i get the content for ‘accordion_title’ and ‘accordion content’ properly here? and how do i show more than one of the repeaters?

    	 * Get the Accordion section.
    	 * @return String Final string of this section
    	private function getSection_accordion_row() {
    	if( have_rows('accordion') ):
     	// loop through the rows of data for the tab header
        while ( have_rows('accordion') ) : the_row(); 
    		$header = get_sub_field('accordion_title');
    		$content = get_sub_field('accordion_content');
    		$html = '<button class="accordion"><?php echo $header; ?></button>';
    		$html .= '<div class="panel">';
    		$html .= '<p><?php echo $content; ?></p>';
    		$html .= '</div>';   
    	 	return $html;
    	endwhile; //End the loop 
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.