Menu items id’s – are they 100% unique?

Yes it is always unique. id 814 cant be applied again unless you update it manually on your DB. Its because of auto increment .. DB automatically increment id so everytime next id will be +1 814 815 816 and so on.. Even if you delete an id in between. It wont affect auto incrementation. … Read more

How to register custom menu widget

Try this code (in function.php) class MyWidget extends WP_Widget { function __construct() { $widget_ops = array( ‘description’ => __(‘Use this widget to add one of your custom menu as a link list widget.’) ); parent::__construct( ‘custom_menu_widget-1’, __(‘My name’), $widget_ops ); } function widget($args, $instance) { // Get menu $nav_menu = ! empty( $instance[‘nav_menu’] ) ? … Read more

How to remove a metabox from menu editor page?

By inspecting the file /wp-admin/nav-menus.php we can see that these meta-boxes: are rendered with: <?php do_meta_boxes( ‘nav-menus’, ‘side’, null ); ?> The file /wp-admin/includes/nav-menu.php contains the corresponding add_meta_box() calls and from that we can construct the relevant removal code: function custom_remove() { remove_meta_box(‘nav-menu-theme-locations’, ‘nav-menus’, ‘side’); remove_meta_box(‘add-custom-links’, ‘nav-menus’, ‘side’); remove_meta_box(‘add-post’, ‘nav-menus’, ‘side’); remove_meta_box(‘add-page’, ‘nav-menus’, ‘side’); remove_meta_box(‘add-category’, … Read more

Custom wp_nav_menu output (displaying all child elements of top menu element in current branch)

The idea Instead of create a custom walker I thought was easier filter the items using the filter wp_nav_menu_objects hook. This hook is defined in /wp-includes/nav-menu-templates.php and whe is fired, it pass to functions hooking into it an array $sorted_menu_items that contains all the elements of the menu being printed, if the function alter that … Read more

How to add menu to Dashboard that can be viewed by all users

You have to use the right capability for this. You chose manage_options, which by default only users with an Administrator user role have. So, change it to read or exist, for instance, and every user will be able to see and access the menu. add_dashboard_page( ‘custom menu title’, ‘Test’, ‘read’, ‘custompage’, ‘my_custom_menu_page’, plugins_url( ‘test/images/icon.png’ ), … Read more

Add Page ID class to nav menu items

We can add custom nav menu classes through the nav_menu_css_class filter. Example: The following should add the CSS class wpse-object-id-{object_id} to the <li> tags: // Add filter add_filter( ‘nav_menu_css_class’, ‘wpse_menu_item_id_class’, 10, 2 ); // Your navigational menu wp_nav_menu( $args ); // Remove filter remove_filter( ‘nav_menu_css_class’, ‘wpse_menu_item_id_class’, 10, 2 ); where we define the filter callback … Read more

Reflect nested categories in appearance > menus

Seems to be a long-standing issue. This plugin seems to do the trick. I’ve also found an alternative solution (which I’ve posted in the thread). Reproduced below: <?php add_filter( ‘nav_menu_meta_box_object’, ‘disable_pagination_in_menu_meta_box’, 9 ); function disable_pagination_in_menu_meta_box($obj) { $obj->_default_query = array( ‘posts_per_page’ => -1 ); return $obj; } ?> Update: Needs to be added with priority 9 … Read more

Directing a page to a default subpage

Using WordPress custom nav menus create a menu and add the “General” page 2 times. The first as the parent and the second as the first child then add the rest of the pages as childs under the first General. Change the title in the first general to movies then on the front end when … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)