Created
November 6, 2012 21:54
-
-
Save ellenmva/4027846 to your computer and use it in GitHub Desktop.
Child Page Menu Before Primary Sidebar Pagelines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* List child pages in content area | |
*/ | |
function base_list_children() { | |
global $post; | |
$page_ID = $post->ID; | |
$ancestors = get_post_ancestors($page_ID); | |
$children = wp_list_pages("child_of=$page_ID&echo=0"); | |
if( $children ) { | |
$parent = $post->ID; | |
} elseif ( $ancestors ) { | |
$parent = $post->post_parent; | |
} | |
if( isset($parent) ) { | |
$section = get_the_title($parent); | |
$childlist = wp_list_pages("title_li=&child_of=$parent&echo=0"); | |
if( $childlist ): ?> | |
<div id="child-pages" class="widget"> | |
<div class="widget-pad"> | |
<div class="textwidget sub-nav"> | |
<ul> | |
<h3><?php $permalink = get_permalink($post->post_parent); ?> | |
<a href="<?php echo $permalink; ?>"> <?php echo $section ?></a></h3> | |
<?php echo $childlist; ?> | |
</ul> | |
</div> | |
</div> | |
</div><!--// end #child-pages --> | |
<?php | |
endif; | |
} | |
} | |
add_action('pagelines_before_sb_primary','base_list_children');/* Change Pagelines Default Widget */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add to child theme functions.php file