Excluding current page from sidebar and including page of different template
-
Hi,
I’ve been trying to do this for hours and have read many forum posts with no success.
I’ve created a sidebar on a page. It displays a link to the current page that the user is on, along with a link to a child page.
The structure is as follows:
Parent page
> Child page 1
> Child page 2
> Child page 3Questions:
1. How do I exclude the current page from the sidebar?
2. How do I include child page 3 in the sidebar, if it uses a different template.php to Child pages 1 and 2?
Current code for the custom sidebar widget is:// Display widget function widget( $args, $instance ) { extract( $args ); global $post; if ( $post->post_parent != 0 ) { echo $before_widget; echo $before_title . get_the_title( $post->post_parent ) . $after_title; echo '<nav>'; echo '<ul>'; wp_list_pages( array( 'post_type' => 'page', 'child_of' => '37', 'sort_column' => 'post_title', 'title_li' => '' ) ); echo '</ul>'; echo '<nav>'; echo $after_widget; }
Any help would be much appreciated.
Many thanks
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Excluding current page from sidebar and including page of different template’ is closed to new replies.