• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_get_nav_menu_object函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_get_nav_menu_object函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_nav_menu_object函数的具体用法?PHP wp_get_nav_menu_object怎么用?PHP wp_get_nav_menu_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_get_nav_menu_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: widget

    function widget($args, $instance)
    {
        extract($args);
        // Get menu
        if (!isset($instance['speed'])) {
            $instance['speed'] = 'slow';
        }
        $widget_options = wp_parse_args($instance, $this->defaults);
        extract($widget_options, EXTR_SKIP);
        $nav_menu = wp_get_nav_menu_object($instance['nav_menu']);
        if (!$nav_menu) {
            return;
        }
        $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
        $classMenu = $instance['classMenu'] != '' ? $instance['classMenu'] : 'menu';
        echo $args['before_widget'];
        if (!empty($instance['title'])) {
            echo $args['before_title'] . $instance['title'] . $args['after_title'];
        }
        ?>
		
		<div class="dcjq-accordion" id="<?php 
        echo $this->id . '-item';
        ?>
">
		
			<?php 
        wp_nav_menu(array('fallback_cb' => '', 'menu' => $nav_menu, 'container' => false, 'menu_class' => $classMenu));
        ?>
		
		</div>
		<?php 
        echo $args['after_widget'];
    }
开发者ID:healthcommcore,项目名称:osnap,代码行数:34,代码来源:dcwp_jquery_accordion_widget.php


示例2: theme_get_menu

function theme_get_menu($args = '')
{
    $args = wp_parse_args($args, array('source' => 'Pages', 'depth' => 0, 'menu' => null, 'class' => ''));
    $source =& $args['source'];
    $menu =& $args['menu'];
    $class =& $args['class'];
    if ($menu != null && is_string($menu)) {
        // theme location
        $location = theme_get_array_value(get_nav_menu_locations(), $menu);
        if ($location) {
            $menu = wp_get_nav_menu_object($location);
            if ($menu) {
                $source = 'Custom Menu';
                //Jordi
                //$class = implode(' ', array($class, 'menu-' . $menu->term_id));
                $class = implode(' ', array($class, 'menu-' . $menu->term_id, 'nav navbar-right'));
            }
        }
    }
    if ($source == 'Custom Menu' && $menu != null) {
        return theme_get_list_menu($args);
    }
    if ($source == 'Pages') {
        return theme_get_list_pages(array_merge(array('sort_column' => 'menu_order, post_title'), $args));
    }
    if ($source == 'Categories') {
        return theme_get_list_categories(array_merge(array('title_li' => false), $args));
    }
}
开发者ID:JordiCruells,项目名称:mwt,代码行数:29,代码来源:navigation.php


示例3: widget

 /**
  * Outputs the content for the current Custom Menu widget instance.
  *
  * @since 3.0.0
  * @access public
  *
  * @param array $args     Display arguments including 'before_title', 'after_title',
  *                        'before_widget', and 'after_widget'.
  * @param array $instance Settings for the current Custom Menu widget instance.
  */
 public function widget($args, $instance)
 {
     // Get menu
     $nav_menu = !empty($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : false;
     if (!$nav_menu) {
         return;
     }
     /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
     $instance['title'] = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . $instance['title'] . $args['after_title'];
     }
     $nav_menu_args = array('fallback_cb' => '', 'menu' => $nav_menu);
     /**
      * Filter the arguments for the Custom Menu widget.
      *
      * @since 4.2.0
      * @since 4.4.0 Added the `$instance` parameter.
      *
      * @param array    $nav_menu_args {
      *     An array of arguments passed to wp_nav_menu() to retrieve a custom menu.
      *
      *     @type callable|bool $fallback_cb Callback to fire if the menu doesn't exist. Default empty.
      *     @type mixed         $menu        Menu ID, slug, or name.
      * }
      * @param stdClass $nav_menu      Nav menu object for the current menu.
      * @param array    $args          Display arguments for the current widget.
      * @param array    $instance      Array of settings for the current widget.
      */
     wp_nav_menu(apply_filters('widget_nav_menu_args', $nav_menu_args, $nav_menu, $args, $instance));
     echo $args['after_widget'];
 }
开发者ID:qaryas,项目名称:qaryas_site,代码行数:43,代码来源:class-wp-nav-menu-widget.php


