0
次のコードを使用して、親の子ページのメニューをul liメニューに印刷しています。それは素晴らしい作品です。しかし、私は現在のページのためのクラス名でパイプする能力を持っていない - 同じ概念WordPressのメインメニューのコードを使用する - 私はこのコードでは、現在のメニュー項目でパイプに変更する必要があります好奇心クラス名?ワードプレスのメニューの親項目の子ページの現在のメニュー項目にクラス名を追加
function nee_list_child_pages() {
global $post;
$string = '';
if (is_page() && $post->post_parent)
$childpages = wp_list_pages('sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0');
else
$childpages = wp_list_pages('sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0');
if ($childpages) {
$string = '<div id="sidebar_menu"><ul>' . $childpages . '</ul></div>';
return $string;
}
}
add_shortcode('wpb_childpages', 'nee_list_child_pages');