Simple, don’t bundle the function inside. Instead, break it out like this:
//--Nav Menu
function add_profile_link_to_nav(){
if ( is_user_logged_in() ) { ?>
<ul>
<li class="menu-item"id="one"> <a href="http://example.com/members/">All Members</a>
<ul class="sub-menu">
<?php echo custom_execute_shortcode(); ?>
<li class="menu-item"> </li>
</ul>
</li>
</ul> <!--end menu--->
<?php }
}
add_action( "wp_nav_items","add_profile_link_to_nav" );
function custom_execute_shortcode() {
$myfunction= '[Shortcode]';
$myfunction_parsed = do_shortcode($myfunction);
return $myfunction_parsed;
}
Related Posts:
- Customizing Only a Specific Menu using the “wp_nav_menu_items” Hook?
- How make top level menu item not have link, but have sub-menus that are linked?
- Using a menu walker add a custom item at the end of the menu’s items
- Add settings to menu items in the Customizer
- Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?
- How Does The Walker Class Work?
- WordPress Shortcode in Menu Item Title
- Calling the Menu Title within wp_nav_menu array function
- How to hide an item from a menu to logged out users (without a plugin)
- Menu items (all menus) being deleted randomly on their own [duplicate]
- Large WP 3.0 menu times out and won’t save
- How to apply a class to the second word in menu list item?
- Put a wp_nav_menu inside another one
- How to switch between the Primary Menus programmatically?
- WordPress wp_nav_menu within iFrame
- Generate a Menu that displays all child pages of top level parent
- Terms with more than one occurrence have current-menu-item class in menu
- Check if wp_nav_menu items have submenus
- start_lvl on Walker is not working
- How to get Menu Navigation Labels to output HTML
- custom menu not found
- wp_nav_menu doesn’t generate parent/ancestor classes
- WP_nav_menu fallback not working
- How to conditionally register nav menus with advanced custom fields?
- Pending Custom Link in Menu
- Benefits of using Nav Walker?
- Change where navigation bar links?
- Social Links Menu displays icon instead of text (twentyfifteen) [closed]
- has_children in custom nav_walker
- Does wp_nav_menu use the gettext filter?
- How to add #navbar to all page links?
- How to add wechat (weixin) link to navigation menu?
- Create search form in menu as in Twenty Fourteen theme
- Add link at the end of wp_nav_menu
- Link that refers to a menu item with dynamically generated URL
- Change an li class name in a wordpress custom menu walker
- Custom walker nav – Add sequential number as class
- WordPress Custom Menus Issue
- Side Menu Icon Expandable
- wordpress responsive menu not dropping down
- delete all post with certain meta_keys
- Make nav-menus.php available for editor
- how to add custom wp_nav_menu class css selector to ul and a tags?
- Need Random Category Nav Menu
- Split into two seperate unordered lists with custom walker
- Can’t add a setting to the “nav_menus” customizer panel
- edit user menu item
- How to remove UL class in wp_nav_menu?
- Displaying menu based on login status
- Excluding a media query from specific pages
- Use dashicons in menu items?
- Menu Arrow for Child Element
- Custom menu with different behavior for every item
- Responsive dropdown menu with smaller screen sizes
- Adding an external link to wordpress menu
- Menu separator appearing on next line
- Add a counter beside menu item label
- Why is my array of nav menus returning empty?
- How to create a complete mulilanguage site using xili language plugin?
- Add pages content to startpage through custom menu
- Can you exclude child pages of a specific parent within a navigation?
- Add posts from a category to menu with all posts in it as sub menu
- Possible to append class to nav menu added to widget area?
- Page dependent sub-menu?
- Making the menu toggled open on mobile devices Illustratr theme
- How to include second layer sub menu to Walker Nav?
- need help in wordpress navbar setup
- How can I creat custom menu with bootstrap
- Removing wp admin menu item on top bar of admin backend
- Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()
- WordPress nav-menus not finding page
- Restrict user to edit only edit a certain menu
- Primary menu items are dissapearing
- Where is the source code in the console coming from?
- Migrate old blogroll to menus automatically
- Getting parent object_id of child menu items in WordPress menu
- How to remove a sub-menu using walker hooks/filters without relying on a custom walker?
- display cart information within li of cart menu item
- Calling wordpress menu outside ignores custom menu item
- Specific Page that convert Hyperlink to anchor in nav menu
- Removing menu item doesn’t get removed on edit post
- change link of menu particular tab
- Next page link via the custom menu
- How can I make this custom design menu work in wordpress?
- Active menu item / category
- Add different span class to wp nav menu
- Top menu link anchor href value change after online server?
- Menu not always using correct link
- Custom Menus and taxonomies
- Help with changing style of the extended menu drop down [closed]
- How we show pages in dropdown
- wp_nav_menu doesn’t show on index page
- How to add posts with thumbnails to my dropdown menu?
- Automatically add new posts to a specific menu name
- can anyone help me converting my static menu to wp_nav_menu I’am trying to add static menu item to WordPress Menu
- Elegant way of adding an CTA to a menu
- Theme supports only one menu. I need to add more – but how? [closed]
- How to set menu Display location
- How to add custom menu to block theme?
- get menu name for the current displayed page