admin管理员组文章数量:1130349
How can I display all child-pages and short by year in Wordpress
For example:
all subpages in 2016, 2017, 2018:
• 2018:
----- Subpage A
----- Subpage B
----- Subpage C
• 2017:
----- Subpage A
----- Subpage B
----- Subpage C
• 2015:
----- Subpage A
----- Subpage B
----- Subpage C
Your time amend help is greatly appreciated.
My code
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');
How can I display all child-pages and short by year in Wordpress
For example:
all subpages in 2016, 2017, 2018:
• 2018:
----- Subpage A
----- Subpage B
----- Subpage C
• 2017:
----- Subpage A
----- Subpage B
----- Subpage C
• 2015:
----- Subpage A
----- Subpage B
----- Subpage C
Your time amend help is greatly appreciated.
My code
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');
本文标签: theme developmentHow to display all subpages and short by year
版权声明:本文标题:theme development - How to display all subpages and short by year 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749127437a2320017.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论