Removing container from wp_nav_menu not working

[SOLVED] IT DOES NOT WORK when you are referring to an inexisting location. e.g. when you copied the code from somewhere else, or you haven’t created your menu or location yet in the dasboard. e.g. remove “, ‘theme_location’ => ‘primary’” from the following code: wp_nav_menu( array( ‘container’=> false, ‘menu_class’=> false, ‘menu_id’=> ‘ia_toplevel’, ‘theme_location’ => ‘primary’ … Read more

Split up wp_nav_menu with custom walker

Using a custom Walker, the start_el() method has access to $depth param: when it is 0 the elemnt is a top one, and we can use this info to maintain an internal counter. When the counter reach a limit, we can use DOMDocument to get from full HTML output just the last element added, wrap … Read more

Dynamically exclude menu items from wp_nav_menu

Method 1 You can add a constructor to your custom Walker to store some additional exclusion arguments, like: class custom_nav_walker extends Walker_Nav_Menu { function __construct( $exclude = null ) { $this->exclude = $exclude; } function skip( $item ) { return in_array($item->ID, (array)$this->exclude); // or return in_array($item->title, (array)$this->exclude); // etc. } // …inside start_el, end_el if … Read more

WordPress default menu in database

Menu by itself is a taxonomy in WP. It means that you can find all menus in wp_terms table, by running following query: SELECT * FROM wp_terms AS t LEFT JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id WHERE tt.taxonomy = ‘nav_menu’; Menu item is custom post type in WP. They are stored in wp_posts … Read more

How do I remove UL on wp_nav_menu?

The function wp_nav_menu takes an argument of fallback_cb which is the name of the function to run if the menu doesn’t exist. so change you code to something like this: function wp_nav_menu_no_ul() { $options = array( ‘echo’ => false, ‘container’ => false, ‘theme_location’ => ‘primary’, ‘fallback_cb’=> ‘fall_back_menu’ ); $menu = wp_nav_menu($options); echo preg_replace(array( ‘#^<ul[^>]*>#’, ‘#</ul>$#’ … Read more

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