Title: Adding a menu to template using shortcode
Last modified: January 26, 2020

---

# Adding a menu to template using shortcode

 *  [thetoolman123](https://wordpress.org/support/users/thetoolman123/)
 * (@thetoolman123)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/adding-a-menu-to-temporal-using-shortcode/)
 * Hi there,
 * I am trying to insert a menu to a template using a shortcode using the following,
   but it’s just outputting the actual code and not displaying the menu.
 * <?php echo do_shortcode( ‘[menu name=”about-menu”]’); ?>
 * Is there another way I can insert a menu into a template?
 * Thanks
    -  This topic was modified 6 years, 5 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [6 years, 5 months ago](https://wordpress.org/support/topic/adding-a-menu-to-temporal-using-shortcode/#post-12367192)
 * What do you mean by “into a template”? Are you asking how to add a menu item 
   programmatically? If so, I’ve done it by building the menu item in a function(
   so it has the same markup as other menu items). The menu from appearance->menu
   has a dummy item. The function searches for that in the menu, and does a strreplace,
   replacing the dummy string/link with the constructed one. The function is hooked
   to the action wp_nav_menu_items.
 * See [https://wpbeaches.com/add-menu-items-in-a-certain-place-with-wp_nav_menu_filter/](https://wpbeaches.com/add-menu-items-in-a-certain-place-with-wp_nav_menu_filter/)
   for a slightly simpler version of that.
 *  Thread Starter [thetoolman123](https://wordpress.org/support/users/thetoolman123/)
 * (@thetoolman123)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/adding-a-menu-to-temporal-using-shortcode/#post-12369693)
 * Hi,
 * Thanks for the reply.
 * I basically want to display a menu I have created in my admin in a template I
   have created. I currently have a top menu which I have added manually, but would
   like to add one that is controlled via the admin to one of my templates.
 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [6 years, 5 months ago](https://wordpress.org/support/topic/adding-a-menu-to-temporal-using-shortcode/#post-12369779)
 * You want to add a 2nd menu?
 * [https://codex.wordpress.org/Function_Reference/register_nav_menus](https://codex.wordpress.org/Function_Reference/register_nav_menus)
 *  Thread Starter [thetoolman123](https://wordpress.org/support/users/thetoolman123/)
 * (@thetoolman123)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/adding-a-menu-to-temporal-using-shortcode/#post-12369831)
 * Yes. I have created the menu, but I cannot work out how to add it to a PHP template.
 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [6 years, 5 months ago](https://wordpress.org/support/topic/adding-a-menu-to-temporal-using-shortcode/#post-12369985)
 * You display a menu via [https://developer.wordpress.org/reference/functions/wp_nav_menu/](https://developer.wordpress.org/reference/functions/wp_nav_menu/)
 * I think you need to read through the section on menus and navigation here:
    [https://developer.wordpress.org/themes/](https://developer.wordpress.org/themes/)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adding a menu to template using shortcode’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 2 participants
 * Last reply from: [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/adding-a-menu-to-temporal-using-shortcode/#post-12369985)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
