分類名である親メニュー項目があります。サブメニューの左側にあるメニュー分類から注目の投稿を含むメガ メニューを追加したいと考えています。
このコードは機能し、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)