Loop inside Loop doesn't work properly
-
Hi
I have this loop in side loop:
$sections = CFS()->get( 'extra_sections' ); /* Section Loop*/ foreach ( $sections as $section)?> <hr class="decorative"> <?php { ?> <div class="about-section about-display"> <h2><?php echo $section['section_name']?></h2> <?php echo $section['section_content']; /*Parts of a Section */ foreach ( $section['section_parts'] as $sectionPart) { ?> <div class="section-part about-display"> <h3><?php echo $sectionPart['part_name']?></h3> <?php echo $sectionPart['part_content'];?> </div> <?php } ?> </div> <?php } ?>
It works well when there is one section. However, it doesn’t work when I add multiple sections. Same thing happens if I add multiple section parts.
This is the warning from debug bar: Invalid argument supplied for foreach()
require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/andresportfolio/about.php’)
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Loop inside Loop doesn't work properly’ is closed to new replies.