我有一个父菜单项,它是分类名称。我想从子菜单左侧的菜单分类中添加一个带有特色帖子的大型菜单。
此代码有效并显示正确显示 html,但我不确定如何获取父菜单项文本(查询特色帖子详细信息)。
public function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "$indent</ul></div><div class=\"col-md-8\">Featured Post</div></div>\n";
}
如何在 end_lcl 函数中获取父菜单项文本?
public function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
// This is the piece I'm missing
$parent_menu_item_text = ??????;
$args = array( 'taxonomy' => $parent_menu_item_text );
// Query the post with the $args etc..
$output .= "$indent</ul></div><div class=\"col-md-8\">Featured Post</div></div>\n";
}
我已经看到了这个答案,但似乎从那时起课程代码已经更新(2013)