Skip to content

Instantly share code, notes, and snippets.

@ximosa
Last active December 1, 2016 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ximosa/18469f9f389a8033f19389339ed16660 to your computer and use it in GitHub Desktop.
Save ximosa/18469f9f389a8033f19389339ed16660 to your computer and use it in GitHub Desktop.
Listado paginas hijas
// función para poner código corto [wpb_childpages].
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');
// hasta aqui en un plug-in o en el functions.php de su temaa
// Para poner dentro de una pagina personalizada.
<?php wpb_list_child_pages(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment