walker - wordpress custom menu - show parents, siblings, children depending on depth

looking and trying for hours to find a solution for the following output of a wordpress custom menu. Hope you can help.

looking and trying for hours to find a solution for the following output of a wordpress custom menu. Hope you can help. I do not know where to start: custom menu walker, css, functions.php

I have a custom menu with "individual links" (so no pages or posts or categories) with Link and Link-Text. Right now depth is 5 (could be 6,7.. in the future).

Example menu:

Sport
   Bike
     Bikeparts
       Seats
         Mountainbike
         Roadbike
       Breaks
         Break Levers
         Adapters
     Bike Add Ons
       Bottle Holder
   Water
     Stand Up Paddling
       Paddel
       Boards
   Air
     Wingsuits 
Automotive
  car
  motorbike
Tools

What should it be: See following scenarios: Default View on main page (depth 0):

Sport
Automotive
Tools

Click on "Sport":

Sport (bold)
   Bike
   Water
   Air
Automotive
Tools

Click on "Bike":

Sport (bold)
   Bike (bold)
     Bikeparts
     Bike Add Ons
   Water
   Air
Automotive
Tools

Click on "Bikeparts":

Sport (bold)
   Bike (bold)
     Bikeparts (bold)
       Seats
       Breaks
     Bike Add Ons
Automotive
Tools

Click on "Breaks":

Sport (bold)
   Bike (bold)
     Bikeparts (bold)
       Seats
       Breaks (bold)
         Break Levers
         Adapters
Automotive
Tools

Click on "Break Levers":

Sport (bold)
   Bike (bold)
     Bikeparts (bold)
       Breaks (bold)
         Break Levers (bold)
         Adapters
Automotive
Tools

So you see from Depth 1 if you start depth at 0 (step: click on Bike) and deeper you will always see all depth 0 menu items (sport, automotive, Tools), all siblings from this active menu item (bike) under active parent (sport) and all children of active menu item (bike).

What i have right now is the solution from / where i replaced:

} else if ( ! ( isset( $args->show_parent ) && in_array( $item->ID, $menu_item_parents ) ) ) {

with

} else if ( ! empty( $item->menu_item_parent ) ) {

So right now it works only with the first level. if i click on sport i do not see submenu from automotive.

I hope anybody can help.

Thanks in advance

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745174968a4615144.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信