示例4: widget

    function widget($args, $instance)
    {
        global $post;
        $cache = wp_cache_get('widget_progressive_menu', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        $nav_menu = !empty($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : false;
        if (!$nav_menu) {
            return;
        }
        ob_start();
        extract($args);
        echo $before_widget;
        if (!empty($instance['title'])) {
            $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
            echo $before_title . esc_html($title) . $after_title;
        }
        echo '<nav>';
        wp_nav_menu(array('fallback_cb' => '', 'container' => false, 'menu' => $nav_menu, 'menu_class' => 'theme-menu', 'depth' => 2, 'walker' => new progressive_menu_widget_walker_nav_menu()));
        echo '</nav>';
        ?>

		<?php 
        echo $after_widget;
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_progressive_menu', $cache, 'widget');
    }
开发者ID:Sibzsolutions,项目名称:Schiffrinpa,代码行数:35,代码来源:WP_Progressive_Menu_Widget.class.php


示例5: get_args

 /**
  * Generate arguments depends on location and menu
  */
 function get_args($args)
 {
     $this->profile_id = WR_Megamenu_Helpers_Functions::get_profile_by_location($args['theme_location']);
     if ($this->profile_id) {
         // Show only once in one location
         if ($this->echo == $args['theme_location']) {
             $args['echo'] = FALSE;
         }
         $this->echo = $args['theme_location'];
         $args['profile_id'] = $this->profile_id;
         $this->settings = WR_Megamenu_Helpers_Builder::get_megamenu_data($this->profile_id);
         // load assets for a profile
         $this->load_profile_assets();
         $menu_type = $this->settings['menu_type'];
         $location = $this->settings['location'];
         // Get the nav menu based on the requested menu
         $menu = wp_get_nav_menu_object($menu_type);
         $locations = get_nav_menu_locations();
         if (!$menu && $location && isset($locations[$location])) {
             // Get the nav menu based on the theme_location
             $menu = wp_get_nav_menu_object($locations[$location]);
         }
         if ($menu && $menu->term_id == $menu_type && isset($locations[$location])) {
             $args['menu_type'] = $menu_type;
             $args['theme_location'] = $location;
             $helper = new WR_Megamenu_Helpers_Frontend();
             return $helper->get_args($args);
         } else {
             return $args;
         }
     } else {
         return $args;
     }
     return $args;
 }
开发者ID:webprese,项目名称:dev.mgeonline,代码行数:38,代码来源:frontend.php


示例6: register

 public static function register()
 {
     register_nav_menu(self::$location, self::$description);
     if (!wp_get_nav_menu_object(self::$description)) {
         self::setup();
     }
 }
开发者ID:guimachiavelli,项目名称:vac,代码行数:7,代码来源:navigation.php


示例7: theme_get_menu

function theme_get_menu($args = '')
{
    $args = apply_filters('wp_nav_menu_args', $args);
    $nav_menu = apply_filters('pre_wp_nav_menu', null, $args);
    if (null !== $nav_menu) {
        return $nav_menu;
    }
    $args = wp_parse_args($args, array('source' => 'Pages', 'depth' => 0, 'menu' => null, 'class' => ''));
    $source =& $args['source'];
    $menu =& $args['menu'];
    $class =& $args['class'];
    if ($menu != null && is_string($menu)) {
        // theme location
        $location = theme_get_array_value(get_nav_menu_locations(), $menu);
        if ($location) {
            $menu = wp_get_nav_menu_object($location);
            if ($menu) {
                $source = 'Custom Menu';
                $class = implode(' ', array($class, 'menu-' . $menu->term_id));
            }
        }
    }
    if ($source == 'Custom Menu' && $menu != null) {
        $nav_menu = theme_get_list_menu($args);
    } elseif ($source == 'Pages') {
        $nav_menu = theme_get_list_pages(array_merge(array('sort_column' => 'menu_order, post_title'), $args));
    } elseif ($source == 'Categories') {
        $nav_menu = theme_get_list_categories(array_merge(array('title_li' => false), $args));
    }
    return apply_filters('wp_nav_menu', $nav_menu, $args);
}
开发者ID:spadwen,项目名称:shop.bentleigh-discount-lolly.com.au,代码行数:31,代码来源:navigation.php


示例8: wptouch_migrate_modded_menu

function wptouch_migrate_modded_menu()
{
    $menu_name = 'WPtouch - Recovered Page Menu';
    $menu_object = wp_get_nav_menu_object($menu_name);
    if (!$menu_object) {
        $menu_id = wp_create_nav_menu($menu_name);
        $pages = get_pages(array('post_status' => 'publish', 'sort_column' => 'menu_order, post_title'));
        $menu_items = array();
        $skipped_pages = array();
        foreach ($pages as $page) {
            if (wptouch_menu_is_disabled($page->ID)) {
                $skipped_pages[] = $page->ID;
            } elseif (!in_array($page->post_parent, $skipped_pages)) {
                $parent_id = 0;
                if (isset($menu_items[$page->post_parent])) {
                    $parent_id = $menu_items[$page->post_parent];
                }
                $args = array('menu-item-db-id' => 0, 'menu-item-object-id' => $page->ID, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type', 'menu-item-parent-id' => $parent_id, 'menu-item-status' => 'publish');
                $menu_items[$page->ID] = wp_update_nav_menu_item($menu_id, 0, $args);
                $menu_icon = get_post_meta($page->ID, '_wptouch_pro_menu_item_icon', true);
                if ($menu_icon) {
                    add_post_meta($menu_items[$page->ID], '_wptouch_pro_menu_item_icon', $menu_icon);
                }
            }
        }
    } else {
        $menu_id = $menu_object->ID;
    }
    return $menu_id;
}
开发者ID:yarylo,项目名称:cerkva.pp.ua,代码行数:30,代码来源:menu-walkers.php


示例9: widget

    /**
     * widget function.
     *
     * @see WP_Widget
     * @access public
     * @param array $args
     * @param array $instance
     * @return void
     */
    function widget( $args, $instance ) {

        extract( $args );

        if( !isset( $instance['title'] ) )
            $instance['title'] = '';

        $title = apply_filters('widget_title', $instance['title'] );

        $nav_menu = isset( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : '';
        include_once( YIT_THEME_ASSETS_PATH . '/lib/Walker_Nav_Menu_Div.php' );

        $nav_args = array(
            'menu'       => $nav_menu,
            'container'  => 'div',
            'container_class' => 'submenu',
            'menu_class' => 'sub-menu clearfix',
            'depth'      => 3,
            'walker'     => new YIT_Walker_Nav_Menu_Div()
        );
        echo $before_widget;
        echo '<ul class="yit-cm"><li>';
        echo '<a href="#" class="btn-flat">'. $title .'</a>';
        wp_nav_menu( $nav_args );
        echo '</li></ul>';
        echo $after_widget;

    }
开发者ID:jabue,项目名称:wordpress,代码行数:37,代码来源:YIT_Custom_Megamenu.php


示例10: widget

 public function widget($args, $instance)
 {
     // Get menu
     $nav_menu = !empty($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : false;
     if (!$nav_menu) {
         return;
     }
     /** This filter is documented in wp-includes/default-widgets.php */
     $instance['title'] = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . $instance['title'] . $args['after_title'];
     }
     $nav_menu_args = array('fallback_cb' => '', 'menu' => $nav_menu, 'container-class' => 'container-fluid', 'items_wrap' => '<ul id="%1$s" class="nav nav-sidebar">%3$s</ul>', 'depth' => 1);
     /**
      * Filter the arguments for the Custom Menu widget.
      *
      * @since 4.2.0
      *
      * @param array    $nav_menu_args {
      *     An array of arguments passed to wp_nav_menu() to retrieve a custom menu.
      *
      *     @type callback|bool $fallback_cb Callback to fire if the menu doesn't exist. Default empty.
      *     @type mixed         $menu        Menu ID, slug, or name.
      * }
      * @param stdClass $nav_menu      Nav menu object for the current menu.
      * @param array    $args          Display arguments for the current widget.
      */
     wp_nav_menu(apply_filters('widget_nav_menu_args', $nav_menu_args, $nav_menu, $args));
     echo $args['after_widget'];
 }
开发者ID:eggmatters,项目名称:monsoon-responsive,代码行数:31,代码来源:MR_Widgets.php


示例11: expanded_nav_menu_css_class

function expanded_nav_menu_css_class($classes = array(), $item, $args)
{
    $location_name = 'expanded_navigation';
    static $top_level_count = 0;
    //Top level menu items counter
    if ($args->theme_location == $location_name) {
        //Limit to this menu location only
        if ($item->menu_item_parent == 0 and $top_level_count !== null) {
            //Count top level menu items
            $top_level_count++;
            //Increment
        }
        if (($locations = get_nav_menu_locations()) && isset($locations[$location_name])) {
            $main_nav = wp_get_nav_menu_object($locations[$location_name]);
            if ($item->menu_item_parent == 0) {
                $classes[] = 'col-lg-15 col-md-3 col-sm-4 ex-menu-item';
            }
            if ($item->menu_order == 1) {
                $classes[] = 'menu-item menu-item-first';
                //First menu item
            }
            if ($top_level_count == count_top_level_menu_items($main_nav->term_id)) {
                $classes[] = 'menu-item-last';
                //Last top level menu item
                $top_level_count = null;
                //Disable our counter, no need for it
            }
        }
    }
    return $classes;
}
开发者ID:ThatGuySam,项目名称:warp-drive,代码行数:31,代码来源:filters.php


示例12: start_el

 function start_el(&$output, $item, $depth, $args)
 {
     global $wp_query;
     $ul_class = 'nobulletpoints col-sm-6 hidden-xs';
     if (!isset($this->current_menu)) {
         $this->current_menu = wp_get_nav_menu_object($args->menu);
     }
     if (!isset($this->break_point)) {
         $this->break_point = ceil($this->current_menu->count / 2) + 1;
     }
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $class_names = $value = '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $classes[] = 'menu-item-' . $item->ID;
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
     $class_names = ' class="' . esc_attr($class_names) . '"';
     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
     $id = strlen($id) ? ' id="' . esc_attr($id) . '"' : '';
     if ($this->break_point == $item->menu_order) {
         $output .= $indent . '</li></ul><ul class="' . $ul_class . '"><li' . $id . $value . $class_names . '>';
     } else {
         $output .= $indent . '<li' . $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);
 }
开发者ID:alpe88,项目名称:wp.itc210_psa-pbk,代码行数:34,代码来源:Two_Column_Menu_Walker.php


示例13: van_check_menu

 function van_check_menu()
 {
     global $VAN;
     //If custom menu exist,get the ID of pages
     if (($locations = get_nav_menu_locations()) && $locations['primary_navi']) {
         $menu = wp_get_nav_menu_object($locations['primary_navi']);
         $menu_items = wp_get_nav_menu_items($menu->term_id);
         $pageID = array();
         foreach ($menu_items as $item) {
             if ($item->object == 'page') {
                 $pageID[] = $item->object_id;
             }
         }
         query_posts(array('post_type' => 'page', 'post__in' => $pageID, 'posts_per_page' => count($pageID), 'orderby' => 'post__in'));
     } else {
         //If custom menu doesn't exist,check default page menu setting in theme options
         //If default page menu setting exist
         if (isset($VAN['pages_navi']) && $VAN['pages_navi'] != '') {
             query_posts(array('post_type' => 'page', 'post__in' => $VAN['pages_navi'], 'posts_per_page' => count($VAN['pages_navi']), 'orderby' => 'menu_order', 'order' => 'ASC'));
         } else {
             //If default page menu setting doesn't exist
             query_posts(array('post_type' => 'page', 'posts_per_page' => 6, 'orderby' => 'menu_order', 'order' => 'ASC'));
         }
     }
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:25,代码来源:theme-functions.php


示例14: theme_get_menu

function theme_get_menu($args = '')
{
    $args = wp_parse_args($args, array('source' => 'Pages', 'depth' => 0, 'menu' => null, 'class' => ''));
    $source =& $args['source'];
    $menu =& $args['menu'];
    if (function_exists('get_nav_menu_locations') && $menu != null && is_string($menu)) {
        // theme location
        $location = theme_get_array_value(get_nav_menu_locations(), $menu);
        if ($location) {
            $menu = wp_get_nav_menu_object($location);
            if ($menu) {
                $source = 'Custom Menu';
            }
        }
    }
    if ($source == 'Custom Menu' && function_exists('wp_nav_menu') && $menu != null) {
        return theme_get_list_menu($args);
    }
    if ($source == 'Pages') {
        return theme_get_list_pages(array_merge(array('sort_column' => 'menu_order, post_title'), $args));
    }
    if ($source == 'Categories') {
        return theme_get_list_categories(array_merge(array('title_li' => false), $args));
    }
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:25,代码来源:navigation.php


示例15: _402

 private function _402()
 {
     /* Fixed double key active_plugins */
     $plugins = get_option('active_plugins');
     if (is_array($plugins)) {
         $_plugins = array();
         foreach ($plugins as $plugin) {
             if (!in_array($plugin, $_plugins)) {
                 array_push($_plugins, $plugin);
             }
         }
         update_option('active_plugins', $_plugins);
     }
     /* Create new menu - top nav  */
     $menu_name = 'Top Navigation';
     //wp_delete_nav_menu( $menu_name );
     $menu_exists = wp_get_nav_menu_object($menu_name);
     if (!$menu_exists) {
         $menu_id = wp_create_nav_menu($menu_name);
         wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('<i class="fa fa-lock"></i>&nbsp; Login'), 'menu-item-url' => home_url('/?action=login'), 'menu-item-status' => 'publish'));
         wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('<i class="fa fa-pencil-square-o"></i>&nbsp; Register'), 'menu-item-url' => home_url('/?action=register'), 'menu-item-classes' => 'two active', 'menu-item-status' => 'publish'));
         $thememods = 'theme_mods_' . get_option('stylesheet', true);
         $mod = get_option($thememods);
         if (!isset($mod)) {
             $mod = array('nav_menu_locations' => array('top_nav' => $menu_id));
         } else {
             $mod['nav_menu_locations']['top_nav'] = $menu_id;
         }
         add_option($thememods, $mod) || update_option($thememods, $mod);
     }
 }
开发者ID:pivotlearning,项目名称:wpsite,代码行数:31,代码来源:king.update.php


示例16: __construct

 public function __construct($menu_term_slug)
 {
     parent::__construct();
     $menu = wp_get_nav_menu_object($menu_term_slug);
     if (!empty($menu)) {
         $this->menu = $menu;
         $nav_menu_items = wp_get_nav_menu_items($this->menu->term_id);
         cfd_tmp_dbg('nav_menu_items_raw.txt', $nav_menu_items, 'print');
         foreach ($nav_menu_items as $item) {
             $menu_item = wp_setup_nav_menu_item($item);
             $menu_item->metadata = get_metadata('post', $item->ID);
             foreach ($menu_item->metadata as $key => &$value) {
                 $value[0] = maybe_unserialize($value[0]);
             }
             if ($menu_item->type == 'post_type') {
                 $menu_item->parent = get_post($menu_item->metadata['_menu_item_object_id'][0]);
             } elseif ($menu_item->type == 'taxonomy' && (!property_exists($menu, 'object') || $menu->object != 'custom')) {
                 $menu_item->term = get_term($menu_item->metadata['_menu_item_object_id'][0], $menu_item->metadata['_menu_item_object'][0]);
             }
             $this->items[] = $menu_item;
         }
     } else {
         throw new Exception(__('Invalid menu id', 'cf-deploy') . ': ' . esc_attr($menu_term_slug));
     }
 }
开发者ID:niko-lgdcom,项目名称:wp-install,代码行数:25,代码来源:menu.class.php


示例17: _wpsc_menu_exists

function _wpsc_menu_exists($args)
{
    $args = (object) $args;
    // Get the nav menu based on the requested menu
    $menu = wp_get_nav_menu_object($args->menu);
    // Get the nav menu based on the theme_location
    if (!$menu && $args->theme_location && ($locations = get_nav_menu_locations()) && isset($locations[$args->theme_location])) {
        $menu = wp_get_nav_menu_object($locations[$args->theme_location]);
    }
    // get the first menu that has items if we still can't find a menu
    if (!$menu && !$args->theme_location) {
        $menus = wp_get_nav_menus();
        foreach ($menus as $menu_maybe) {
            if ($menu_items = wp_get_nav_menu_items($menu_maybe->term_id)) {
                $menu = $menu_maybe;
                break;
            }
        }
    }
    // If the menu exists, get its items.
    if ($menu && !is_wp_error($menu) && !isset($menu_items)) {
        $menu_items = wp_get_nav_menu_items($menu->term_id);
    }
    // If no menu was found or if the menu has no items and no location was requested, call the fallback_cb if it exists
    if (!$menu || is_wp_error($menu) || isset($menu_items) && empty($menu_items) && !$args->theme_location) {
        return false;
    }
    // If no fallback function was specified and the menu doesn't exists, bail.
    if (!$menu || is_wp_error($menu) || empty($menu_items)) {
        return false;
    }
    return (bool) $menu;
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:33,代码来源:query.php


示例18: widget

 public function widget($args, $instance)
 {
     // Get menu
     $nav_menu = !empty($instance['offcanvas_nav_menu']) ? wp_get_nav_menu_object($instance['offcanvas_nav_menu']) : false;
     if (!$nav_menu) {
         return;
     }
     /** This filter is documented in wp-includes/default-widgets.php */
     $instance['title'] = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . $instance['title'] . $args['after_title'];
     }
     $nav_menu_args = array('fallback_cb' => '', 'menu' => $nav_menu, 'echo' => false, 'container' => 'ul', 'menu_class' => 'off-canvas-list');
     /**
      * Filter the arguments for the Custom Menu widget.
      *
      * @since 4.2.0
      *
      * @param array    $nav_menu_args {
      *     An array of arguments passed to wp_nav_menu() to retrieve a custom menu.
      *
      *     @type callback|bool $fallback_cb Callback to fire if the menu doesn't exist. Default empty.
      *     @type mixed         $menu        Menu ID, slug, or name.
      * }
      * @param stdClass $nav_menu      Nav menu object for the current menu.
      * @param array    $args          Display arguments for the current widget.
      */
     echo str_replace('sub-menu', 'sub-menu left-submenu', wp_nav_menu(apply_filters('widget_nav_menu_args', $nav_menu_args, $nav_menu, $args)));
     echo $args['after_widget'];
 }
开发者ID:adamplabarge,项目名称:bermstyle,代码行数:31,代码来源:Custom_Foundation_OffCanvas_Nav_Menu_Widget.php


示例19: ubermenu_get_settings_fields

function ubermenu_get_settings_fields()
{
    $prefix = UBERMENU_PREFIX;
    $settings_fields = _UBERMENU()->get_settings_fields();
    if ($settings_fields) {
        return $settings_fields;
    }
    $main_assigned = '';
    if (!has_nav_menu('ubermenu')) {
        $main_assigned = 'No Menu Assigned';
    } else {
        $menus = get_nav_menu_locations();
        $menu_title = wp_get_nav_menu_object($menus['ubermenu'])->name;
        $main_assigned = $menu_title;
    }
    $main_assigned = '<span class="ubermenu-main-assigned">' . $main_assigned . '</span>  <p class="ubermenu-desc-understated">The menu assigned to the <strong>UberMenu [Main]</strong> theme location will be displayed.  <a href="' . admin_url('nav-menus.php?action=locations') . '">Assign a menu</a></p>';
    $config_id = 'main';
    $fields = array($prefix . $config_id => ubermenu_get_settings_fields_instance($config_id));
    $fields = apply_filters('ubermenu_settings_panel_fields', $fields);
    //Allow ordering
    foreach ($fields as $section_id => $section_fields) {
        ksort($fields[$section_id]);
        $fields[$section_id] = array_values($fields[$section_id]);
    }
    _UBERMENU()->set_settings_fields($fields);
    // up( $fields , 2 );
    //up( $fields );
    return $fields;
}
开发者ID:treydonovan,项目名称:innergame-anna,代码行数:29,代码来源:settings.control-panel.php


示例20: acp_skiplinks_output

function acp_skiplinks_output()
{
    check_ajax_referer('acp-sec-skiplinks', 'security');
    $hp_skiplinks = get_option('acp_skiplinks_home', false);
    if ($hp_skiplinks) {
        $menu_name = is_home() || is_front_page() ? 'skiplinks-home' : 'skiplinks';
    } else {
        $menu_name = 'skiplinks';
    }
    if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
        $menu = wp_get_nav_menu_object($locations[$menu_name]);
        $menu_items = wp_get_nav_menu_items($menu->term_id);
        $menu_side = get_option('acp_skiplinks_side', false);
        $menu_list = '<ul id="acp_skiplinks" role="navigation" class="' . $menu_side . '">';
        foreach ((array) $menu_items as $key => $menu_item) {
            $title = $menu_item->title;
            $url = $menu_item->url;
            $menu_list .= '<li><a href="' . $url . '" class="skiplinks">' . $title . '</a></li>';
        }
        $menu_list .= '</ul></nav>';
    } else {
        $menu_list = '<ul><li>Menu "' . $menu_name . '" not defined.</li></ul>';
    }
    if (get_option('acp_skiplinks', false)) {
        echo $menu_list;
    }
    die;
}
开发者ID:amarcinkowski,项目名称:accessible-poetry,代码行数:28,代码来源:acp_skiplinks.php



注:本文中的wp_get_nav_menu_object函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_get_nav_menu_to_edit函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_get_nav_menu_items函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap