当前位置: 首页>>代码示例>>PHP>>正文


PHP _wp_menu_output函数代码示例

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


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

示例1: esc_attr_e

?>

<div id="adminmenumain" role="navigation" aria-label="<?php 
esc_attr_e('Main menu');
?>
">
<a href="#wpbody-content" class="screen-reader-shortcut"><?php 
_e('Skip to main content');
?>
</a>
<a href="#wp-toolbar" class="screen-reader-shortcut"><?php 
_e('Skip to toolbar');
?>
</a>
<div id="adminmenuback"></div>
<div id="adminmenuwrap">
<ul id="adminmenu">

<?php 
_wp_menu_output($menu, $submenu);
/**
 * Fires after the admin menu has been output.
 *
 * @since 2.5.0
 */
do_action('adminmenu');
?>
</ul>
</div>
</div>
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:30,代码来源:menu-header.php

示例2: add_modified_admin_menu


//.........这里部分代码省略.........
                 // If extra parameters are set, add them on
                 if (!empty($menu_item->cd_params)) {
                     $menu_item->url .= $menu_item->cd_params;
                 }
                 // Allowed query params for when filtering the url
                 $args = array('page' => true, 'post_type' => true, 'taxonomy' => true);
                 // If this page has added extra to the url
                 if (!empty($menu_item->cd_params)) {
                     $params = explode('&', $menu_item->cd_params);
                     foreach ($params as $param) {
                         if (!empty($param)) {
                             preg_match('/.*(?==)/', $param, $matches);
                             $args[$matches[0]] = true;
                         }
                     }
                 }
                 // Get the filtered url
                 $url = $this->get_cleaned_url($args);
                 // If the url matches, add it to an array storing all matching urls
                 if ($url == $menu_item->url) {
                     $this->matching_urls[] = array('parent' => $menu_item->url, 'submenu' => false);
                 }
                 $hookname = get_plugin_page_hookname($menu_item->url, '');
                 if (empty($menu_item->cd_icon)) {
                     $icon_url = 'dashicons-admin-generic';
                     $icon_class = 'menu-icon-generic ';
                 } else {
                     $icon_url = set_url_scheme($menu_item->cd_icon);
                     $icon_class = '';
                 }
                 $menu[$menu_item->menu_order] = array($menu_item->title, 'read', $menu_item->url, $menu_item->cd_page_title, 'menu-top ' . $icon_class . $hookname . ' ' . esc_attr(implode(' ', $menu_item->classes)), $hookname, $icon_url);
                 // Here's the deal... When we add the menu page here, we've already done it once (from other plugins
                 // and such), so the callbacks are already set. BUT, the callbacks are used by adding an action, the
                 // action hookname is based off of the menu title and the menu slug. SO, it's okay that we don't add
                 // the callback here again (because it's already been added before we removed it), but the problem is,
                 // if we change the title then the hookname that WP is now looking for doesn't match the one that was
                 // already created. SO, if the title was changed, we need to modify the global $admin_page_hooks so
                 // that the action name matches the ORIGINAL title, not the new title. WHEW!
                 if ($menu_item->original_title != $menu_item->title) {
                     $admin_page_hooks[$menu_item->url] = strtolower($menu_item->original_title);
                 }
             } else {
                 // If a sub-menu
                 // If the parent has been unset, then don't add the sub-menu
                 if (!isset($menu_items[(int) $menu_item->menu_item_parent])) {
                     continue;
                 }
                 // If extra parameters are set, add them on
                 if (!empty($menu_item->cd_params)) {
                     $menu_item->url .= $menu_item->cd_params;
                 }
                 // Allowed query params for when filtering the url
                 $args = array('page' => true, 'post_type' => true, 'taxonomy' => true);
                 // If this page has added extra to the url
                 if (!empty($menu_item->cd_params)) {
                     $params = explode('&', $menu_item->cd_params);
                     foreach ($params as $param) {
                         if (!empty($param)) {
                             preg_match('/.*(?==)/', $param, $matches);
                             $args[$matches[0]] = true;
                         }
                     }
                 }
                 // Get the filtered url
                 $url = $this->get_cleaned_url($args);
                 // If the url matches, add it to an array storing all matching urls
                 if ($url == $menu_item->url) {
                     $this->matching_urls[] = array('parent' => $menu_items[(int) $menu_item->menu_item_parent]->url, 'submenu' => $menu_item->url);
                 }
                 $submenu[$menu_items[$menu_item->menu_item_parent]->url][$menu_item->menu_order] = array($menu_item->title, 'read', $menu_item->url, $menu_item->cd_page_title);
             }
         }
     }
     // Sort the menus and the sub-menus by array_key so they are in proper order
     ksort($menu);
     foreach ($submenu as $menu_parent => $sub_menus) {
         ksort($submenu[$menu_parent]);
     }
     // In the case of a sub-menu item being moved to a parent item, WordPress will be confused
     // about which menu item is active. So I compensate for this by overriding the "self" and
     // "parent_file" globals with the new (previously sub-menu) slug. This corrects the issue.
     // Get the most specific url (the biggest value). Only proceed if there is at least one matching url.
     if (!empty($this->matching_urls)) {
         $url = max($this->matching_urls);
         // Set the self (or what WP thinks we're viewing) to the ENTIRE slug, not just the parent.
         $self = $url['parent'];
         $pagenow = $url['parent'];
         $plugin_page = $url['parent'];
         $parent_file = $url['parent'];
         // Tell WP what our new submenu file is (because it's custom), otherwise, default to
         // the parent
         $submenu_file = !empty($url['submenu']) ? $url['submenu'] : $url['parent'];
     }
     // Instead of allowing WP to add its menu with this function, I've emptied the global $menu and $submenu variables
     // when this is initially called. And then IMMEDIATELY after there is a hook "adminmenu" that I call the exact
     // same function again, though I'm adding the 3rd param as false (normally true). This means that the parent
     // menu items do NOT have to link to where the first sub-menu item goes to, which is normaly functionality.
     // This is a private function, sorry WP!
     _wp_menu_output($menu, $submenu, false);
 }
开发者ID:BenjaminCool,项目名称:client-dash,代码行数:101,代码来源:menus.php


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