how to display part of a menu tree?

后端 未结 7 1631
无人共我
无人共我 2021-01-03 02:50

I\'m trying to deal with Wordpress 3.0. It\'s rather cool thing but I can\'t get on with one problem. For example, I have such menu tree. Menu tree is constructed from pages

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-03 03:53

    mac joost's answer is great, but I would add that if you want the parent item to print, then you shouldn't unset the parent, so line 18 needs to be adjusted accordingly:

        if($item->object_id != (int)$args->start_in) { unset($sorted_menu_items[$key]); }
    

提交回复
热议问题