Home Forums Add-ons Repeater Field Random repeater fied and nav


Random repeater fied and nav

  • Hello

    This time I’m using repeater fied to create a faq.

    Each repeater correspond to a category; I have inside an “question row” and “answer row” field.

    It’s working well on my FAQ page.

    So now I wish random it on each page: PAge category A -> random FAQ category A and create an infitite loop navigation “next” and “previous” question in the same repeater.

    For the random I have a warning “shuffle() expects parameter 1 to be array, null given”. How to fix it ?

    And I don’t know how create my nav infinite loop for the next and previous button

    This is my code:

    <div id="infobulle">
    	<div class="inner">
    		<div class="open-bulle">
    			<img src="<?php echo $imageC['url'] ;?>" alt=" <?php echo bloginfo('name') ?>" />
    			$repeater = get_field( 'education_faq' );	
    			shuffle( $repeater );
    			$i=0; ?>
    			<div class="quest-rep-bulle">
    			<?php foreach($repeater as $row){?>
    				<div class="titre">
    					<h5><?php echo $row['question_faq_education']; ?></h5>
    					<hr class="colomethode">
    					<div class="txtCourant"> <?php echo $row['reponse_faq_education']; ?></div>
    				 if (++$i == 1) break;
    			} ?>
    			<div class="NavFAQ innerBtnCentre"><span class="icon-precedent">Previous</span><a href="" class="btnNoirSimple">FAQ</a><span class="icon-suivant">Next</span></div>
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.