本文整理汇总了PHP中get_registered_nav_menus函数的典型用法代码示例。如果您正苦于以下问题:PHP get_registered_nav_menus函数的具体用法?PHP get_registered_nav_menus怎么用?PHP get_registered_nav_menus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_registered_nav_menus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: automatic_add_sub_pages
/**
* When publishing a new child page, add it to the appropriate custom menu.
* @param string $post_id current edit post id
* @author Romain DORR
*/
public static function automatic_add_sub_pages($post_id)
{
// Theme supports custom menus?
if (!current_theme_supports('menus')) {
return false;
}
// Published page has parent?
$post = get_post($post_id);
if (!$post->post_parent) {
return;
}
// Get all menus for this theme
$menus = get_registered_nav_menus();
// Get all locations
$locations = get_nav_menu_locations();
// Get Plugin option
$auto_add_option = get_option('menu_aasp_options');
// if no menus are configured
if (empty($auto_add_option)) {
return false;
}
// Loop through the menus to find page parent
foreach ($menus as $menu_name => $menu) {
if (!isset($locations[$menu_name])) {
continue;
}
$menu = wp_get_nav_menu_object($locations[$menu_name]);
// Test if menu is configure for auto add submenus
if (empty($auto_add_option[$menu->term_id])) {
continue;
}
$menu_parent = null;
$menu_items = wp_get_nav_menu_items($menu->term_id, array('post_status' => 'publish,draft'));
if (!is_array($menu_items)) {
continue;
}
foreach ($menu_items as $menu_item) {
// Item already in menu?
if ($menu_item->object_id == $post->ID) {
continue 2;
}
if ($menu_item->object_id == $post->post_parent) {
$menu_parent = $menu_item;
}
}
// Add new item
if ($menu_parent) {
wp_update_nav_menu_item($menu->term_id, 0, array('menu-item-object-id' => $post->ID, 'menu-item-object' => $post->post_type, 'menu-item-parent-id' => $menu_parent->ID, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish'));
}
}
}
示例2: findMenu
function findMenu($id = null)
{
$locations = get_registered_nav_menus();
$menus = wp_get_nav_menus();
if ($id) {
foreach ($menus as $menu) {
if ($id == $menu->term_id) {
return $menu;
}
}
return null;
}
$menu_locations = get_nav_menu_locations();
$return = null;
// find current menu
foreach ($locations as $location => $description) {
foreach ($menus as $menu) {
if (isset($menu_locations[$location]) && $menu_locations[$location] == $menu->term_id) {
$return = $menu;
break;
}
}
}
return $return;
}
示例3: ubermenu_integration_code_ui
function ubermenu_integration_code_ui($config_id)
{
$integration_code = '<div class="ubermenu-integration-code-wrap">' . ubermenu_menu_integration_code(array(), $config_id);
$menu_select = '<h4>Integrate Specific Menu</h4>';
$loc_select = '<h4>Integrate Specific Theme Location</h4>';
$menus = wp_get_nav_menus(array('orderby' => 'name'));
if (is_array($menus)) {
foreach ($menus as $menu) {
$integration_code .= ubermenu_menu_integration_code(array('menu' => $menu->term_id), $config_id);
}
$menu_select .= '<select class="ubermenu-manual-code-menu-selection">';
$menu_select .= '<option value="_default">Default</option>';
foreach ($menus as $menu) {
$menu_select .= '<option value="' . $menu->term_id . '">' . $menu->name . '</option>';
}
$menu_select .= '</select>';
$menu_select .= '<p class="ubermenu-sub-desc ubermenu-desc-understated">To display a specific menu, select the menu above to generate that code</p>';
}
$locs = get_registered_nav_menus();
if (is_array($locs)) {
foreach ($locs as $loc_id => $loc_name) {
$integration_code .= ubermenu_menu_integration_code(array('theme_location' => $loc_id), $config_id);
}
$loc_select .= '<select class="ubermenu-manual-code-menu-selection">';
$loc_select .= '<option value="_default">None</option>';
foreach ($locs as $loc_id => $loc_name) {
$loc_select .= '<option value="' . $loc_id . '">' . $loc_name . '</option>';
}
$loc_select .= '</select>';
$loc_select .= '<p class="ubermenu-sub-desc ubermenu-desc-understated">To display a specific theme locaton, select the theme location above to generate that code</p>';
}
$integration_code .= $menu_select . $loc_select;
$integration_code .= '</div>';
return $integration_code;
}
示例4: form
public function form($instance)
{
$defaults = array('title' => 'Links list', 'description' => 'Website powered by WinterJuice theme');
$instance = wp_parse_args((array) $instance, $defaults);
// field: Widget title
echo '<p>';
echo '<label for="' . $this->get_field_id('title') . '">Widget Title:</label>';
echo '<input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $instance['title'] . '" />';
echo '</p>';
// textarea: Description field
echo '<p>';
echo '<label for="' . $this->get_field_id('title') . '">Custom Text:</label>';
echo '<input class="widefat" id="' . $this->get_field_id('description') . '" name="' . $this->get_field_name('description') . '" value="' . $instance['description'] . '" />';
echo '</p>';
// prepare: menu
$menu = get_registered_nav_menus();
if (!isset($instance['menu'])) {
$instance['menu'] = 0;
}
echo '<h3>Available Menu:</h3>';
echo '<div class="custom-socials">';
// select: Custom menu
echo '<p>';
echo '<label for="' . $this->get_field_id('menu') . '">Menu:</label>';
echo '<select class="widefat" id="' . $this->get_field_id('menu') . '" name="' . $this->get_field_name('menu') . '">';
echo '</p>';
foreach ($menu as $id => $name) {
echo '<option value="' . $id . '" ' . selected($id, $instance['menu']) . '>' . $name . '</option>';
}
echo '</select>';
echo '</div>';
// render
//echo $html;
}
示例5: metaboxRaw
function metaboxRaw()
{
/* This is just in case JS is not working. It'll only save the last checked box */
if (isset($_POST['megaMenu-locations']) && $_POST['megaMenu-locations'] == 'Save') {
$data = $_POST['wp-mega-menu-nav-loc'];
$data = explode(',', $data);
update_option(MISS_MEGAMENU_STORE, $data);
echo 'Saved Changes';
}
$active = get_option(MISS_MEGAMENU_STORE, array());
echo '<div class="megaMenu-metaBox">';
echo '<p class="howto">' . __('Select the Menu Locations for Mega Menu. Menu must be activated for any Mega Menu Options to affect that Menu Location.', MISS_ADMIN_TEXTDOMAIN) . '</p>';
echo '<form>';
$locs = get_registered_nav_menus();
foreach ($locs as $slug => $desc) {
echo '<div>' . '<input class="menu-item-checkbox" type="checkbox" value="' . $slug . '" id="megaMenuThemeLoc-' . $slug . '" name="wp-mega-menu-nav-loc" ' . checked(in_array($slug, $active), true, false) . '/>' . '<label class="menu-item-title" for="megaMenuThemeLoc-' . $slug . '">' . $desc . '</label>' . '</div>';
}
echo '<p class="button-controls">' . '<img class="waiting" src="' . esc_url(admin_url('images/wpspin_light.gif')) . '" alt="" style="display:none;"/>' . '<input id="wp-mega-menu-navlocs-submit" type="submit" class="button-primary" name="megaMenu-locations" value="Save" />' . '</p>';
echo '</form>';
/*
if( !$this->settings->op( 'wpmega-strict' ) ){
echo '<p class="howto">If more than 1 menu is being megafied in your theme, turn on Strict Mode in Appearance > IrishMiss > '.
'Theme Integration.</p>';
}
*/
echo '<p>' . __('Note you can ONLY have 1 IrishMiss menu per page.', MISS_ADMIN_TEXTDOMAIN) . '</p>';
echo '</div>';
}
示例6: __construct
public function __construct()
{
$this->cssclass = 'row-options';
$this->description = __('Set row options and styling here.', 'spyropress');
$this->id_base = 'spyropress_row_options';
$this->name = __('Row Options', 'spyropress');
$this->show_custom_css = true;
$locations = get_registered_nav_menus();
$menus = wp_get_nav_menus();
$menu_options = array();
if (isset($locations) && count($locations) > 0 && isset($menus) && count($menus) > 0) {
foreach ($menus as $menu) {
$menu_options[$menu->term_id] = $menu->name;
}
}
// Fields
$this->fields = array(array('id' => 'show', 'type' => 'checkbox', 'options' => array('1' => '<strong>' . __('Disable this row temporarily', 'spyropress') . '</strong>')), array('id' => 'container_skin', 'type' => 'select', 'class' => 'enable_changer section-full', 'label' => __('Style/Skin', 'spyropress'), 'options' => array('home-intro' => __('Call of Action', 'spyropress'), 'featured_section call-to-action footer' => __('Call-to-Action (Featured)', 'spyropress'), 'home-intro light' => __('Call of Action (Light)', 'spyropress'), 'home-concept' => __('Home Concept', 'spyropress'), 'featured_section' => __('Featured Section', 'spyropress'), 'highlight_section' => __('Hightlight', 'spyropress'), 'highlight_section top' => __('Hightlight (no top-margin)', 'spyropress'), 'featured_section highlight_section footer' => __('Featured Hightlight Section', 'spyropress'), 'push-top' => __('Push Top', 'spyropress'), 'parallax' => __('Parallax', 'spyropress'), 'video_section' => __('Video', 'spyropress'))), array('label' => __('Parallax Background', 'spyropress'), 'id' => 'parallax_bg', 'class' => 'parallax container_skin section-full', 'type' => 'upload'), array('label' => __('Video Poster', 'spyropress'), 'id' => 'video_poster', 'class' => 'video_section container_skin section-full', 'type' => 'upload'), array('label' => __('Video MP4', 'spyropress'), 'id' => 'video_mp4', 'class' => 'video_section container_skin section-full', 'type' => 'upload'), array('label' => __('Video OGG', 'spyropress'), 'id' => 'video_ogg', 'class' => 'video_section container_skin section-full', 'type' => 'upload'));
if (!empty($menu_options)) {
$this->fields[] = array('label' => __('OnePage Menu Builder', 'spyropress'), 'type' => 'sub_heading');
$this->fields[] = array('label' => __('Select Menu', 'spyropress'), 'id' => 'menu_id', 'type' => 'select', 'options' => $menu_options);
$this->fields[] = array('label' => __('Menu Label', 'spyropress'), 'id' => 'menu_label', 'type' => 'text');
}
$this->create_widget();
add_filter('builder_save_row_css', array($this, 'compile_css'), 10, 3);
}
示例7: has_menu
function has_menu($location)
{
$menus = get_registered_nav_menus();
if (isset($menus[$location])) {
return true;
}
}
示例8: campaign_register_metabox
function campaign_register_metabox()
{
// Start with an underscore to hide fields from custom fields list
$prefix = '_ppm_';
/**
* Sample metabox to demonstrate each field type included
*/
$post_meta = new_cmb2_box(array('id' => $prefix . 'post_metabox', 'title' => __('Post Meta', 'cmb2'), 'object_types' => array('page'), 'show_on' => array('key' => 'child_of', 'value' => array(4)), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$menus = get_registered_nav_menus();
foreach ($menus as $location => $description) {
$options[$location] = $description;
}
$post_meta->add_field(array('name' => 'Menu Select', 'desc' => 'Select a menu to show', 'id' => $prefix . 'menu_select', 'type' => 'select', 'show_option_none' => true, 'default' => 'custom', 'options' => $options));
$post_meta->add_field(array('name' => 'Section Class', 'desc' => 'Enter section class', 'id' => $prefix . 'section_class', 'type' => 'text', 'default' => 'col-md-6'));
$post_meta->add_field(array('name' => 'View More Link', 'desc' => 'Enter view more link', 'id' => $prefix . 'section_link', 'type' => 'text'));
$products_meta = new_cmb2_box(array('id' => $prefix . 'products_metabox', 'title' => __('Products Meta', 'cmb2'), 'object_types' => array('isis-product'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$products_meta->add_field(array('name' => 'Product Subtitle', 'desc' => 'Enter the product subtitle', 'id' => $prefix . 'product_subtitle', 'type' => 'text'));
$industries_meta = new_cmb2_box(array('id' => $prefix . 'industries_metabox', 'title' => __('Industries Meta', 'cmb2'), 'object_types' => array('industry'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$industries_meta->add_field(array('name' => 'Industry Subtitle', 'desc' => 'Enter the industry subtitle', 'id' => $prefix . 'industry_subtitle', 'type' => 'text'));
$support_meta = new_cmb2_box(array('id' => $prefix . 'support_metabox', 'title' => __('Support Meta', 'cmb2'), 'object_types' => array('page'), 'show_on' => array('key' => 'child_of', 'value' => array(54)), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$support_meta->add_field(array('name' => 'Support Resources Title', 'desc' => 'Enter section title', 'id' => $prefix . 'resource_title', 'type' => 'text'));
$support_meta->add_field(array('name' => 'Support Resources Intro', 'desc' => 'Enter section intro', 'id' => $prefix . 'resource_intro', 'type' => 'textarea'));
$support_meta->add_field(array('name' => 'Support Premium Resources Title', 'desc' => 'Enter section title', 'id' => $prefix . 'resource_premium_title', 'type' => 'text'));
$support_meta->add_field(array('name' => 'Support Premium Resources Intro', 'desc' => 'Enter section intro', 'id' => $prefix . 'resource_premium_intro', 'type' => 'textarea'));
$video_meta = new_cmb2_box(array('id' => $prefix . 'video_metabox', 'title' => __('Video Meta', 'cmb2'), 'object_types' => array('videos'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$video_meta->add_field(array('name' => 'Video Description', 'desc' => 'Enter text to introduce video', 'id' => $prefix . 'video_description', 'type' => 'textarea'));
$video_meta->add_field(array('name' => 'Video Duration', 'desc' => 'Enter enter video duration (2:01s)', 'id' => $prefix . 'video_duration', 'type' => 'text'));
$header_meta = new_cmb2_box(array('id' => $prefix . 'header_metabox', 'title' => __('Header Meta', 'cmb2'), 'object_types' => array('page'), 'context' => 'side', 'priority' => 'low', 'show_names' => true));
$header_meta->add_field(array('name' => 'Button Text', 'desc' => 'Enter section class', 'id' => $prefix . 'header_text', 'type' => 'text'));
$header_meta->add_field(array('name' => 'Button Link', 'desc' => 'Enter button link', 'id' => $prefix . 'header_link', 'type' => 'text'));
}
示例9: shiftnav_get_theme_location_ops
function shiftnav_get_theme_location_ops()
{
$locs = get_registered_nav_menus();
$default = array('_none' => 'Select Theme Location or use Menu Setting');
//$locs = array_unshift( $default, $locs );
$locs = $default + $locs;
//shiftp( $locs );
return $locs;
}
示例10: register_loggedin_menus
function register_loggedin_menus()
{
$default_menus = get_registered_nav_menus();
$loggedin_menus = array();
foreach ($default_menus as $slug => $name) {
$loggedin_menus[$slug . '_dmlu_loggedin'] = $name . ' Loggedin';
}
register_nav_menus($loggedin_menus);
}
示例11: list_all_theme_location_names
/**
* Return all themes registered for this site
* @return array|bool
*/
public static function list_all_theme_location_names()
{
$theme_locations = false;
$themes = get_registered_nav_menus();
foreach ($themes as $location => $menu_key) {
$theme_locations[] = $location;
}
return $theme_locations;
}
示例12: get_menu
public function get_menu()
{
global $json_api;
// Make sure we have key/value query vars
if ($json_api->query->menu_id || $json_api->query->menu_location) {
function get_nav_items($id)
{
global $json_api;
$menu_output = wp_get_nav_menu_items($id);
$filtered_items = array_map(function ($el) {
$filter = array("id" => $el->ID, "parent_id" => $el->menu_item_parent, "menu_order" => $el->menu_order, "label" => $el->title, "object_type" => $el->object, "object_id" => $el->object == "custom" ? "" : $el->object_id, "url" => $el->object == "custom" ? $el->url : "");
return $filter;
}, $menu_output);
$output = $json_api->query->dev == "1" ? $menu_output : $filtered_items;
$count = count($output);
if ($count == "0") {
$json_api->error("The menu you are looking for is empty or does not exist.");
} else {
return array("output" => $output, "count" => $count);
}
}
if ($json_api->query->menu_id) {
$menuid = $json_api->query->menu_id;
$menuloc = "";
$menu_items = get_nav_items($menuid);
} else {
if ($json_api->query->menu_location) {
$menuloc = $json_api->query->menu_location;
$locations = get_registered_nav_menus();
$menus = wp_get_nav_menus();
$menu_locations = get_nav_menu_locations();
if (isset($menu_locations[$menuloc])) {
foreach ($menus as $menu) {
// If the ID of this menu is the ID associated with the location we're searching for
if ($menu->term_id == $menu_locations[$menuloc]) {
// This is the correct menu
$menuid = $menu->slug;
var_dump($menu->slug);
// Get the items for this menu
$menu_items = get_nav_items($menuid);
break;
}
//else if ($menu->term_id != $menu_locations[ $menuloc ]) {
// $json_api->error("There are no menus set for this location.");
//}
}
} else {
$json_api->error("Menu location: '" . $menuloc . "' does not exist");
}
}
}
return array("count" => $menu_items["count"], "menu_location" => $menuloc, "menu_id" => $menuid, "menu" => $menu_items["output"]);
} else {
$json_api->error("Include the parameter 'menu_id' with an appropriate string value.");
}
}
示例13: tc_alter_wp_customizer_settings
function tc_alter_wp_customizer_settings($wp_customize)
{
//CHANGE BLOGNAME AND BLOGDESCRIPTION TRANSPORT
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
//IF WP VERSION >= 4.3 AND SITE_ICON SETTING EXISTS
//=> REMOVE CUSTOMIZR FAV ICON CONTROL
//=> CHANGE SITE ICON DEFAULT WP SECTION TO CUSTOMIZR LOGO SECTION
global $wp_version;
if (version_compare($wp_version, '4.3', '>=') && is_object($wp_customize->get_control('site_icon'))) {
$tc_option_group = TC___::$tc_option_group;
$wp_customize->remove_control("{$tc_option_group}[tc_fav_upload]");
//note : the setting is kept because used in the customizer js api to handle the transition between Customizr favicon to WP site icon.
$wp_customize->get_control('site_icon')->section = 'logo_sec';
//add a favicon title after the logo upload
add_action('__after_setting_control', array($this, 'tc_add_favicon_title'));
}
//end ALTER SITE ICON
//CHANGE MENUS PROPERTIES
$locations = get_registered_nav_menus();
$menus = wp_get_nav_menus();
$choices = array('' => __('— Select —', 'customizr'));
foreach ($menus as $menu) {
$choices[$menu->term_id] = wp_html_excerpt($menu->name, 40, '…');
}
$_priorities = array('main' => 10, 'secondary' => 20);
//WP only adds the menu(s) settings and controls if the user has created at least one menu.
//1) if no menus yet, we still want to display the menu picker + add a notice with a link to the admin menu creation panel
//=> add_setting and add_control for each menu location. Check if they are set first by security
//2) if user has already created a menu, the settings are already created, we just need to update the controls.
$_priority = 0;
//assign new priorities to the menus controls
foreach ($locations as $location => $description) {
$menu_setting_id = "nav_menu_locations[{$location}]";
//create the settings if they don't exist
//=> in the condition, make sure that the setting has really not been created yet (maybe over secured)
if (!$menus && !is_object($wp_customize->get_setting($menu_setting_id))) {
$wp_customize->add_setting($menu_setting_id, array('sanitize_callback' => 'absint', 'theme_supports' => 'menus'));
}
//remove the controls if they exists
if (is_object($wp_customize->get_control($menu_setting_id))) {
$wp_customize->remove_control($menu_setting_id);
}
//replace the controls by our custom controls
$_control_properties = array('label' => $description, 'section' => 'nav', 'title' => "main" == $location ? __('Assign menus to locations', 'customizr') : false, 'type' => 'select', 'choices' => $choices, 'priority' => isset($_priorities[$location]) ? $_priorities[$location] : $_priority);
//add a notice property if no menu created yet.
if (!$menus) {
//adapt the nav section description for v4.3 (menu in the customizer from now on)
$_create_menu_link = version_compare($GLOBALS['wp_version'], '4.3', '<') ? admin_url('nav-menus.php') : "javascript:wp.customize.section('nav').container.find('.customize-section-back').trigger('click'); wp.customize.panel('nav_menus').focus();";
$_control_properties['notice'] = sprintf(__("You haven't created any menu yet. %s or check the %s to learn more about menus.", "customizr"), sprintf('<strong><a href="%1$s" title="%2$s">%2$s</a></strong>', $_create_menu_link, __("Create a new menu now", "customizr")), sprintf('<a href="%1$s" title="%2$s" target="_blank">%2$s</a>', esc_url('codex.wordpress.org/WordPress_Menu_User_Guide'), __("WordPress documentation", "customizr")));
}
$wp_customize->add_control(new TC_controls($wp_customize, $menu_setting_id, $_control_properties));
$_priority = $_priority + 10;
}
//foreach
}
示例14: add_options
/**
* Add mega menu options
*
* @since 1.0.0
*
* @param array $sections default sections array
* @return array filtered sections array
*/
public function add_options($sections)
{
// Get menus
$menus = get_registered_nav_menus();
$options_menus = array('0' => __('Select main theme menu', 'cherry-mega-menu'));
$options_menus = array_merge($options_menus, $menus);
$menu_options = array('mega-menu-location' => array('type' => 'select', 'title' => __('Main theme menu location', 'cherry-mega-menu'), 'label' => __('Select the menu location for your main menu', 'cherry-mega-menu'), 'decsription' => '', 'hint' => array('type' => 'text', 'content' => __('Select menu location for main theme menu. Mega menu will be applied to this location.', 'cherry-mega-menu')), 'multiple' => true, 'value' => array('primary'), 'class' => 'cherry-multi-select', 'options' => $options_menus), 'mega-menu-enabled' => array('type' => 'switcher', 'title' => __('Mega menu enabled', 'cherry-mega-menu'), 'label' => __('Enable / Disable', 'cherry-mega-menu'), 'decsription' => '', 'hint' => array('type' => 'text', 'content' => __('This applies only to main site menu', 'cherry-mega-menu')), 'value' => 'true', 'default_value' => 'true'), 'mega-menu-mobile-trigger' => array('type' => 'slider', 'title' => __('Mobile starts from', 'cherry-mega-menu'), 'label' => __('Select the window dimensions for mobile menu layout switching.', 'cherry-mega-menu'), 'decsription' => '', 'hint' => array('type' => 'text', 'content' => __('Select the window dimensions for mobile menu layout switching.', 'cherry-mega-menu')), 'max_value' => 1200, 'min_value' => 480, 'value' => 768), 'mega-menu-mobile-label' => array('type' => 'text', 'title' => __('Mobile nav label', 'cherry-mega-menu'), 'label' => __('Enter the mobile navigation label ', 'cherry-mega-menu'), 'decsription' => '', 'hint' => array('type' => 'text', 'content' => __('Enter the mobile navigation label ', 'cherry-mega-menu')), 'value' => __('Menu', 'cherry-mega-menu'), 'default_value' => __('Menu', 'cherry-mega-menu')), 'mega-menu-direction' => array('type' => 'select', 'title' => __('Menu direction', 'cherry-mega-menu'), 'label' => __('Select your direction: vertical or horizontal', 'cherry-mega-menu'), 'decsription' => '', 'hint' => array('type' => 'text', 'content' => __('Select your direction: vertical or horizontal', 'cherry-mega-menu')), 'value' => 'horizontal', 'class' => 'width-full', 'options' => array('horizontal' => __('Horizontal', 'cherry-mega-menu'), 'vertical' => __('Vertical', 'cherry-mega-menu'))), 'mega-menu-effect' => array('type' => 'select', 'title' => __('Animation effect', 'cherry-mega-menu'), 'label' => __('Animation effects for the dropdown menu', 'cherry-mega-menu'), 'decsription' => '', 'hint' => array('type' => 'text', 'content' => __('Animation effects for the dropdown menu', 'cherry-mega-menu')), 'value' => 'slide-top', 'class' => 'width-full', 'options' => array('fade-in' => __('Fade In', 'cherry-mega-menu'), 'slide-top' => __('Slide from top', 'cherry-mega-menu'), 'slide-bottom' => __('Slide from bottom', 'cherry-mega-menu'), 'slide-left' => __('Slide from left', 'cherry-mega-menu'), 'slide-right' => __('Slide from right', 'cherry-mega-menu'))), 'mega-menu-event' => array('type' => 'select', 'title' => __('Event', 'cherry-mega-menu'), 'label' => __('Select an activation event', 'cherry-mega-menu'), 'decsription' => '', 'hint' => array('type' => 'text', 'content' => __('Select an activation event', 'cherry-mega-menu')), 'value' => 'hover', 'class' => 'width-full', 'options' => array('hover' => __('Hover', 'cherry-mega-menu'), 'click' => __('Click', 'cherry-mega-menu'))), 'mega-menu-parent-container' => array('type' => 'text', 'title' => __('Menu parent container CSS selector', 'cherry-mega-menu'), 'label' => __('Enter CSS selector name for mega menu parent container (if needed)', 'cherry-mega-menu'), 'decsription' => '', 'hint' => array('type' => 'text', 'content' => __('Enter CSS class name for mega menu parent container (if needed)', 'cherry-mega-menu')), 'value' => apply_filters('cherry_mega_menu_default_parent', '.cherry-mega-menu')));
$menu_options = apply_filters('cherry_mega_menu_options', $menu_options);
$sections['mega-menu-options-section'] = array('name' => 'Megamenu', 'icon' => 'dashicons dashicons-arrow-right', 'parent' => 'navigation-section', 'priority' => 41, 'options-list' => $menu_options);
return $sections;
}
示例15: wp_api_v2_menus_get_all_menus
/**
* Get all registered menus
* @return array List of menus with slug and description
*/
function wp_api_v2_menus_get_all_menus()
{
$menus = [];
foreach (get_registered_nav_menus() as $slug => $description) {
$obj = new stdClass();
$obj->slug = $slug;
$obj->description = $description;
$menus[] = $obj;
}
return $menus;
}