Skip to content

Commit

Permalink
Bug Fix: fixes sidebar issues stemming from hide-from-menu checkbox f…
Browse files Browse the repository at this point in the history
…unctionality
  • Loading branch information
Nick Winkelbauer committed Oct 26, 2015
1 parent b3cda9f commit 70cf318
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
19 changes: 1 addition & 18 deletions inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,6 @@ function uw_list_pages( $mobile = false )

$ids = ! is_front_page() ? array_map( function($sibling) { return $sibling->ID; }, $siblings ) : array();

$args1 = array(
'child_of' => $post->ID,
'post_type' => 'page',
'post_status' => 'publish',
'depth' => 1
);
$children_array = get_pages( $args1 );
$count = 0;
foreach($children_array as $children) {
$hidden = get_post_meta($children->ID, "parent", true);
if ( ($hidden == "on") || ( in_array($children->post_parent, $ids) ) ) { //problem causer!
$ids[] = $children->ID;
} else {
$count++;
}
}

$pages = wp_list_pages(array(
'title_li' => '<a href="'.get_bloginfo('url').'" title="Home" class="homelink">Home</a>',
'child_of' => $parent->post_parent,
Expand All @@ -137,7 +120,7 @@ function uw_list_pages( $mobile = false )
'walker' => $UW->SidebarMenuWalker
));

return ( $pages && $count!=0 ) ? sprintf( '%s<ul class="%s first-level">%s</ul>', $toggle, $class, $pages ) : '';
return $pages ? sprintf( '%s<ul class="%s first-level">%s</ul>', $toggle, $class, $pages ) : '';

}

Expand Down
13 changes: 11 additions & 2 deletions setup/class.uw-sidebar-menu-walker.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,17 @@ public function start_el( &$output, $page, $depth = 0, $args = array(), $current
apply_filters( 'the_title', $page->post_title, $page->ID ),
$args['link_after']
);
} else if ($parent[0]!="on") {
$output .= $indent . sprintf(
} else if ($parent[0] === "on" && $depth != 0) {
// $output .= $indent . sprintf(
// '<li class="%s"><a href="%s">%s%s%s</a>',
// $css_classes,
// get_permalink( $page->ID ),
// $args['link_before'],
// apply_filters( 'the_title', $page->post_title, $page->ID ),
// $args['link_after']
// );
} else {
$output .= $indent . sprintf(
'<li class="%s"><a href="%s">%s%s%s</a>',
$css_classes,
get_permalink( $page->ID ),
Expand Down

0 comments on commit 70cf318

Please sign in to comment.