Php 更改wp_列表_页面的结构
我使用functions.php中的以下函数列出当前页面的所有子项Php 更改wp_列表_页面的结构,php,wordpress,Php,Wordpress,我使用functions.php中的以下函数列出当前页面的所有子项 function wpb_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 . '&
function wpb_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');
函数wpb_list_child_pages(){
全球$员额;
如果(是页面()&&$post->post\U父项)
$childpages=wp\u list\u pages('sort\u column=menu\u order&title\u li=&child\u of='。$post->post\u parent.&echo=0');
其他的
$childpages=wp_list_pages('sort_column=menu_order&title_li=&child_of='。$post->ID.&echo=0');
如果($childpages){
$string=“”.$childpages.“
”;
}
返回$string;
}
添加快捷码(“wpb_子页面”、“wpb_列表_子页面”);
这将创建如下结构:
<ul>
<li><a href="#">Link</a><li>
<ul>
-
这给了我一个很小的“热门领域”在我的网站上。我希望结构可以这样改变:
<a><li>Link</li></a>
链接
这是否可能?如果可能,如何实现