Chris Fullman
Forum Replies Created
-
I was able to install Wordfence 6.0.24 and successfully Network Activate it on WordPress 3.9.12 (I know, I know, it should be newer. Working on that with the client, but our hands were tied for a while.)
It seems this issue I was experiencing was introduced in Wordfence 6.0.25 through 6.1.7.
I used the Wordfence Assistant plugin to delete the tables and files and reinstalled again, but continued to get the error when the plugin was Network Activated.
However, upon trying older versions of the plugin within the 6.0.x branch, I’m thinking the issue is caused by another issue altogether. My issue may be different from saganaki’s issue.
I’m also experiencing this issue with 6.1.7. When I attempt to Network Activate the plugin, I immediately get “You do not have sufficient permissions to access this page.”
I renamed the plugin folder to wordfenceDISABLED, which caused WordPress to disable it, and I was no longer getting the error.
Forum: Themes and Templates
In reply to: Multilevel horizontal menuI actually got this handled, sort of. Not entirely sure how much more this taxes the server to render, but it works for now, and renders two independent UL elements.
Basically, I’m calling wp_nav_menu() twice, the 2nd one using a custom walker, as such:
<?php wp_nav_menu(array('theme_location'=>'header-nav', 'container'=>'', 'fallback_cb'=>'', 'depth'=>'1')); ?> <?php wp_nav_menu(array('theme_location'=>'header-nav', 'container'=>'', 'fallback_cb'=>'', 'menu_id'=>'subnav', 'container_id'=>'subnav', 'walker'=> new Extract_Current_Submenu())); ?>
Then for the custom walker, taken from another tread on this forum by petersom3000:
class Extract_Current_Submenu extends Walker_Nav_Menu { var $found_parents = array(); function start_el(&$output, $item, $depth, $args) { global $wp_query; //this only works for second level sub navigations $parent_item_id = 0; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $class_names = ' class="' . esc_attr( $class_names ) . '"'; #current_page_item // Checks if the current element is in the current selection if (strpos($class_names, 'current-menu-item') || strpos($class_names, 'current-menu-parent') || strpos($class_names, 'current-menu-ancestor') || (is_array($this->found_parents) && in_array( $item->menu_item_parent, $this->found_parents )) ) { // Keep track of all selected parents $this->found_parents[] = $item->ID; //check if the item_parent matches the current item_parent if($item->menu_item_parent!=$parent_item_id){ $output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>'; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $item_output = $args->before; $item_output .= '<a'. $attributes .'>'; $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; $item_output .= '</a>'; $item_output .= $args->after; } //} $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } } function end_el(&$output, $item, $depth) { global $found_parents; // Closes only the opened LI if ( is_array($found_parents) && in_array( $item->ID, $found_parents ) ) { $output .= "</li>\n"; } } function end_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); // If the sub-menu is empty, strip the opening tag, else closes it if (substr($output, -22)=="<ul class=\"sub-menu\">\n") { $output = substr($output, 0, strlen($output)-23); } else { $output .= "$indent</ul>\n"; } } }
That did the trick!
Anyone? Here’s a better look at what I’m trying to accomplish: https://cl.ly/3c6da46fa529b6a3799d
I have 4 top-level nav points, and each of those nav points have their own subnav. So in the WordPress menu editor, I have the following structure:
- Who We Are
- Our People
- Our Story
- Our Goal
- Our Progress
- Projects
- Current
- Existing
- Upcoming
- Join the Movement
- Find an Event
- Create a Fundraiser
- Download a Media Kit
- Create a Badge
- …
Again, I’m only looking to show the subnav of the current top-level link ONLY if the top-level link is active or one of its child links is active.
Any ideas on how to do this with a custom walker?
Forum: Themes and Templates
In reply to: Multilevel horizontal menuAnyone? I’m trying to achieve the same thing as bennysce.