I have the following nav element in regular html. I would like to convert it to a dynamic loop in wordpress. I have already created the pages in Wordpress. I just want to register the nave menu. The problem is, I have more than one ul tag, so i'm not quite sure how to proceed. Here is the following code:
<nav id="footerNav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Who we Are</a></li>
<li><a href="#">What we Believe</a></li>
</ul>
<ul>
<li><a href="#">Leadership</a></li>
<li><a href="#">What to Expect</a></li>
<li><a href="#">Sermons</a></li>
</ul>
<ul>
<li><a href="#">Bible Study</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Announcements</a></li>
</ul>
<ul>
<li><a href="#">Directions</a></li>
<li><a href="#">Links</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</nav>
Can someone tell what php function I would need to write to create the links dynamically in wordpress?
Personally, I use custom navigation menus: WordPress Navigation Menus
This way, I can create different nav menus for different sections of the page, and load them into different sections of the template. It even automatically creates widgets for them.
Edit: A nice array:
$uls = array( array('Home', 'Who we are', 'What we believe'),
array('Leadership', 'What to expect', 'Sermons'),
...
);
Assuming you have all your data in a nice array:
foreach $uls as $ul {
echo "<ul>";
foreach($ul as $li)
echo "<li>".$li."</li>";
echo "</ul>";
}
Step 1: first of all you have to create a new menu... Appearance>> menu>>add item>> save menu
Step 2: delete your html menu and call the WordPress function
<?php wp_nav_menu(array('menu'=> 'mymenu', menu_id=>'footerNav')); ?>