php - Div not wrapping around all items in a loop

374

I got 2 sections on a page. You can see it here: http://www.equitasmg.com/who-we-are-2/

Both sections have a<div> wrapped around them, but the first section "Our Leadership" seems to not like the<div>. The<div> wraps around the first item in the section but does not wrap around all the items.

Here is the PHP for both sections.

First section

 <center><h2>Our Leadership</h2></center>
 <center><div>
 <?php
 $people= get_field('people');
 $a=0;
 foreach ($people as $r) {
$a++;
?>
     <div >
      <img src="<?php echo $r['image']['sizes']['team'];?>" >
      <h3>
        <?php echo $r['name'];?>
      </h3>
      <div >
        <h4><?php echo $r['position'];?></h4>
      </div>
      <?php echo $r['intro_text'];?>
      <?php if ($r[ 'learn_more_text']) { ?>
      <a href="#" data-reveal-id="<?php echo sanitize_title($r['name'] );?>">Learn More</a>
      <?php } ?>
 <?php if ($r[ 'learn_more_text']) { ?>
 <div id="<?php echo sanitize_title($r['name'] );?>" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">

<h3><?php echo $r['name'];?></h3>
<div >
  <?php echo $r['position'];?>
</div>
<div >    
<?php echo $r['learn_more_text'];?>
</div>
<a aria-label="Close">&#215;</a>
 </div>
    </div>
 <?php } ?>
 </div>
 <?php } ?>
 </div></center>
 <div ></div>

Second section

 <center><h2>Our Team</h2></center>
 <center><div>
 <?php
 $people2= get_field('people_bottomsection');
 $a=0;
 foreach ($people2 as $r) {
$a++;
?>
     <div >
      <img src="<?php echo $r['image']['sizes']['team'];?>" >
      <h3>
        <?php echo $r['name'];?>
      </h3>
      <div >
        <h4><?php echo $r['position'];?></h4>
      </div>
      <?php echo $r['intro_text'];?>
      <?php if ($r[ 'learn_more_text']) { ?>
      <a href="#" data-reveal-id="<?php echo sanitize_title($r['name'] );?>">Learn More</a>
      <?php } ?>
 <?php if ($r[ 'learn_more_text']) { ?>
 <div id="<?php echo sanitize_title($r['name'] );?>" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">

<h3><?php echo $r['name'];?></h3>
<div >
  <?php echo $r['position'];?>
</div>
<div >    
<?php echo $r['learn_more_text'];?>
</div>
<a aria-label="Close">&#215;</a>
 </div>
    </div>
 <?php } ?>
 </div>
 <?php } ?>
 </div></center>
 <div ></div>
570

Answer

Solution:

You just got extra div.

First section you got extra div here

<center><h2>Our Leadership</h2></center>
<center>
<div>
<?php
$people= get_field('people');
$a=0;
foreach ($people as $r) {
$a++;
?>
<div >
<img src="<?php echo $r['image']['sizes']['team'];?>" >
<h3>
<?php echo $r['name'];?>
</h3>
<div >
<h4><?php echo $r['position'];?></h4>
</div>
<?php echo $r['intro_text'];?>
<?php if ($r[ 'learn_more_text']) { ?>
<a href="#" data-reveal-id="<?php echo sanitize_title($r['name'] );?>">Learn More</a>
<?php } ?>
<?php if ($r[ 'learn_more_text']) { ?>
<div id="<?php echo sanitize_title($r['name'] );?>" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">

	<h3><?php echo $r['name'];?></h3>
	<div >
	<?php echo $r['position'];?>
	</div>
	<div >    
	<?php echo $r['learn_more_text'];?>
	</div>
	<a aria-label="Close">&#215;</a>
</div>
<!-- </div> --> //extra div here
<?php } ?>
</div>
<?php } ?> //end of foreach
</div>
</center>
<div ></div>



People are also looking for solutions to the problem: http failure during parsing for
Source

Share


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.


Similar questions

Find the answer in similar questions on our website.

943 "Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
459 mysql - Display all entries in a table using for loop in PHP
462 php - Contact form not working: Notice: Undefined index: message
52 How to crop all the values withing a PHP array
554 php - select all products from child categories in parent category
114 php - How do i pass value from one activity to another activity
493 php - Environment variables in route annotations
310 php - Rank query not working
139 php - How to get all the videos link from a youtube playlist .
81 php - All apache requests to Symfony Routing Component

People are also looking for solutions to the problem: php - Save large data-set to mySQL table from Javascript without POST?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.