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