如果想在wordpress父页面中显示子页面列表链接,可以通过下面的代码实现,下面由wordpress教程栏目给大家介绍。
WordPress父页面中显示子页面列表将下面的代码添加到当前主题functions.php中:
functionwpb_list_child_pages(){global$post;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='<ul>'.$childpages.'</ul>';}return$string;}add_shortcode('wpb_childpages','wpb_list_child_pages');