0
我正在使用以下代碼將父級子頁面的菜單打印到ul li菜單中。它的效果很好。然而,我沒有能力只在當前頁面的用戶名 - 類似wordpress用於主菜單代碼的類名稱管道 - 我很好奇我需要在此代碼中更改管道當前菜單項班級名稱?將類名稱添加到當前菜單項目爲父項目的子頁面在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');