WordPress.org

Plugin Directory

Changeset 572793


Ignore:
Timestamp:
07/15/12 22:01:28 (21 months ago)
Author:
wpsmith
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-custom-menu-filter-plugin/trunk/wps-filter-custom-menu.php

    r526715 r572793  
    5656 
    5757//  this function registers our settings in the db 
    58 add_action( 'admin_init' , 'wps_register_settings' ); 
     58add_action( 'admin_init', 'wps_register_settings' ); 
    5959function wps_register_settings() { 
    6060    register_setting( 'wpcmfp_settings' , 'wpcmfp_settings' , 'wpcmfp_settings_validate' ); 
     
    6868 
    6969// add "Settings" link to plugin page 
    70 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__) , 'wps_plugin_action_links' ); 
     70add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'wps_plugin_action_links' ); 
    7171function wps_plugin_action_links( $links ) { 
    7272    $wpcmfp_settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'themes.php?page=wps-filter-menu' ), __('Settings') ); 
     
    7777// settings section 
    7878function wps_settings_page() { 
    79      
     79 
    8080    echo '<div class="wrap">'; 
    8181     
     
    180180     
    181181    // Remove any HTML, text only 
    182     foreach ($input as $key => $val ) { 
     182    foreach ( $input as $key => $val ) { 
    183183        $input[ $key ] = wp_filter_nohtml_kses( $val ); 
    184184    } 
     
    186186} 
    187187 
    188 function wps_custom_nav_menu_items( $sorted_menu_items, $args ){ 
     188add_filter( 'wp_nav_menu_objects', 'wps_custom_nav_menu_items' , 90 , 2 ); 
     189function wps_custom_nav_menu_items( $sorted_menu_items, $args = array() ) { 
    189190    global $wpcmfp_settings; 
    190191    $args = (array) $args; 
     
    204205     
    205206    // Get the class to exclude 
    206     if ( !is_user_logged_in() ) { 
     207    if ( ! is_user_logged_in() ) { 
    207208        $exclusion_class = $wpcmfp_settings[ 'menu-' . $menu_id . '-loggedout' ]; 
    208209    } 
     
    210211        $exclusion_class = $wpcmfp_settings[ 'menu-' . $menu_id . '-loggedin' ]; 
    211212    } 
     213     
     214    $modified_nav_items = array(); 
    212215     
    213216    // Cycle through all nav_items 
     
    240243    return $modified_nav_items; 
    241244} 
    242  
    243 add_filter( 'wp_nav_menu_objects', 'wps_custom_nav_menu_items' , 10 , 2 ); 
Note: See TracChangeset for help on using the changeset viewer.