There are a few ways, here’s one:
// no theme output
define('WP_USE_THEMES', false);
// initializes the entire WordPress
require '/path/to/your/wp/wp-blog-header.php';
// here you print your menu
wp_nav_menu('your_theme_menu_location');
Even if theme output is disabled, the theme’s functions.php should still be loaded (and menu locations registered).
You should cache the HTML somewhere within your script, because loading WP just to show a menu can be slow.
see http://codex.wordpress.org/Function_Reference/wp_nav_menu
Related Posts:
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- wp_nav_menu remove class and id from li
- Add separator to admin submenu
- On which hook should I be calling register_nav_menu(s)?
- Menu is not visible in appearance
- One site, 2 distinct sections: two different top nav menus?
- Make Theme automatically choose default nav menu
- How can I disable parent menu item links?
- Organizing by super-categories (or nested categories)?
- Nav menu items disappearing (but not immediately)
- wp_nav_menu custom walker – child items
- wp_nav_menu doesn’t generate parent/ancestor classes
- Add static item to wp_nav_menu
- Add nav menu CSS class to body
- Change HTML structure for custom menu in sidebar
- Using Shortcodes in WP-Menus in WP 3.1 (via nav_menu_objects)?
- Custom Admin Menu Order
- Current menu item
- remove everything from wp_nav_menu
- How to add wechat (weixin) link to navigation menu?
- Admin only menu/page
- Best way to customise wp_nav_menu [duplicate]
- How to add custom classes to more than one separate menu’s a link in wordpress?
- How do I separate link levels in a custom menu walker?
- SlideDeck 2, make back-end visible for admins only
- pull non-wp site into content area of wordpress -or- pull wp header into non wp site?
- Help with walker for nav
- Create custom page and add it in nav menu by code
- Using my WordPress menu on another platform
- Remove a menu sub-item
- How to add html attributes to the “ul” html tag with “wp_nav_menu” function?
- Using _s theme, menu changes do not affect header menu
- Limit User Iinterface for Admin?
- Make pages visible to only logged in members
- Get custom classes in WordPress Navigation Menu
- Replace the slug of parent pages with # [closed]
- How to undo the last changes to a custom menu?
- Filter to hook into menu items and add a custom attribute
- I can’t add more pages to menu – menu delete pages
- Responsive menu on genesis theme [closed]
- How to open a lightbox form from a navigation menu item
- How to create this kind of sub-menu in new line?
- Hide custom menu when when no menu selected
- Add a data attribute to list item element in menu
- how to display wordpress navbar with top menu outside wordpress system
- Creating and populating custom nav menu (menu-item-position not working)
- custom rearranged menu with excerpt for selected children in sidebar.php
- wp_nav_menu in 3.7 add name class nav navbar-nav
- Menu – custom structure
- custom walker to add iconfont to wp_nav_menu
- After WordPress 4.8 upgrade, wp_nav_menu() string search / replace not working
- Show current navigation path from menu
- How do I fix this error: Warning: invalid argument supplied for foreach()?
- Exclude one item from wp_list_pages( $args );
- different Menu position showing same menu
- Best practices: Custom theme sidebar menu – hardcode or widget?
- Sub-Pages only of menu items in current branch using a custom menu
- Hide and show menu subpages
- How to extend nav-menu-item-control data in Appearance > Customize?
- wp_nav_menu and fallback
- Counting top level items in a custom menu walker
- how do I add “home” menu item conditionally to custom menus?
- How to add div to top menu item
- wp_nav_menu including Skype URL
- Menu in left side don’t appears with dropdown
- WP custom nav menu problem
- Show WordPress Menu On External Site
- Two-tone menu items
- Submenu items not showing anymore on the navigation
- superfish.js seems it is not working properly after wordpress upgarde to 4.6.1
- Sticky menu for WP custom menubars
- Mobile screen does not display Primary navbar…just a three line icon [closed]
- New Menu Item Type Meta Box
- Using Different wp_nav_menu theme_location based on page id (or a parent id)
- Display Menu Navigation Label
- Menu is not displaying on the site navigation [closed]
- Updated WordPress, now Navigation is Messed Up
- wp_nav_menu removing containing UL with ‘items_wrap’ => ‘%3$s’ not working
- How to show only current item children using wp_nav_menu?
- Copied site has wrong menu URL behaviour
- Active Current Menu – Adding class to child theme
- WPML CMS Nav and Custom Nav_Walker Undefined Property Notices [closed]
- Add data-track to links in menu
- Is it possible to seperate wordpress menu by different div?
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- Check in walker if current page is descendant
- Add a non-dynamic phrase/character after a page title?
- Primery Menu Configuration problem
- Menus not showing in the admin menu, after save
- “Current” class on a singular page menu item with custom post types?
- Customize Walker_nav_menu to show posts if item is category
- Add Protocol to Custom Menus
- How can I stop wp_nav_menu from returning extraneous root links?
- Change menu item order
- Menu System: Custom Links
- Formatting WordPress Menus (without bullets, inline with text)
- Change Menu Order
- Custom Menu (only showing direct cildren) ACF not showing
- Rename Menu icon in Twenty seventeen theme