Support

Account

Home Forums General Issues display specific row

Helping

display specific row

  • I’m hoping someone can help me with this code, I dont’ have access to the admin panel of ACFP, it is integrated into my theme. On my homepage I have a toplist of casinos, I can create multiple toplists but they will all show under each other.

    I presume each toplist is a row and it just displays all the rows. I presume the first toplist created with repeater r_man_multi_toplist will be row 0, next one row 1 and so on. I only want one row displaying at a time and want to be able to geotarget each row. I can create an extra field in each row so it only pulls that specific row, UK, US, CA. I have created a work around but it is messy and I’m sure this way will be better. This is the code I need to include:

    <?php if(geot_target('GB')) { ?>
    
    content
    
    <?php } ?>

    And the below code controls the toplist

    		<?php }
    
    		if ( 	have_rows('r_man_multi_toplist') && $show_multitoplist && $multitoplist_auto_manu_value === 'manu' ) {
    
    			?>
    
    			<div class="grid">
    
    				<div class="heading">
    					<svg class="icon first"><use xlink:href="#first"></use></svg>
    					<?php if( $multitoplist_title ){ ?>
    					<h2><?php echo $multitoplist_title; ?></h2>
    					<?php } else { ?>
    					<h2>Featured top casinos</h2>
    					<?php } ?>
    				</div>
    
    			<div id="toplist-holder" class="col-1">
    
    				<div id="toplist-tabs">
    
    					<?php $rows = get_field('r_man_multi_toplist');
    					if($rows) { ?>
    					<ul>
    					<?php foreach($rows as $row){
    						echo '<li><a href="#' . str_replace(' ', '',$row['mt_man_title']) . '">' . $row['mt_man_title'] . '</a></li>';
    					} ?>
    					</ul><?php } ?>
    
    					<?php while( have_rows('r_man_multi_toplist') ): the_row();
    
    					$title_value = get_sub_field('mt_man_title');
    					$title = str_replace(' ', '',$row['mt_man_title']);
    
    					?>
    
    					<div id="<?php echo str_replace(' ', '',$title_value); ?>">
    						<?php if( have_rows('mt_man_casinoselection') ):
    
    						?>
    						<table class="toplist">
    
    							<thead>
    
    								<tr>
    									<th class="c-1"><?php if( $t_rank ){ echo $t_rank; } else { ?> Rank <?php } ?></th>
    									<th class="c-2"><?php if( $t_casino_name ){ echo $t_casino_name; } else { ?> Casino Name <?php } ?></th>
    									<th class="c-3"><?php if( $t_logo ){ echo $t_logo; } else { ?> Logo <?php } ?></th>
    									<th class="c-4"><?php if( $t_bonus ){ echo $t_bonus; } else { ?> Bonus <?php } ?></th>
    									<th class="c-5"><?php if( $t_review ){ echo $t_review; } else { ?> Review <?php } ?></th>
    									<th class="c-6"><?php if( $t_play ){ echo $t_play; } else { ?> Play <?php } ?></th>
    								</tr>
    
    							</thead>
    
    							<?php
    								$posNum = 1;
    								while( have_rows('mt_man_casinoselection') ): the_row();
    
    								$url 						=	get_sub_field('mt_man_casino');
    								$postid 					= 	url_to_postid( $url );
    								$casino_name 				= 	get_field('r_casino_name', $postid );
    								$casino_tracker 			= 	get_field('r_casino_tracker_url', $postid );
    								$casino_bonus_amount 		= 	get_field( "r_casino_bonus_amount", $postid );
    								$casino_bonus_percentage 	= 	get_field( "r_casino_bonus_percentage", $postid );
    								$casino_currency_value 		= 	get_field('r_casino_bonus_currency', $postid);
    								$multitp_img				= 	get_field( "r_multitp_screenshot", $postid );
    								$multitp_img_size 			= 	'multitp';
    								$use_custom_currency_casino 	= get_field('use_custom_currency_casino', $postid);
    								$custom_currency_casino 		= get_field('custom_currency_casino', $postid);
    								$before_or_after_casino 		= get_field('before_or_after_casino', $postid);
    
    								$show_tc_on_toplists 		= get_field('show_tc_on_toplists', $postid);
    								$tcs_title 					= get_field('tcs_title', $postid);
    								$tc_url 					= get_field('tc_url', $postid);
    
    							?>
    
    								<tbody>
    
    									<tr>
    										<td class="c-1"><div class="ranking"><?php echo $posNum; ?></div></td>
    										<td class="c-2"><a href="<?php echo $url; ?>"><?php echo $casino_name; ?></a></td>
    										<td class="c-3">
    
    											<?php
    											if( $multitp_img ){
    												echo wp_get_attachment_image( $multitp_img, $multitp_img_size );
    											} else{
    												echo get_the_post_thumbnail( $postid, $multitp_img_size );
    											}
    											?>
    
    										</td>
    
    										<?php if( $casino_bonus_percentage && $casino_bonus_amount ){ ?>
    											<?php if($use_custom_currency_casino){ ?>
    												<td class="c-4">
    													<div class="bonus"><?php echo $casino_bonus_percentage; ?>% <?php if( $t_bonus_text ){ echo $t_bonus_text; } else { ?> up to <?php } ?> <?php if( $before_or_after_casino == 'before' ){ echo $custom_currency_casino . $casino_bonus_amount; }else{ echo $casino_bonus_amount . $custom_currency_casino; } ?> <?php if( $t_bonus_text_bonus ){ echo $t_bonus_text_bonus; } else { ?> bonus <?php } ?>
    													</div>
    													<?php if( $show_tc_on_toplists ): ?>
    													<div class="tnc">
    														<?php if($tc_url){ echo '<a href="' . $tc_url . '">'; } ?>
    														<?php if( $tcs_title ){ echo $tcs_title; }else{ echo 'T&Cs Apply'; } ?>
    														<?php if($tc_url){ echo '</a>'; } ?>
    													</div>
    												<?php endif; ?>
    												</td> <?php }
    												else{ ?>
    												<td class="c-4">
    													<div class="bonus"><?php echo $casino_bonus_percentage; ?>% <?php if( $t_bonus_text ){ echo $t_bonus_text; } else { ?> up to <?php } ?> <?php echo $casino_currency_value; ?><?php echo $casino_bonus_amount; ?> <?php if( $t_bonus_text_bonus ){ echo $t_bonus_text_bonus; } else { ?> bonus <?php } ?>
    													</div>
    													<?php if( $show_tc_on_toplists ): ?>
    														<div class="tnc">
    															<?php if($tc_url){ echo '<a href="' . $tc_url . '">'; } ?>
    															<?php if( $tcs_title ){ echo $tcs_title; }else{ echo 'T&Cs Apply'; } ?>
    															<?php if($tc_url){ echo '</a>'; } ?>
    														</div>
    													<?php endif; ?>
    												</td><?php } ?>
    										<?php } else if( !$casino_bonus_percentage && $casino_bonus_amount ){ ?>
    											<?php if( $use_custom_currency_casino ){?> 
    												<td class="c-4">
    													<div class="bonus"><?php if( $before_or_after_casino == 'before' ){ echo $custom_currency_casino . $casino_bonus_amount;  }else{ echo $casino_bonus_amount . $custom_currency_casino; } ?> <?php if( $t_bonus_text_bonus ){ echo $t_bonus_text_bonus; } else { ?> bonus <?php } ?>
    													</div>
    													<?php if( $show_tc_on_toplists ): ?>
    														<div class="tnc">
    															<?php if($tc_url){ echo '<a href="' . $tc_url . '">'; } ?>
    															<?php if( $tcs_title ){ echo $tcs_title; }else{ echo 'T&Cs Apply'; } ?>
    															<?php if($tc_url){ echo '</a>'; } ?>
    														</div>
    													<?php endif; ?>
    												</td>
    												<?php }
    												else{ ?> 
    												<td class="c-4">
    													<div class="bonus"><?php echo $casino_currency_value; ?><?php echo $casino_bonus_amount; ?> <?php if( $t_bonus_text_bonus ){ echo $t_bonus_text_bonus; } else { ?> bonus <?php } ?>
    													</div>
    													<?php if( $show_tc_on_toplists ): ?>
    														<div class="tnc">
    															<?php if($tc_url){ echo '<a href="' . $tc_url . '">'; } ?>
    															<?php if( $tcs_title ){ echo $tcs_title; }else{ echo 'T&Cs Apply'; } ?>
    															<?php if($tc_url){ echo '</a>'; } ?>
    														</div>
    													<?php endif; ?>
    												</td> <?php } ?>
    										<?php } else { ?>
    											<td class="c-4"></td>
    										<?php } ?>
    
    										<td class="c-5"><a href="<?php echo $url; ?>" class="read"><?php if( $t_read_review_bt ){ echo $t_read_review_bt; } else { ?> Read review <?php } ?></a></td>
    										<td class="c-6"><a <?php if($casino_tracker){ echo ' rel="nofollow" target="_blank" '; } ?> href="<?php if($casino_tracker){ echo $casino_tracker; } else { echo $url; } ?>" class="play"><?php if( $t_play_bt ){ echo $t_play_bt; } else { ?> Play now! <?php } ?></a></td>
    									</tr>
    
    								</tbody>
    
    								<?php $posNum++; endwhile; ?>
    
    						</table>
    						<?php endif; ?>
    
    					</div><?php ?>
    					<?php endwhile; ?>
    
    				</div>
    
    			</div>
    
    			<script>
    			$(function() {
    				$(document).ready(function(){
    				$( "#toplist-tabs" ).tabs({
    			        show: {
    			            effect: "fadeIn",
    			            duration: 200
    			        },
    			        hide: {
    			            effect: "fadeOut",
    			            duration: 200
    			        }
    			    });
    				});
    
    			});
    			</script>
    
    			</div>
    		<?php }
    
    }
    
  • This reply has been marked as private.
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘display specific row’ is closed to new replies.