Hide menu theme location for certain capabilities?

Check user capabilities or roles when registering the navigation menu. The data will remain accessible via wp_nav_menu, but users without the capabilities won’t see the location in Appearance -> Menu -> Manage locations. Note this will only prevent assigning menus to these locations. Any menu assigned to the location already will be manageable (if the … Read more

Calling the first & last post by category in custom post type

It is sometimes irritating that some build-in functions don’t have appropriate filters to modify their output. get_boundary_post() is one of those build-in functions. Unfortunately it does not get posts according to post type, only taxonomy. You can still however make use of this function to get the first and last post. It does support the … Read more

Get menu items problem

I tried with the name and the slug and different menus but I always find that error. Did you try with location slug? Take a look at where your menu location is defined (functions.php), for example: register_nav_menus( array( ‘primary’ => __( ‘Primary Menu’, ‘mytheme’ ), ) ); On Appearance->Menus assign your menu to that location. … Read more

WP Super Large Menu Problem

From first view this seems to be tough job, but actually even I having small skills of php could solve this problem just adding following code to my custom walker class: if ( $depth == 1 ) { // remove this statement if depth check is not required if (wp_get_nav_menu_object($item->title)) {// checking if item name … Read more

Importable Menus? Along with Pages (a site layout template)

Menus are included in native WordPress export. It’s not too convenient that natively you can’t only export menus though. From quick look up there is WordPress Menu Exporter plugin available in official repository for that. Export/import aside there are more options to automate it, such as set up scripts with WP CLI or simply using … Read more

Pass $item->description to start_lvl

// Get menu description as global variable function add_menu_description( $item_output, $item, $depth, $args ) { global $description; $description = $item->post_content; return $item_output; } add_filter( ‘walker_nav_menu_start_el’, ‘add_menu_description’, 10, 4); // Submenu walker to add image class submenu_walker extends Walker_Nav_Menu { function start_lvl( &$output, $depth = 0, $args = array() ) { if(0 == $depth) { global … Read more

Menu item hidden behind others

You are correct that this is definitely a CSS issue. To get the 3rd level menu to show up fully, you’ll want to target it and move it X number of pixels from the left until it lines up correctly. If your sub-menu’s have a set width, then use that set width to move the … Read more

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