New answers tagged

0

Norcross's example above is right on, but I needed the possibility of internationalization. If I had the reputation, this would be a comment under Norcross's answer, but since I don't, i'll just put the modified code here. 'i18n_context' is an arbitrary namespace for the translation context, this could be the name of your plugin or theme for example. ...


0

Now it works. Im very grateful to jgraup! All that I needed to change is to add $icon = $GLOBALS[$icon_var]; and change the $menu_list structure as jgraup recommended. Even there is no need for third-party changes. The final code: function sidebar_menu() { $menu_name = 'sidebar_pages'; if (($locations = get_nav_menu_locations()) && ...


0

You need to call global $variable; before you can use the variable. Try the code below instead for that line. // setup your global scope here global $icon_var; // set the new value in global scope $icon_var = get_post_meta($menu_item->ID, '_menu_item_custom', true); // then use the variable $menu_list .= "\t\t\t\t\t<li><a ...


0

As for Wordpress 4.4 I have to use following code to make it work: function adjust_admin_menu() { global $menu; remove_submenu_page( 'themes.php', 'nav-menus.php' ); // Add nav menu as top element $menu[31] = array( __( 'Menus', 'theme-slug' ), 'edit_theme_options', 'nav-menus.php', __( 'Menus', 'theme-slug' ), 'menu-top menu-nav', 'menu-nav', ...



Top 50 recent answers are included