Tag Info

New answers tagged

0

This drove me crazy. Here is the solution, hope someone find it useful or suggest a better and shorter solution: class sstmyp_Walker_Nav_Menu extends Walker_Nav_Menu { function display_element($element, &$children_elements, $max_depth, $depth=0, $args, &$output) { $id_field = $this->db_fields['id']; // add custom class and ...


2

As i got the solution so i am posting it here. Wordpress uses current-menu-ancestor and current_page_ancestor classes. So we can use them as below .mainmenu .current_page_item > a, .mainmenu .current_page_ancestor > a, .mainmenu .current-menu-item > a, .mainmenu .current-menu-ancestor > a { font-style: italic; }


0

You can remove the container and ul tag like this: <?php wp_nav_menu( array( 'container' => '', 'items_wrap' => '%3$s' ) ); ?> Now you can see an architecture like this: <li> <a href="#">item</a> </li> And i think you could adjust your stylesheet to adapt "li" tag. Hope it helps.


0

Have you included the required bootstrap .js files? If so it should open the dropdown on click. If you didnt want it to work like that you may add css to open the dropdown, However the markup would need to be changed. You can use a nav walker to produce the output you want.


0

I have the same issue. Some answers claim that you can use $args->has_children or $args[0]->has_children, but it's never added to $args. Sometimes, has_children is added under $args->walker->has_children, but it's always set to false, in other words, useless... As a work around, the current template that I'm using adds a class to items that ...


0

When you are adding the menu slug as edit.php?post=706&action=edit, it is adding in the url after admin.php considering it as a new page in admin dashboard (general behaviour of add_menu_page()) So, you should give a fully qualified url instead. I think, admin_url() should help. Try adding admin_url('post.php?post=706&action=edit') Or ...


0

For the reasons I probably don't want to hear about, curiously get_pages() does not actually uses WP_Query internally. Like every other way to retrieve posts does. From a quick look a source it always treats meta_value as string, which I would guess is the reason for you not getting expected behavior. I would suggest to try use get_posts() instead for more ...


0

After more research and finally finding the answer, I was correct that there is no code in template php files that generates the menu. While looking into functions.php file I noticed that this theme connects jquery.slicknav.min.js to the page, when I looked into not minified version I figured out that this the code that generates the extra menu at the top of ...


2

WordPress menus are their own Post Type ( nav_menu_item ). Every time you add a new item to a menu it create a new "post" in the nav_menu_item post type and assigns it a new ID just as deleting and recreating a page removes / adds new ids. This means the only way the Navigation Item ID will change is if the item is removed from the Menu. You'll never have ...



Top 50 recent answers are included