-1
    <ul class="project-extension-side-link">
   <?php foreach($projectextensions as $projectextension){?>
    <li <?php if($section=='project-extension')
     {echo 'class="active"';}>><span>Project 1</span></li>
        <li><a href=""><?php echo $projectextension->post_title; ?></a></li>
        <li><a href="">Project 3</a></li>
        <li><a href="">Project 4</a></li>
        <li><a href="">Project 5</a></li>
        <li><a href="">Project 6</a></li>
      </ul>

   <?php endforeach;?>
   <?php}?>

0

1 Answer 1

0

When you use endforeach;, you have to use : instead off { when starting the foreach.

<ul class="project-extension-side-link">
    <?php foreach($projectextensions as $projectextension) : // <--- ?> 
        <li <?php echo ($section=='project-extension' ? 'class="active"': ''); ?>><span>Project 1</span></li>
        <li><a href=""><?php echo $projectextension->post_title; ?></a></li>
        <li><a href="">Project 3</a></li>
        <li><a href="">Project 4</a></li>
        <li><a href="">Project 5</a></li>
        <li><a href="">Project 6</a></li>
    <?php endforeach; ?>
</ul>    

Greetz Bjorn

1
  • You're welcome, Please accept my answer if my solution resolved the issue, thanks!
    – Bjorn
    Commented Jun 8, 2018 at 4:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.