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

PHP wp_get_nav_menus函数代码示例

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

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



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

示例1: cs_shortcode_menu_render

function cs_shortcode_menu_render($atts)
{
    extract(shortcode_atts(array('title' => '', 'nav_menu' => '', 'el_class' => '', 'menu_align' => 'left', 'menu_line_height' => '80', 'css' => '', 'bg_image' => '', 'bg_color' => '', 'bg_image_repeat' => '', 'padding' => '', 'margin_bottom' => ''), $atts));
    ob_start();
    global $smof_data;
    $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'cs_custom_header_menu' . $el_class . $el_class . vc_shortcode_custom_css_class($css, ' '), 'cs-shortcode-menu', $atts);
    ?>
    <div id="menu" class="cs_mega_menu main-menu cs-menu-align-<?php 
    echo $menu_align;
    ?>
 cs-menu-line-height-<?php 
    echo $menu_line_height;
    ?>
 <?php 
    echo $css_class;
    ?>
">
		<div class="main-menu-content cshero-menu-dropdown clearfix nav-menu cshero-mobile">
			<?php 
    $menus = wp_get_nav_menus();
    if ($nav_menu) {
        echo '<ul class="cshero-dropdown main-menu">';
        wp_nav_menu(array('theme_location' => 'main_navigation', 'menu' => $nav_menu, 'depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s', 'walker' => new HeroMenuWalker()));
        if (is_active_sidebar('cshero-header-content-widget-1')) {
            ?>
                        <li>
                            <div class="header-cart-search">
                                <?php 
            if (!function_exists('dynamic_sidebar') || !dynamic_sidebar("Header Content Widget 1")) {
            }
            ?>
                            </div>
                        </li>
                        <?php 
        }
        if (isset($smof_data['enable_hidden_sidebar']) && $smof_data['enable_hidden_sidebar'] && !isMobile()) {
            ?>
                        <li>
                            <a href="#"><i class="fa fa-navicon cs_open"></i></a>
                        </li>
                        <?php 
        }
        echo '</ul>';
    } elseif (empty($menus)) {
        echo '<div class="menu-pages">';
        wp_nav_menu(array('depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s'));
        echo '</div>';
    } else {
        echo '<ul class="cshero-dropdown main-menu">';
        wp_nav_menu(array('depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s', 'walker' => new HeroMenuWalker()));
        echo '</ul>';
    }
    ?>
		</div>
	</div>
	<button type="button" class="btn btn-default btn-navbar navbar-toggle" data-toggle="collapse" data-target="#cshero-main-menu-mobile"><i class="fa fa-align-justify"></i></button>
	<div id="cshero-main-menu-mobile" class="collapse navbar-collapse cshero-mmenu"></div>
    <?php 
    return ob_get_clean();
}
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:60,代码来源:menu.php


示例2: ubermenu_add_toolbar_items

