Plugin Directory

Changeset 1471917


Ignore:
Timestamp:
08/10/2016 11:08:29 PM (10 years ago)
Author:
JohnnyPea
Message:

v0.4.1

Location:
advanced-menu-widget/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • advanced-menu-widget/trunk/advanced-menu-widget.php

    r1471063 r1471917  
    44 * Plugin URI: http://webikon.sk/
    55 * Description: Enhanced Navigation Menu Widget
    6  * Version: 0.4
     6 * Version: 0.4.1
    77 * Author: Ján Bočínec
    88 * Author URI: http://bocinec.sk/
  • advanced-menu-widget/trunk/class-advanced-menu-walker.php

    r1471063 r1471917  
    234234        }
    235235
    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 ) {
    237237            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;
    239239
    240240                if ( $this->selected_children ) {
     
    263263                }
    264264
     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                }
    265273            }
    266274        }
     
    293301            } elseif ( (! empty( $top_parent ) && $top_parent == $e->ID ) || empty( $top_parent ) ) {
    294302                $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                }
    295315            }
    296316        }
  • advanced-menu-widget/trunk/class-advanced-menu-widget.php

    r1471063 r1471917  
    3535        $container_class ='';
    3636
    37 
    3837        // Get menu
    3938        $menu = wp_get_nav_menu_object( $instance['nav_menu'] );
     
    6463            'start_depth' => $start_depth,
    6564            'dropdown' => $instance['dropdown'],
     65            'parent_title' => $parent_title,
    6666        );
    6767
     
    7777        }
    7878
    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;
    8581        }
    8682
     
    151147        $instance['nav_menu'] = (int) $new_instance['nav_menu'];
    152148        $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;
    154150        $instance['filter_selection'] = (int) $new_instance['filter_selection'];
    155151        $instance['container'] = $new_instance['container'];
  • advanced-menu-widget/trunk/readme.txt

    r1471063 r1471917  
    55Requires at least: 4.1
    66Tested up to: 4.5.3
    7 Stable tag: 0.4
     7Stable tag: 0.4.1
    88License: GPLv2 or later
    99
     
    9191== Changelog ==
    9292
     93= 0.4.1 =
     94* Fix for first parent item as a title not working as expected
     95
    9396= 0.4 =
    9497* First stage of code refactoring and cleanup
Note: See TracChangeset for help on using the changeset viewer.