Menu Limitations

It shouldn;’t be so hard. All you have to do is to use wp_get_nav_menu_items filter. This will add 10 posts to submenu of item which title is equal to ”. function insert_my_posts_to_menu( $items, $menu, $args ) { $menu_order = count($items); $child_items = array(); foreach ( $items as &$item ) { if ( $item->title != ‘<SOME … Read more

Home Custom Menu Link not Working

First, I’ll assume that you have custom nav menus properly configured: register_nav_menus() in functions.php, to define theme_location values wp_nav_menu() calls in the template, with theme_location called in the args array Custom nav menus defined in the admin Custom nav menu(s) assigned to Theme Locations If that’s the case, then the issue is that you’re using … Read more

Can’t include Language switch in Nav Menu

You have to return the data in the qtrans function: function qtrans_generateLanguageListCode($id=”) { global $q_config; if (is_404()) $url = get_option(‘home’); else $url=””; if (” === $id) $id = ‘qtranslate’; $id .= ‘-chooser’; $output=””; foreach (qtrans_getSortedLanguages() as $language) { $classes = array(‘lang-‘.$language); if($language == $q_config[‘language’]) $classes[] = ‘active’; $output .= ‘<li class=”‘. implode(‘ ‘, $classes) .'”><a … Read more

Creating a navigation menu of all posts of a custom post type and their children posts?

Here is the general logic that can be used to fetch the child custom posts What I’ve assumed here is, You create a county post, then you create a area post and from parent metabox you select the desired county post and save the post id in post_parent function wpse_128630_cp( $post_type=”county”, $post_parent=””, $posts_per_page = -1 … Read more

Change an li class name in a wordpress custom menu walker

Troubleshooting Enabling the WP_DEBUG constant in wp-config.php exposed the following errors: – Function Signatures If Strict Standards is enabled, you’ll see an error detailing incompatible method signatures. Though not absolutely necessary, I like to eliminate as many errors as possible. To correct this, the new Walker_Nav_Menu class’s start_el() and start_lvl() methods’ declarations need to match … Read more

How to display only posts assigned to a particular, isolated, subcategory

We can change the default behaviour of including posts attached to child categories by mapping the category_name query var (set from pretty permalinks) to category__in (which ignores child categories): function wpse_184127_ignore_category_children( $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->is_category() && $name = $wp_query->get( ‘category_name’ ) ) { if ( $term = get_term_by( ‘slug’, sanitize_title_for_query( $name … Read more

Prepend to start of WordPress nav loop

Instead of using a Walker in this instance you can use the items_wrap parameter of wp_nav_menu. $args = array( ‘container’ => ‘nav’, ‘container_class’ => ‘c-nav c-nav–vertical c-nav–collapsible’, ‘menu_class’ => ‘c-nav__collapser’, ‘theme_location’ => ‘secondary’, ‘items_wrap’ => menu_wrapper() ); wp_nav_menu($args); In the called function you can use the arguments for %1$s (id), %2$s (class), and %3$s (all … Read more

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