Support

Account

Home Forums Front-end Issues Custom table is not showing.

Helping

Custom table is not showing.

  • we have one custom table on a resources page and is displaying perfectly fine on a custom template (code below). we have now created a new table for a separate resources page and duplicated all the info from the previous resources page, but the table is not being displayed on the live site.

    <?php if( get_field('resource_table') ):
    			
    			while ( has_sub_field('resource_table') ) : ?>
    				<div class="res_tables">
    				<?php if( get_row_layout() == 'table_left' ): ?>
    					<table class="table_left">
    						<tbody>
    					    <tr class="resi_table_gone">
    							<th colspan="1"><?php the_sub_field('heading'); ?></th>
    							<th colspan="1"><?php the_sub_field('heading_2'); ?></th>
    						</tr>
    						<tr>
    							<td class="resi_table"><?php the_sub_field('heading'); ?></td>
    							<td class="" valign="top">
    
    						<?php while ( have_rows('downloads') ) : the_row();
    			  				
    			  				$fileurl2 = get_sub_field('file_link');
    			  			 	echo "<ul class='files'><li><a target='blank' href=" . $fileurl2 . ">";	
    			  					the_sub_field('link_title');
    			  				echo "</a></li></ul>";
     
    			  			endwhile;
    			  			
    			  			while ( have_rows('link') ) : the_row();
    			  			 	
    			  			 	$linkurl2 = get_sub_field('file_link_other');
    			  			 	echo "<ul class='links'><li><a target='blank' href=" . $linkurl2 . ">";	
    			  					the_sub_field('link_title');
    			  				echo "</a></li></ul>";
    			  				
    			  			endwhile; ?>
    
    							</td>
    
    							<td class="resi_table"><?php the_sub_field('heading_2'); ?></td>
    							<td class="" valign="top">
    
    						<?php while ( have_rows('downloads_2') ) : the_row();
    			  				
    			  				$fileurl3 = get_sub_field('file_link_2_other');
    			  			 	echo "<ul class='files'><li><a target='blank' href=" . $fileurl3 . ">";	
    			  					the_sub_field('link_title_2');
    			  				echo "</a></li></ul>";
     
    			  			endwhile;
    			  			
    			  			while ( have_rows('link_2') ) : the_row();
    			  			 	
    			  			 	$linkurl3 = get_sub_field('file_link_2');
    			  			 	echo "<ul class='links'><li><a target='blank' href=" . $linkurl3 . ">";	
    			  					the_sub_field('link_title_2');
    			  				echo "</a></li></ul>";
    			  				
    			  			endwhile; ?>
    
    							</td>
    						</tr>
    						</tbody>
    					</table>
    
    				<?php elseif( get_row_layout() == 'table_right' ): ?>
    					<table class="table_right">
    						<tbody>
    					    <tr>
    							<th colspan="1"><?php the_sub_field('heading'); ?></th>
    						</tr>
    						<tr>
    							<td class="">
    
    						<?php while ( have_rows('downloads') ) : the_row();
    			  				
    			  				$fileurl2 = get_sub_field('file_link');
    			  			 	echo "<ul class='files'><li><a target='blank' href=" . $fileurl2 . ">";	
    			  					the_sub_field('link_title');
    			  				echo "</a></li></ul>";
     
    			  			endwhile;
    			  			
    			  			while ( have_rows('link') ) : the_row();
    			  			 	
    			  			 	$linkurl2 = get_sub_field('url');
    			  			 	echo "<ul class='links'><li><a target='blank' href=" . $linkurl2 . ">";	
    			  					the_sub_field('label');
    			  				echo "</a></li></ul>";
    			  				
    			  			endwhile; ?>
    
    							</td>
    						</tr>
    						</tbody>
    					</table>
    
    			<?php endif; ?>
    				</div>
    
    		  	<?php endwhile;
    
    		endif; ?>
    
    	<?php } ?>

    we have duplicated the template for the additional resources page (code below)

    <?php if( get_field('inc_resource_table') ):
    			
    			while ( has_sub_field('inc_resource_table') ) : ?>
    				<div class="res_tables">
    				<?php if( get_row_layout() == 'table_left' ): ?>
    					<table class="table_left">
    						<tbody>
    					    <tr class="resi_table_gone">
    							<th colspan="1"><?php the_sub_field('heading'); ?></th>
    							<th colspan="1"><?php the_sub_field('heading_2'); ?></th>
    						</tr>
    						<tr>
    							<td class="resi_table"><?php the_sub_field('heading'); ?></td>
    							<td class="" valign="top">
    
    						<?php while ( have_rows('downloads') ) : the_row();
    			  				
    			  				$fileurl2 = get_sub_field('file_link');
    			  			 	echo "<ul class='files'><li><a target='blank' href=" . $fileurl2 . ">";	
    			  					the_sub_field('link_title');
    			  				echo "</a></li></ul>";
     
    			  			endwhile;
    			  			
    			  			while ( have_rows('link') ) : the_row();
    			  			 	
    			  			 	$linkurl2 = get_sub_field('file_link_other');
    			  			 	echo "<ul class='links'><li><a target='blank' href=" . $linkurl2 . ">";	
    			  					the_sub_field('link_title');
    			  				echo "</a></li></ul>";
    			  				
    			  			endwhile; ?>
    
    							</td>
    
    							<td class="resi_table"><?php the_sub_field('heading_2'); ?></td>
    							<td class="" valign="top">
    
    						<?php while ( have_rows('downloads_2') ) : the_row();
    			  				
    			  				$fileurl3 = get_sub_field('file_link_2_other');
    			  			 	echo "<ul class='files'><li><a target='blank' href=" . $fileurl3 . ">";	
    			  					the_sub_field('link_title_2');
    			  				echo "</a></li></ul>";
     
    			  			endwhile;
    			  			
    			  			while ( have_rows('link_2') ) : the_row();
    			  			 	
    			  			 	$linkurl3 = get_sub_field('file_link_2');
    			  			 	echo "<ul class='links'><li><a target='blank' href=" . $linkurl3 . ">";	
    			  					the_sub_field('link_title_2');
    			  				echo "</a></li></ul>";
    			  				
    			  			endwhile; ?>
    
    							</td>
    						</tr>
    						</tbody>
    					</table>
    
    				<?php elseif( get_row_layout() == 'table_right' ): ?>
    					<table class="table_right">
    						<tbody>
    					    <tr>
    							<th colspan="1"><?php the_sub_field('heading'); ?></th>
    						</tr>
    						<tr>
    							<td class="">
    
    						<?php while ( have_rows('downloads') ) : the_row();
    			  				
    			  				$fileurl2 = get_sub_field('file_link');
    			  			 	echo "<ul class='files'><li><a target='blank' href=" . $fileurl2 . ">";	
    			  					the_sub_field('link_title');
    			  				echo "</a></li></ul>";
     
    			  			endwhile;
    			  			
    			  			while ( have_rows('link') ) : the_row();
    			  			 	
    			  			 	$linkurl2 = get_sub_field('url');
    			  			 	echo "<ul class='links'><li><a target='blank' href=" . $linkurl2 . ">";	
    			  					the_sub_field('label');
    			  				echo "</a></li></ul>";
    			  				
    			  			endwhile; ?>
    
    							</td>
    						</tr>
    						</tbody>
    					</table>
    
    			<?php endif; ?>
    				</div>
    
    		  	<?php endwhile;
    
    		endif; ?>
    
    	<?php } ?>

    just wondering if anyone can help clarify why the duplicated table and template are not displaying, but the original one does.

  • Hi @laurai

    Are you having the same location rules configuration on both sites.

    The template seems just fine and if you have set the custom field location similarly the everything should be working just as expected.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.