WordPress.org

Plugin Directory

Changeset 522118


Ignore:
Timestamp:
03/22/12 09:48:37 (2 years ago)
Author:
phill_brown
Message:

Fixed bug when menus exist but none have menu items available

File:
1 edited

Legend:

Unmodified
Added
Removed
  • menu-rules/trunk/admin/meta-box.php

    r521955 r522118  
    1616        if ( ! $nav_menus ) return; 
    1717 
     18        $nav_menu_dropdown_values = array(); 
    1819        foreach ( $nav_menus as $nav_menu_obj ) { 
    1920 
     
    2627            ); 
    2728        } 
     29 
     30        // No items in any menus 
     31        if ( ! $nav_menu_dropdown_values) return; 
    2832 
    2933        // Condition fields 
     
    7882    function display( $post ) { 
    7983 
    80         $nav_menus = wp_get_nav_menus( array('orderby' => 'name') ); 
    81  
    82         // User need to create a menu before using menu rules 
    83         if ( ! $nav_menus ) { 
    84             echo '<p class="error-message">' . sprintf( __('You aren\'t using WordPress custom menus. %sCreate one now to start using Menu Rules%s', 'menu-rules'), '<a href="' . admin_url( 'nav-menus.php' ) . '">', '</a>' ) . '</p>'; 
     84        // User need to create a menu or before using menu rules 
     85        if ( ! $this->get_fields() ) { 
     86            echo '<p class="error-message">' . sprintf( __('You haven\'t setup any WordPress custom menus. %sCreate one now to start using Menu Rules%s', 'menu-rules'), '<a href="' . admin_url( 'nav-menus.php' ) . '">', '</a>' ) . '</p>'; 
    8587            return; 
    8688        } 
Note: See TracChangeset for help on using the changeset viewer.