Subpages of Subpages
-
This is not really a problem rather a request. I would like to be able to have this widget get all the subpages of the subpage. I have currently changed/added some lines in be-subpages-widget.php to do this. I then use css to hide the sub-subpages and use a :hover to show them as sublinks. Here are the changes I’ve made in the above file.
function build_subpages( $subpages, $parents, $deep_subpages = 0, $depth = 1, $nest_subpages = 0 ) { if( empty( $subpages ) ) return; global $post, $be_subpages_is_first; // Build the page listing // ADDED THIS IF() HERE TO ADD AN IMAGE TO THE CHILD THAT CONTAINS CHILDERN if ($depth != 1){ echo '<img src="https://huntsd.org/wp-content/plugins/be-subpages-widget/drop_down_arrow.gif" style="float:right;"/><ul class="sub_subpages">';} else{ echo '<ul class="subpages" id="accordian">';//added <div id="accordian"> }//END CHANGE foreach ( $subpages as $subpage ) { $class = array(); // Unique Identifier $class[] = 'menu-item-' . $subpage->ID; // Set special class for current page if ( $subpage->ID == $post->ID ) $class[] = 'widget_subpages_current_page'; // First menu item if( $be_subpages_is_first ) $class[] .= 'first-menu-item'; $be_subpages_is_first = false; $class = apply_filters( 'be_subpages_widget_class', $class, $subpage ); $class = !empty( $class ) ? ' class="' . implode( ' ', $class ) . '"' : ''; echo '<li' . $class . '><a href="' . get_permalink( $subpage->ID ) . '">' . apply_filters( 'be_subpages_page_title', $subpage->post_title, $subpage ) . '</a>'; // If nesting supress the closing li if (!$nest_subpages) echo '</li>'; do_action( 'be_subpages_widget_menu_extra', $subpage, $class ); // Check if the subpage is in parent tree to go deeper //if ( $deep_subpages && in_array( $subpage->ID, $parents ) ) { I'M REALLY NOT EXACTLY SURE WHAT THIS IF DOES BUT IT DOESN'T ALLOW THE CHILD PAGE TO GET IT'S CHILDREN PAGES $args = array( 'child_of' => $subpage->ID, 'parent' => $subpage->ID, 'sort_column' => 'menu_order', 'post_type' => get_post_type(), ); $deeper_pages = get_pages( apply_filters( 'be_subpages_widget_args', $args, $depth ) ); $depth++; $this->build_subpages( $deeper_pages, $parents, $deep_subpages, $depth, $nest_subpages ); //} // If li was surpressed for nesting echo it now if ($nest_subpages) echo '</li>'; } echo '</ul>'; }
This also adds a subpages css class for applying style.
My site is https://www.huntsd.org and examples can be found under District Info.I’m only asking for this to maybe a possibility for an actual release and not sure if this is even the place to put this. Thanks for the consideration.
- The topic ‘Subpages of Subpages’ is closed to new replies.