Tag Info

New answers tagged

0

I found this in the Conditional Tags codex, section 2.12: "Note: There is no function to check if a page is a sub-page. We can get around the problem: if ( is_page() && $post->post_parent > 0 ) { echo "This is a child page"; } So I've altered it as below and will just use the wp_list_pages function's "title_li" attribute to ...


1

Based on the comment exchange, here's what I think you're after: <h1><?php echo get_the_title( $post->post_parent ? $post->post_parent : $post->ID ) ?></h1> <?php if ( $list = wp_list_pages( "echo=0&child_of=$post->ID" ) ) : ?> <h2>Select a sub-page</h2> <ul> <?php echo $list ...


0

<?php if ( $post->post_parent ): ?> <h1><?php echo get_the_title($post->post_parent); ?></h1> <h2><?php the_title(); ?></h2> <?php else: ?> <h1><?php the_title(); ?></h1> <?php if ( get_pages( array('child_of' => $post->ID) ) ): ?> <h2>select a sub-page</h2> ...



Top 50 recent answers are included