Support

Account

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

Unread

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') ?>" />
    			<h3>Advice</h3>
    		
    		</div>
    
    		<?php 	
    			$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>			
    					<div class="txtCourant"> <?php echo $row['reponse_faq_education']; ?></div>
    
    				<?php
    				 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>
    		</div>
    	</div>
    	
    	
    	
    
    </div>
Viewing 1 post (of 1 total)

The topic ‘Random repeater fied and nav’ is closed to new replies.