本文整理汇总了PHP中wp_get_nav_menu_to_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_nav_menu_to_edit函数的具体用法?PHP wp_get_nav_menu_to_edit怎么用?PHP wp_get_nav_menu_to_edit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_get_nav_menu_to_edit函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ((array) $nav_menus as $key => $_nav_menu) {
$nav_menus[$key]->truncated_name = wp_html_excerpt($_nav_menu->name, 40, '…');
}
// Retrieve menu locations
if (current_theme_supports('menus')) {
$locations = get_registered_nav_menus();
$menu_locations = get_nav_menu_locations();
}
// Ensure the user will be able to scroll horizontally
// by adding a class for the max menu depth.
global $_wp_nav_menu_max_depth;
$_wp_nav_menu_max_depth = 0;
// Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth
if (is_nav_menu($nav_menu_selected_id)) {
$menu_items = wp_get_nav_menu_items($nav_menu_selected_id, array('post_status' => 'any'));
$edit_markup = wp_get_nav_menu_to_edit($nav_menu_selected_id);
}
function wp_nav_menu_max_depth($classes)
{
global $_wp_nav_menu_max_depth;
return "{$classes} menu-max-depth-{$_wp_nav_menu_max_depth}";
}
add_filter('admin_body_class', 'wp_nav_menu_max_depth');
wp_nav_menu_setup();
wp_initial_nav_menu_meta_boxes();
if (!current_theme_supports('menus') && !$num_locations) {
$messages[] = '<div id="message" class="updated"><p>' . sprintf(__('Your theme does not natively support menus, but you can use them in sidebars by adding a “Custom Menu” widget on the <a href="%s">Widgets</a> screen.'), admin_url('widgets.php')) . '</p></div>';
}
if (!$locations_screen) {
// Main tab
$overview = '<p>' . __('This screen is used for managing your custom navigation menus.') . '</p>';
开发者ID:palimadra,项目名称:bubblegraphics-wpsite,代码行数:31,代码来源:nav-menus.php
示例2: get_current_menu_items
/**
* Returns the available menu items.
*
* @since Client Dash 1.6
*
* @return array|bool The menu items, if they exist, otherwise false.
*/
public function get_current_menu_items()
{
global $ClientDash, $errors;
/**
* Whether or not to use transients in getting the menu output. (big time saver)
*
* @since Client Dash 1.6
*/
$use_transients = apply_filters('cd_nav_menu_transients', true);
// Save the information in a transient and get it for faster page loads
// Only use a transient when debugging is off
if ((!defined('WP_DEBUG') || !WP_DEBUG) && $use_transients) {
$output = get_transient("cd_adminmenu_output_{$this->menu_ID}");
} else {
$output = false;
}
if (!$output && is_nav_menu($this->menu_ID)) {
// Our modified walker class
include_once $ClientDash->path . '/core/tabs/settings/menus/walkerclass.php';
$menu_items = wp_get_nav_menu_items($this->menu_ID, array('post_status' => 'any'));
$edit_markup = wp_get_nav_menu_to_edit($this->menu_ID);
$output = array('menu_items' => $menu_items, 'edit_markup' => $edit_markup, 'errors' => $errors);
// Save the transient data if not disabled
if ($use_transients) {
set_transient("cd_adminmenu_output_{$this->menu_ID}", $output, DAY_IN_SECONDS);
}
}
return $output;
}
开发者ID:BenjaminCool,项目名称:client-dash,代码行数:36,代码来源:menus.php
注:本文中的wp_get_nav_menu_to_edit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论