Reputation: 1276
How to create links in the child theme files? I have a custom template, and had a menu generated by wordpress:
<section class="top-bar-section">
<?php wp_nav_menu(array('theme_location' => 'primary', 'menu_class' => 'menu right')); ?>
</section>
But since I had to customize the top bar I have created my own top bar:
<ul class="vertical menu text-center">
<li><a href="#"></a></li>
<li><a href="#"></a></li>
<li><a href="#"></a></li>
<li><a href="#"></a></li>
<li><a href="#"></a></li>
<li><a href="#"></a></li>
</ul>
How can I create links to my other pages in that menu?
Upvotes: 0
Views: 48
Reputation: 81
You can create menu links using this code:
<?php
$menuArray = wp_get_nav_menu_items('menu_name');
foreach($menuArray as $menu):
?>
<a href="<?php echo esc_url($menu->url);?>" class="vertical menu text-center"><?php echo $menu->title;?></a>
<?php
endforeach;
?>
Hope this code works for you.
Upvotes: 1