Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Child Page Menu Before Primary Sidebar Pagelines
* 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">
<h3><?php $permalink = get_permalink($post->post_parent); ?>
<a href="<?php echo $permalink; ?>"> <?php echo $section ?></a></h3>
<?php echo $childlist; ?>
</div><!--// end #child-pages -->
add_action('pagelines_before_sb_primary','base_list_children');/* Change Pagelines Default Widget */

Add to child theme functions.php file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.