In my theme there is a function for nav menus
function ct_nav() {
<nav>
<?php wp_nav_menu( array( 'container_id' => 'nav', 'theme_location' => 'primary') ); ?>
</nav>
}
How could i add more item manually? using this function alone.
In my theme there is a function for nav menus
function ct_nav() {
<nav>
<?php wp_nav_menu( array( 'container_id' => 'nav', 'theme_location' => 'primary') ); ?>
</nav>
}
How could i add more item manually? using this function alone.
You must be logged in to post a comment.
here is an example by changing the items_wrap.
just took the default value and added the href.
Just for the case someone needs this:
Menu items can be added manually by applying filters:
wp_nav_menu_items
– for all menuswp_nav_menu_{$menu->slug}_items
– for menu with particular slugAlso by changing
items_wrap
, e.g., by removing<ul>
and adding it explicitly in the theme – this way you will be able to add own items.None of the above answers worked for me. This is a jquery type of workaround I used. I needed to add an image to the end of my menu.
Use wp_nav_menu() as per normal, be sure to specify a class in menu_class or you can specify an ID.