This is a Wordpress project (using Advanced Custom Fields) but the error I am getting is due to plain PHP code that I do not have a good enough grasp of. The code below returns a server error and is likely due to bad configuration of while/if closing statements. I have tried all the permutations I can think of, to no avail. Thanks in advance for your help!
<?php if(get_field('categories')): ?>
<?php
$has_public = false;
while( has_sub_field('categories') )
{
if( get_sub_field( "public" ) == "1" )
{
$has_public = true;
}
}
if( $has_public )
{
while( has_sub_field('categories') ): ?>
<div class="l_4 block">
<h3><?php the_sub_field('name'); ?></h3>
<dl>
<?php while( has_sub_field('items') ): ?>
<?php if( get_sub_field( "public" ) == "1" ): ?>
<dt></dt>
<?php while(has_sub_field("content")): ?>
<?php if(get_row_layout() == "link"): ?>
<dd><a href="<?php the_sub_field("link"); ?>" target="_blank"><?php the_sub_field("name"); ?></a></dd>
<?php elseif(get_row_layout() == "file"): ?>
<dd><a href="<?php the_sub_field("file"); ?>" target="_blank"><?php the_sub_field("name"); ?></a></dd>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; ?>
</dl>
</div>
<?php endwhile; ?>
}
<?php endif; ?>
}
is outside of the php code block. – Twisted1919 May 6 '13 at 18:53