Changeset 1471917
- Timestamp:
- 08/10/2016 11:08:29 PM (10 years ago)
- Location:
- advanced-menu-widget/trunk
- Files:
-
- 4 edited
-
advanced-menu-widget.php (modified) (1 diff)
-
class-advanced-menu-walker.php (modified) (3 diffs)
-
class-advanced-menu-widget.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-menu-widget/trunk/advanced-menu-widget.php
r1471063 r1471917 4 4 * Plugin URI: http://webikon.sk/ 5 5 * Description: Enhanced Navigation Menu Widget 6 * Version: 0.4 6 * Version: 0.4.1 7 7 * Author: Ján Bočínec 8 8 * Author URI: http://bocinec.sk/ -
advanced-menu-widget/trunk/class-advanced-menu-walker.php
r1471063 r1471917 234 234 } 235 235 236 if ( $args[0]->only_related || $this->include_parent || $this->selected_children ) {236 if ( $args[0]->only_related || $this->include_parent || $this->selected_children || $args[0]->parent_title ) { 237 237 foreach ( $elements as &$el ) { 238 $post_parent = $args[0]->post_parent? in_array('current-menu-parent',$el->classes) : 0;238 $post_parent = ( $args[0]->post_parent || $this->include_parent ) ? in_array('current-menu-parent',$el->classes) : 0; 239 239 240 240 if ( $this->selected_children ) { … … 263 263 } 264 264 265 if ( $args[0]->parent_title && $el->current_item_parent === true ) { 266 $parent_title_key = 'parent_title_' . $args[0]->menu->slug; 267 $parent_title = $el->title; 268 $old_parent_title = wp_cache_get( $parent_title_key ); 269 if ( $parent_title != $old_parent_title ) { 270 wp_cache_set( $parent_title_key, $parent_title ); 271 } 272 } 265 273 } 266 274 } … … 293 301 } elseif ( (! empty( $top_parent ) && $top_parent == $e->ID ) || empty( $top_parent ) ) { 294 302 $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); 303 } 304 } 305 306 if ( ! $output && $args[0]->filter_selection ) { 307 $empty_array = array(); 308 foreach ( $children_elements as $orphans ) { 309 foreach ( $orphans as $op ) { 310 if ( $op->current === true ) { 311 $op->display = 1; 312 $this->display_element( $op, $empty_array, 1, 0, $args, $output ); 313 } 314 } 295 315 } 296 316 } -
advanced-menu-widget/trunk/class-advanced-menu-widget.php
r1471063 r1471917 35 35 $container_class =''; 36 36 37 38 37 // Get menu 39 38 $menu = wp_get_nav_menu_object( $instance['nav_menu'] ); … … 64 63 'start_depth' => $start_depth, 65 64 'dropdown' => $instance['dropdown'], 65 'parent_title' => $parent_title, 66 66 ); 67 67 … … 77 77 } 78 78 79 if ( $parent_title ) { 80 $menu_items = wp_get_nav_menu_items( $menu, array( 'update_post_term_cache' => false ) ); 81 82 if( $menu_items ) { 83 $instance['title'] = $menu_items[0]->title; 84 } 79 if ( $parent_title && $cached_parent_title = wp_cache_get( 'parent_title_' . $menu->slug ) ) { 80 $instance['title'] = $cached_parent_title; 85 81 } 86 82 … … 151 147 $instance['nav_menu'] = (int) $new_instance['nav_menu']; 152 148 $instance['depth'] = (int) $new_instance['depth']; 153 $instance['only_related'] = ! $new_instance['filter_selection'] ? (int) $new_instance['only_related'] : 0;149 $instance['only_related'] = ! $new_instance['filter_selection'] ? (int) $new_instance['only_related'] : 0; 154 150 $instance['filter_selection'] = (int) $new_instance['filter_selection']; 155 151 $instance['container'] = $new_instance['container']; -
advanced-menu-widget/trunk/readme.txt
r1471063 r1471917 5 5 Requires at least: 4.1 6 6 Tested up to: 4.5.3 7 Stable tag: 0.4 7 Stable tag: 0.4.1 8 8 License: GPLv2 or later 9 9 … … 91 91 == Changelog == 92 92 93 = 0.4.1 = 94 * Fix for first parent item as a title not working as expected 95 93 96 = 0.4 = 94 97 * First stage of code refactoring and cleanup
Note: See TracChangeset
for help on using the changeset viewer.