function ubermenu_add_toolbar_items($admin_bar)
{
    if (!current_user_can('manage_options')) {
        return;
    }
    if (ubermenu_op('ubermenu_toolbar', 'general') != 'on') {
        return;
    }
    $admin = is_admin();
    $admin_bar->add_node(array('id' => 'ubermenu', 'title' => ubermenu_toolbar_icon('gears') . 'UberMenu', 'href' => admin_url('themes.php?page=ubermenu-settings'), 'meta' => array('title' => __('UberMenu', 'UberMenu'))));
    $admin_bar->add_node(array('id' => 'ubermenu_customize', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('eye') . __('Customize', 'ubermenu'), 'href' => admin_url('customize.php'), 'meta' => array('title' => __('Configure the UberMenu Settings', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_control_panel', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('sliders') . __('UberMenu Control Panel', 'ubermenu'), 'href' => admin_url('themes.php?page=ubermenu-settings'), 'meta' => array('title' => '<i class="fa fa-sliders"></i> ' . __('Configure the UberMenu Settings', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_edit_menus', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('pencil') . __('Edit Menus', 'ubermenu'), 'href' => admin_url('nav-menus.php'), 'meta' => array('title' => __('Add, remove, and configure menu items', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $menus = wp_get_nav_menus(array('orderby' => 'name'));
    foreach ($menus as $menu) {
        $admin_bar->add_node(array('id' => 'ubermenu_edit_menus_' . $menu->slug, 'parent' => 'ubermenu_edit_menus', 'title' => $menu->name, 'href' => admin_url('nav-menus.php?action=edit&menu=' . $menu->term_id), 'meta' => array('title' => __('Configure', 'ubermenu') . ' ' . $menu->name, 'target' => '_blank', 'class' => '')));
    }
    $admin_bar->add_node(array('id' => 'ubermenu_assign_menus', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('bars') . __('Assign Menus', 'ubermenu'), 'href' => admin_url('nav-menus.php?action=locations'), 'meta' => array('title' => __('Theme Location Manager', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_knowledgebase', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('book') . __('Knowledgebase', 'ubermenu'), 'href' => UBERMENU_KB_URL, 'meta' => array('title' => __('UberMenu Knowledgebase / Support Guide', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_docs', 'parent' => 'ubermenu_knowledgebase', 'title' => ubermenu_toolbar_icon('book') . __('Documentation', 'ubermenu'), 'href' => UBERMENU_KB_URL, 'meta' => array('title' => __('UberMenu Knowledgebase / Support Guide', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_video_tutorials', 'parent' => 'ubermenu_knowledgebase', 'title' => ubermenu_toolbar_icon('video-camera') . __('Video Tutorials', 'ubermenu'), 'href' => UBERMENU_VIDEOS_URL, 'meta' => array('title' => __('UberMenu Video Tutorials', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    $admin_bar->add_node(array('id' => 'ubermenu_support', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('life-ring') . __('Support / Help', 'ubermenu'), 'href' => UBERMENU_SUPPORT_URL, 'meta' => array('title' => __('UberMenu Support Center', 'ubermenu'), 'target' => '_blank', 'class' => '')));
    if (!is_admin()) {
        //Diagnostics
        if (ubermenu_op('diagnostics', 'general') == 'on') {
            $admin_bar->add_node(array('id' => 'ubermenu_diagnostics', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('stethoscope') . __('Diagnostics (Alpha)', 'ubermenu'), 'href' => '#', 'meta' => array('title' => __('Load diagnostics script (experimental feature in Alpha development)', 'ubermenu'), 'class' => 'ubermenu-diagnostics-loader-button')));
        }
        //Loading Message
        $admin_bar->add_node(array('id' => 'ubermenu_loading', 'title' => ubermenu_toolbar_icon('exclamation-triangle') . ' UberMenu Loading...', 'href' => '#'));
        $loading_msg = __('If this message does not disappear, it means that UberMenu\'s javascript has not been able to load.  This most commonly indicates that you have a javascript error on this page, which will need to be resolved in order to allow UberMenu to run.', 'ubermenu');
        //$loading_msg.= ' <a target="_blank" href="http://goo.gl/oS6L6C">How to check for javascript errors.</a>';
        $admin_bar->add_node(array('id' => 'ubermenu_loading_msg', 'parent' => 'ubermenu_loading', 'title' => $loading_msg, 'href' => 'http://goo.gl/oS6L6C', 'meta' => array('target' => '_blank')));
    }
}
开发者ID:eckul,项目名称:lukehoneydesign,代码行数:34,代码来源:toolbar.php


示例3: render_content

        /**
         * Render the content on the theme customizer page
         */
        public function render_content()
        {
            ?>
                    <label>
                      <span class="customize-menu-dropdown"><?php 
            echo esc_html($this->label);
            ?>
</span>
                      <select name="<?php 
            echo $this->id;
            ?>
" id="<?php 
            echo $this->id;
            ?>
">
                        <?php 
            $menus = wp_get_nav_menus($args);
            if ($menus) {
                foreach ($menus as $menu) {
                    echo '<option value="' . $menu->term_id . '"' . selected($this->value, $menu->term_id) . '>' . $menu->name . '</option>';
                }
            }
            ?>
                      </select>
                    </label>
                <?php 
        }
开发者ID:style55,项目名称:WordPress-Theme-Customizer-Custom-Controls,代码行数:30,代码来源:menu_dropdown_custom_control.php


示例4: us_dataImport

 function us_dataImport()
 {
     if (!defined('WP_LOAD_IMPORTERS')) {
         define('WP_LOAD_IMPORTERS', true);
     }
     require_once get_template_directory() . '/vendor/wordpress-importer/wordpress-importer.php';
     if (!is_file(get_template_directory() . '/xml/demo_data.xml')) {
         echo "Automatic import failed. Please use the wordpress importer and import the XML file (Astra/xml/demo_data.xml) manually.";
     } else {
         $wp_import = new WP_Import();
         $wp_import->fetch_attachments = true;
         $wp_import->import(get_template_directory() . '/xml/demo_data.xml');
         // Set menu
         $locations = get_theme_mod('nav_menu_locations');
         $menus = wp_get_nav_menus();
         if (!empty($menus)) {
             foreach ($menus as $menu) {
                 if (is_object($menu) && $menu->name == 'Astra Main Menu') {
                     $locations['astra_main_menu'] = $menu->term_id;
                 }
                 if (is_object($menu) && $menu->name == 'Astra Footer Menu') {
                     $locations['astra_footer_menu'] = $menu->term_id;
                 }
             }
         }
         set_theme_mod('nav_menu_locations', $locations);
     }
     die;
 }
开发者ID:syncopetwice,项目名称:STG,代码行数:29,代码来源:ajax_import.php


示例5: bigblank_footer_menu_fallback

 /**
  * Footer menu fallback
  */
 function bigblank_footer_menu_fallback()
 {
     $menus = wp_get_nav_menus();
     if (!empty($menus)) {
         return wp_nav_menu(array('container' => 'nav', 'depth' => 1, 'container_id' => 'footer-nav'));
     }
 }
开发者ID:victorknust,项目名称:BigBlankTheme,代码行数:10,代码来源:template-tags.php


示例6: customize_registering

 function customize_registering($wp_customize)
 {
     global $xili_language;
     // in_nav_menu
     $locations = get_registered_nav_menus();
     $menus = wp_get_nav_menus();
     $menu_locations = get_nav_menu_locations();
     $num_locations = count(array_keys($locations));
     if ($num_locations >= 1 && count($menu_locations) >= 1) {
         $wp_customize->add_section('xili_options_section', array('title' => __('Multilingual Options ©xili', 'xili-language'), 'priority' => 300, 'description' => sprintf(_n('Your theme supports %s menu. Customize style.', 'Your theme supports %s menus. Customize style.', $num_locations, 'xili-language'), number_format_i18n($num_locations)) . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.')));
         $location_slugs = array_keys($locations);
         if (0 == $xili_language->has_languages_list_menu($location_slugs[0])) {
             // only test one menu during transition
             $wp_customize->add_setting('xili_language_settings[in_nav_menu]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('in_nav_menu', array('settings' => 'xili_language_settings[in_nav_menu]', 'label' => __('Append the languages', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'radio', 'choices' => array('disable' => __('No languages menu-items', 'xili-language'), 'enable' => __('Show languages menu-items', 'xili-language'))));
             $wp_customize->add_setting('xili_language_settings[nav_menu_separator]', array('default' => '|', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('nav_menu_separator', array('settings' => 'xili_language_settings[nav_menu_separator]', 'label' => __('Separator before language list (Character or Entity Number or Entity Name)', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'text'));
         }
         if (!current_theme_supports('custom_xili_flag')) {
             $wp_customize->add_setting($this->settings_name . '[no_flags]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
             $wp_customize->add_control('no_flags', array('settings' => $this->settings_name . '[no_flags]', 'label' => __('Hide the flags', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'checkbox'));
         }
     } else {
         $wp_customize->add_section('xili_options_section', array('title' => __('Multilingual Options ©xili', 'xili-language'), 'priority' => 300, 'description' => __('None nav menus location seems active', 'xili-language')));
     }
     $wp_customize->add_setting($this->settings_name . '[linked_posts]', array('default' => '', 'transport' => 'refresh', 'type' => 'option', 'capability' => $this->capability));
     $wp_customize->add_control('linked_posts', array('settings' => $this->settings_name . '[linked_posts]', 'label' => __('Show linked posts', 'xili-language'), 'section' => 'xili_options_section', 'type' => 'checkbox'));
 }
开发者ID:ergov2015,项目名称:rideflag.dev,代码行数:28,代码来源:theme-multilingual-classes.php


示例7: __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);
 }
开发者ID:rinodung,项目名称:myfreetheme,代码行数:25,代码来源:row-options.php


示例8: yb_page_menus_save_post

function yb_page_menus_save_post($post_id, $post_object)
{
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    if (!isset($_POST['meta_box_nonce']) || !wp_verify_nonce($_POST['meta_box_nonce'], 'yb_page_menus_nonce')) {
        return;
    }
    /* If this is just a revision, don't save in menu */
    if (wp_is_post_revision($post_id)) {
        return;
    }
    /* save the data with update_post_meta */
    $all_menus = wp_get_nav_menus();
    /* save the data with update_post_meta */
    foreach ($all_menus as $menu) {
        $menuID = (int) $menu->term_id;
        if (isset($_POST['nav-menu-group']) && in_array($menu->name, $_POST['nav-menu-group'])) {
            if (!checkMenuForPage($menuID, $post_id)) {
                $itemData = array('menu-item-object-id' => $post_id, 'menu-item-title' => __(get_the_title($post_id)), 'menu-item-url' => get_permalink($post_id), 'menu-item-object' => 'page', 'menu-item-position' => $post_object->menu_order, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish');
                remove_action('save_post', 'yb_page_menus_save_post', 13, 2);
                wp_update_nav_menu_item($menuID, 0, $itemData);
                add_action('save_post', 'yb_page_menus_save_post', 13, 2);
            }
        } else {
            $isInMenu = checkMenuForPage($menuID, $post_id);
            if ($isInMenu) {
                wp_delete_post($isInMenu);
            }
        }
    }
}
开发者ID:shelbyneilsmith,项目名称:yb-theme,代码行数:32,代码来源:functions-page_menus.php


示例9: getMenus

 protected function getMenus($args = [])
 {
     $defaults = ['orderby' => 'name'];
     $args = wp_parse_args($args, $defaults);
     $menus = wp_get_nav_menus(apply_filters('g5_assignments_get_menus_args', $args));
     return $menus;
 }
开发者ID:nmsde,项目名称:gantry5,代码行数:7,代码来源:AssignmentsMenu.php


示例10: set_menus

 /**
  * @return bool
  * Function reset menu for theme
  */
 function set_menus()
 {
     $tp_menus = wp_get_nav_menus();
     @($menu_nav_settings = thim_file_get_contents(MENU_CONFIG));
     $menu_reading_settings = thim_file_get_contents(MENU_READING_CONFIG);
     if ($menu_reading_settings) {
         $menu_reading_settings = array_filter(explode(',', $menu_reading_settings));
     }
     if (count($menu_reading_settings)) {
         if (isset($menu_reading_settings[1]) && trim($menu_reading_settings[0]) == 'page') {
             update_option('show_on_front', trim($menu_reading_settings[0]));
             $page = get_page_by_title(trim($menu_reading_settings[1]));
             if ($page) {
                 update_option('page_on_front', $page->ID);
             }
         }
     }
     //get all registered menu locations
     @($locations = get_theme_mod('nav_menu_locations'));
     if ($menu_nav_settings) {
         $menu_nav_settings = explode("\n", $menu_nav_settings);
         $menu_nav_settings = array_filter($menu_nav_settings);
         $menu_nav = array();
         for ($i = 0; $i < count($menu_nav_settings); $i++) {
             $key_nav = explode(',', $menu_nav_settings[$i]);
             if (count($key_nav) > 1) {
                 @($menu_nav[trim(strtolower(str_replace(' ', '_', trim($key_nav[0]))))] = trim($key_nav[1]));
             }
         }
     }
     //get all created menus
     if (!empty($tp_menus) && !empty($menu_nav)) {
         foreach ($tp_menus as $tp_menu) {
             //check if we got a menu that corresponds to the Menu name array ($menu_nav) we have set in functions.php
             if (is_object($tp_menu) && in_array($tp_menu->name, $menu_nav)) {
                 $key = array_search($tp_menu->name, $menu_nav);
                 //update the theme
                 if ($key) {
                     //if we have found a menu with the correct menu name apply the id to the menu location
                     $locations[$key] = $tp_menu->term_id;
                 }
             }
         }
     } else {
         return false;
     }
     @set_theme_mod('nav_menu_locations', $locations);
     if (class_exists('Woocommerce')) {
         // Set pages
         $woopages = array('woocommerce_shop_page_id' => 'Shop', 'woocommerce_cart_page_id' => 'Cart', 'woocommerce_checkout_page_id' => 'Checkout', 'woocommerce_pay_page_id' => 'Checkout &#8594; Pay', 'woocommerce_thanks_page_id' => 'Order Received', 'woocommerce_myaccount_page_id' => 'My Account', 'woocommerce_edit_address_page_id' => 'Edit My Address', 'woocommerce_view_order_page_id' => 'View Order', 'woocommerce_change_password_page_id' => 'Change Password', 'woocommerce_logout_page_id' => 'Logout', 'woocommerce_lost_password_page_id' => 'Lost Password');
         foreach ($woopages as $woo_page_name => $woo_page_title) {
             $woopage = get_page_by_title($woo_page_title);
             if (isset($woopage->ID)) {
                 update_option($woo_page_name, $woopage->ID);
                 // Front Page
             }
         }
     }
     return true;
 }
开发者ID:vinhnq1211,项目名称:funy,代码行数:64,代码来源:tp-import-class.php


示例11: 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;
}
开发者ID:WackoMako,项目名称:stonedape,代码行数:35,代码来源:settings.pro.php


示例12: _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


示例13: __construct

 function __construct()
 {
     self::$menus = [];
     foreach (wp_get_nav_menus() as $menu) {
         self::$menus[$menu->slug] = $menu;
     }
 }
开发者ID:proudcity,项目名称:wp-proud-core,代码行数:7,代码来源:proud-menu.php


示例14: get_settings_fields

 /**
  * Returns all the settings fields
  *
  * @return array settings fields
  */
 function get_settings_fields()
 {
     $locations = get_nav_menu_locations();
     /*
     $locations = Array
     	(
     		[location_name] = > currently_assigned_menu_id
     		[primary] => 12
     		[sidebar] => 2
     		[footer] => 0
     		
     	)
     */
     $exclude_theme_locations_opt = array();
     foreach ($locations as $key => $val) {
         $exclude_theme_locations_opt[$key] = ucfirst($key);
     }
     // Get menus
     $menus = wp_get_nav_menus();
     $exclude_menus_opt = array();
     foreach ($menus as $menu) {
         $exclude_menus_opt[$menu->term_id . "|" . $menu->slug . "|" . $menu->name] = $menu->name;
     }
     $settings_fields = array('wp_nav_menu_cache' => array(array('name' => 'exclude_theme_locations', 'label' => 'Exclude Theme Locations', 'desc' => "Check theme location you don't want to cache any menu of", 'type' => 'multicheck', 'options' => $exclude_theme_locations_opt), array('name' => 'exclude_menus', 'label' => 'Exclude Menus', 'desc' => "Check wich menu you don't want to cache.<br>You need this if you use Custom Menu widget or if you assign a menu with the call of wp_nav_menu() function in theme files.", 'type' => 'multicheck', 'options' => $exclude_menus_opt), array('name' => 'individual_url', 'label' => 'Cache for Individual URL', 'desc' => 'Enable <br><span style="color:#ff0000">You should not enable this option if you have a huge number of <strong>posts/pages</strong> on your site.<br>This option caches each menu individually <strong>for each post/page or any visited url</strong>.<br>This can result in a <strong>huge number of cached menu files</strong> on your site, which could actually resulted in a <strong>slower site</strong>.<br>It could also cross the <strong>limitation of number of files</strong> in a single directory.</span>', 'type' => 'checkbox')));
     return $settings_fields;
 }
开发者ID:onetarek,项目名称:wp-nav-menu-cache,代码行数:31,代码来源:option-page.php


示例15: register

 function register()
 {
     // Init Post Type
     $post = new SpyropressCustomPostType('Page');
     $menus = wp_get_nav_menus();
     $menu_options = array();
     if (isset($menus) && count($menus) > 0) {
         foreach ($menus as $menu) {
             $menu_options[$menu->term_id] = $menu->name;
         }
     }
     // Add Meta Boxes
     $meta_fields['options'] = array(array('label' => __('Slider', 'spyropress'), 'type' => 'heading', 'slug' => 'options'), array('label' => __('OnePage Navigation Menu', 'spyropress'), 'id' => 'onepage_menu', 'type' => 'select', 'class' => 'page_template one-page-php', 'options' => $menu_options), array('label' => __('Slider', 'spyropress'), 'type' => 'sub_heading'), array('label' => __('Slider Type', 'spyropress'), 'id' => 'slider', 'type' => 'select', 'class' => 'enable_changer', 'options' => array('nivo' => __('Nivo Slider', 'spyropress'), 'rev' => __('Revolution Slider', 'spyropress'))), array('label' => __('Nivo Slider', 'spyropress'), 'id' => 'nivo_slider', 'type' => 'select', 'class' => 'slider nivo', 'options' => spyropress_get_sliders()));
     if (class_exists('RevSlider')) {
         $slider = new RevSlider();
         $arrSliders = $slider->getArrSlidersShort();
         $meta_fields['options'][] = array('label' => __('Revolution Slider', 'spyropress'), 'id' => 'rev_slider', 'type' => 'select', 'class' => 'slider rev', 'options' => $arrSliders);
         $meta_fields['options'][] = array('label' => __('Revolution Slider Skin', 'spyropress'), 'id' => 'rev_slider_skin', 'type' => 'select', 'class' => 'slider rev', 'options' => array('dark' => __('Dark', 'spyropress'), 'light' => __('Light', 'spyropress'), 'full' => __('FullScreen', 'spyropress'), 'dark dark-video' => __('Video - Dark', 'spyropress'), 'light dark-light' => __('Video - Light', 'spyropress')), 'std' => 'dark');
     }
     $meta_fields['options'][] = array('label' => __('Header', 'spyropress'), 'type' => 'sub_heading');
     $meta_fields['options'][] = array('label' => __('Header Type', 'spyropress'), 'id' => 'top_header', 'type' => 'select', 'class' => 'enable_changer', 'options' => array('none' => __('None', 'spyropress'), 'default' => __('Default', 'spyropress'), 'custom' => __('Custom Header', 'spyropress')), 'std' => 'default');
     $meta_fields['options'][] = array('label' => __('Custom Header Bucket', 'spyropress'), 'id' => 'bucket', 'type' => 'select', 'class' => 'top_header custom', 'desc' => __('Either use Bucket or Content', 'spyropress'), 'options' => spyropress_get_buckets());
     $meta_fields['options'][] = array('label' => __('Custom Header Content', 'spyropress'), 'id' => 'header_content', 'type' => 'editor', 'desc' => __('Either use Bucket or Content', 'spyropress'), 'class' => 'top_header custom');
     $meta_fields['options'][] = array('label' => __('Custom Header Background', 'spyropress'), 'id' => 'background', 'type' => 'background', 'class' => 'top_header custom');
     $meta_fields['options'][] = array('label' => __('Top Border color', 'spyropress'), 'id' => 'border_top', 'type' => 'colorpicker', 'class' => 'top_header custom');
     $meta_fields['options'][] = array('label' => __('Bottom Border color', 'spyropress'), 'id' => 'border_bottom', 'type' => 'colorpicker', 'class' => 'top_header custom');
     $meta_fields['options'][] = array('label' => __('Layout', 'spyropress'), 'type' => 'sub_heading');
     $meta_fields['options'][] = array('label' => __('Layout Type', 'spyropress'), 'id' => 'layout_type', 'type' => 'select', 'options' => array('full' => __('Full Width', 'spyropress'), 'left' => __('Left Sidebar', 'spyropress'), 'right' => __('Right Sidebar', 'spyropress')), 'std' => 'full');
     $post->add_meta_box('page_options', __('Page Options', 'spyropress'), $meta_fields, '_page_options', false, 'normal', 'high');
 }
开发者ID:rinodung,项目名称:myfreetheme,代码行数:30,代码来源:page-init.php


示例16: kt_register_meta_boxes

function kt_register_meta_boxes($meta_boxes)
{
    $prefix = '_kt_';
    $menus = wp_get_nav_menus();
    $menus_arr = array('' => esc_html__('Default', 'adroit'));
    foreach ($menus as $menu) {
        $menus_arr[$menu->term_id] = esc_html($menu->name);
    }
    $sidebars = array();
    foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) {
        $sidebars[$sidebar['id']] = ucwords($sidebar['name']);
    }
    $tabs = array('page_layout' => array('label' => esc_html__('Layout', 'adroit'), 'icon' => 'fa fa-columns'), 'page_background' => array('label' => esc_html__('Background', 'adroit'), 'icon' => 'fa fa-picture-o'));
    $fields = array(array('name' => esc_html__('Page layout', 'adroit'), 'id' => $prefix . 'layout', 'desc' => esc_html__("Please choose this page's layout.", 'adroit'), 'type' => 'select', 'options' => array('default' => esc_html__('Default', 'adroit'), 'full' => esc_html__('Full width Layout', 'adroit'), 'boxed' => esc_html__('Boxed Layout', 'adroit')), 'std' => 'default', 'tab' => 'page_layout'), array('name' => esc_html__('Sidebar configuration', 'adroit'), 'id' => $prefix . 'sidebar', 'desc' => esc_html__("Choose the sidebar configuration for the detail page.<br/><b>Note: Cart and checkout, My account page always use no sidebars.</b>", 'adroit'), 'type' => 'select', 'options' => array(0 => esc_html__('Default', 'adroit'), 'full' => esc_html__('No sidebars', 'adroit'), 'left' => esc_html__('Left Sidebar', 'adroit'), 'right' => esc_html__('Right Sidebar', 'adroit')), 'std' => 'default', 'tab' => 'page_layout'), array('name' => esc_html__('Left sidebar', 'adroit'), 'id' => $prefix . 'left_sidebar', 'type' => 'select', 'tab' => 'page_layout', 'options' => $sidebars, 'desc' => esc_html__("Select your sidebar.", 'adroit'), 'visible' => array($prefix . 'sidebar', '=', 'left')), array('name' => esc_html__('Right sidebar', 'adroit'), 'id' => $prefix . 'right_sidebar', 'type' => 'select', 'tab' => 'page_layout', 'options' => $sidebars, 'desc' => esc_html__("Select your sidebar.", 'adroit'), 'visible' => array($prefix . 'sidebar', '=', 'right')), array('name' => esc_html__('Page top spacing', 'adroit'), 'id' => $prefix . 'page_top_spacing', 'desc' => esc_html__("Enter your page top spacing (Example: 100px).", 'adroit'), 'type' => 'text', 'tab' => 'page_layout'), array('name' => esc_html__('Page bottom spacing', 'adroit'), 'id' => $prefix . 'page_bottom_spacing', 'desc' => esc_html__("Enter your page bottom spacing (Example: 100px).", 'adroit'), 'type' => 'text', 'tab' => 'page_layout'), array('name' => esc_html__('Extra page class', 'adroit'), 'id' => $prefix . 'extra_page_class', 'desc' => esc_html__('If you wish to add extra classes to the body class of the page (for custom css use), then please add the class(es) here.', 'adroit'), 'type' => 'text', 'tab' => 'page_layout'), array('name' => esc_html__('Background', 'adroit'), 'id' => $prefix . 'background_body', 'type' => 'background', 'tab' => 'page_background', 'desc' => esc_html__('The option that will be used as the OUTER page.', 'adroit')), array('name' => esc_html__('Inner Background', 'adroit'), 'id' => $prefix . 'background_inner', 'type' => 'background', 'tab' => 'page_background', 'desc' => esc_html__('The option that will be used as the INNER page.', 'adroit')));
    $tabs_page = array('header' => array('label' => esc_html__('Header', 'adroit'), 'icon' => 'fa fa-desktop'), 'page_header' => array('label' => esc_html__('Page Header', 'adroit'), 'icon' => 'fa fa-bars'));
    $fields_page = array(array('name' => esc_html__('Page Header', 'adroit'), 'id' => $prefix . 'page_header', 'desc' => esc_html__("Show Page Header.", 'adroit'), 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'page_header'), array('name' => esc_html__('Page Header Custom Text', 'adroit'), 'id' => $prefix . 'page_header_custom', 'desc' => esc_html__("Enter cstom Text for page header.", 'adroit'), 'type' => 'text', 'tab' => 'page_header', 'visible' => array($prefix . 'page_header', '!=', 'off')), array('name' => esc_html__('Page header subtitle', 'adroit'), 'id' => $prefix . 'page_header_subtitle', 'desc' => esc_html__("Enter subtitle for page.", 'adroit'), 'type' => 'text', 'tab' => 'page_header', 'visible' => array($prefix . 'page_header', '!=', 'off')), array('name' => esc_html__('Header position', 'adroit'), 'type' => 'select', 'id' => $prefix . 'header_position', 'desc' => esc_html__("Please choose header position", 'adroit'), 'options' => array('default' => esc_html__('Default', 'adroit'), 'below' => esc_html__('Below Slideshow', 'adroit')), 'std' => 'default', 'tab' => 'header'), array('name' => esc_html__('Select Your Slideshow Type', 'adroit'), 'id' => $prefix . 'slideshow_type', 'desc' => esc_html__("You can select the slideshow type using this option.", 'adroit'), 'type' => 'select', 'options' => array('' => esc_html__('Select Option', 'adroit'), 'revslider' => esc_html__('Revolution Slider', 'adroit'), 'layerslider' => esc_html__('Layer Slider', 'adroit')), 'tab' => 'header'), array('name' => esc_html__('Select Revolution Slider', 'adroit'), 'id' => $prefix . 'rev_slider', 'default' => true, 'type' => 'revSlider', 'tab' => 'header', 'desc' => esc_html__('Select the Revolution Slider.', 'adroit'), 'visible' => array($prefix . 'slideshow_type', '=', 'revslider')), array('name' => esc_html__('Select Layer Slider', 'adroit'), 'id' => $prefix . 'layerslider', 'default' => true, 'type' => 'layerslider', 'tab' => 'header', 'desc' => esc_html__('Select the Layer Slider.', 'adroit'), 'visible' => array($prefix . 'slideshow_type', '=', 'layerslider')));
    /**
     * For Page Options
     *
     */
    $meta_boxes[] = array('id' => 'page_meta_boxes', 'title' => esc_html__('Page Options', 'adroit'), 'pages' => array('page'), 'tabs' => array_merge($tabs, $tabs_page), 'fields' => array_merge($fields, $fields_page));
    $tabs_post = array('post_general' => array('label' => esc_html__('General', 'adroit'), 'icon' => 'fa fa-bars'), 'post_header' => array('label' => esc_html__('Header', 'adroit'), 'icon' => 'fa fa-desktop'));
    $fields_post = array(array('type' => 'image_radio', 'name' => esc_html__('Post layouts', 'adroit'), 'desc' => esc_html__('Select the your post layout.', 'adroit'), 'id' => "{$prefix}blog_post_layout", 'options' => array('' => array('url' => KT_FW_IMG . 'single/default.jpg', 'alt' => esc_html__('Default', 'adroit')), 1 => array('url' => KT_FW_IMG . 'single/layout-1.jpg', 'alt' => esc_html__('Layout 1', 'adroit')), 2 => array('url' => KT_FW_IMG . 'single/layout-2.jpg', 'alt' => esc_html__('Layout 2', 'adroit')), 3 => array('url' => KT_FW_IMG . 'single/layout-3.jpg', 'alt' => esc_html__('Layout 3', 'adroit')), 4 => array('url' => KT_FW_IMG . 'single/layout-4.jpg', 'alt' => esc_html__('Layout 4', 'adroit')), 5 => array('url' => KT_FW_IMG . 'single/layout-5.jpg', 'alt' => esc_html__('Layout 5', 'adroit')), 6 => array('url' => KT_FW_IMG . 'single/layout-6.jpg', 'alt' => esc_html__('Layout 6', 'adroit'))), 'attributes' => '', 'std' => '', 'tab' => 'post_general'), array('name' => esc_html__('Previous & next buttons', 'adroit'), 'id' => "{$prefix}prev_next", 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'post_general', 'desc' => esc_html__('Select "Default" to use settings in Theme Options', 'adroit')), array('name' => esc_html__('Author info', 'adroit'), 'id' => "{$prefix}author_info", 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'post_general', 'desc' => esc_html__('Select "Default" to use settings in Theme Options', 'adroit')), array('name' => esc_html__('Social sharing', 'adroit'), 'id' => "{$prefix}social_sharing", 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'post_general', 'desc' => esc_html__('Select "Default" to use settings in Theme Options', 'adroit')), array('name' => esc_html__('Related articles', 'adroit'), 'id' => "{$prefix}related_acticles", 'type' => 'select', 'options' => array('' => esc_html__('Default', 'adroit'), 'off' => esc_html__('Hidden', 'adroit'), 'on' => esc_html__('Show', 'adroit')), 'std' => '', 'tab' => 'post_general', 'desc' => esc_html__('Select "Default" to use settings in Theme Options', 'adroit')));
    /**
     * For Posts Options
     *
     */
    $meta_boxes[] = array('id' => 'post_meta_boxes', 'title' => 'Post Options', 'pages' => array('p 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wp_get_network函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_get_nav_menu_to_edit函数代码示例发布时间: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