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


PHP wp_create_nav_menu函数代码示例

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


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

示例1: landing_setup

 function landing_setup()
 {
     load_theme_textdomain('landing', get_template_directory() . '/languages');
     add_theme_support("title-tag");
     add_theme_support('menus');
     add_theme_support('post-thumbnails');
     $menu_name = 'landing';
     $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' => __('Обо мне', 'landing'), 'menu-item-url' => home_url('/#about'), 'menu-item-status' => 'publish'));
         wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Резюме', 'landing'), 'menu-item-url' => home_url('/#resume'), 'menu-item-status' => 'publish'));
         wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Портволио', 'landing'), 'menu-item-url' => home_url('/#portfolio'), 'menu-item-status' => 'publish'));
         wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Контакты', 'landing'), 'menu-item-url' => home_url('/#contacts'), 'menu-item-status' => 'publish'));
     }
     $menu_name = 'social';
     $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' => __('Twitter profile', 'landing'), 'menu-item-target' => '_blank', 'menu-item-url' => '#', 'menu-item-classes' => 'fa fa-twitter', 'menu-item-status' => 'publish'));
         wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Facebook profile', 'landing'), 'menu-item-target' => '_blank', 'menu-item-url' => '#', 'menu-item-classes' => 'fa fa-facebook', 'menu-item-status' => 'publish'));
         wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Github profile', 'landing'), 'menu-item-target' => '_blank', 'menu-item-url' => '#', 'menu-item-classes' => 'fa fa-github', 'menu-item-status' => 'publish'));
         wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Vk profile', 'landing'), 'menu-item-target' => '_blank', 'menu-item-url' => '#', 'menu-item-classes' => 'fa fa-vk', 'menu-item-status' => 'publish'));
     }
 }
开发者ID:CrystalEller,项目名称:LandingPage,代码行数:25,代码来源:functions.php

示例2: 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

示例3: create_test_menus

 /**
  * create optional test nav menu
  * 
  * At least two custom menus should be created in order to test a theme
  * The standard Theme data file now ships with optimal menus built-in
  * This method actually makes sense with custom WXR files only
  * 
  * @since 0.2
  */
 private function create_test_menus()
 {
     $pages = get_all_page_ids();
     $items = array();
     foreach ($pages as $page_ID) {
         $info = get_page($page_ID);
         $items[$info->post_title] = get_permalink($page_ID);
     }
     # pick three random entries
     $random = array_rand($items, 3);
     # build menus
     $menus = array('Full Menu' => array('slug' => 'full-menu', 'menu_items' => $items), 'Short Menu' => array('slug' => 'short-menu', 'menu_items' => array($items[$random[0]], $items[$random[1]], $items[$random[2]])));
     # register menus
     foreach ($menus as $title => $data) {
         register_nav_menu($data['slug'], $title);
         if (false == is_nav_menu($title)) {
             $menu_ID = wp_create_nav_menu($title);
             foreach ($data['menu_items'] as $name => $url) {
                 $add_item = array('menu-item-type' => 'custom', 'menu-item-url' => $url, 'menu-item-title' => $name);
                 wp_update_nav_menu_item($menu_ID, 0, $add_item);
             }
             WP_CLI::success('Created menu ' . $title);
         }
     }
 }
开发者ID:pixline,项目名称:wp-cli-theme-test-command,代码行数:34,代码来源:wp-cli-theme-test-command.php

示例4: duplicate

 function duplicate($id = null, $name = null)
 {
     // sanity check
     if (empty($id) || empty($name)) {
         return false;
     }
     $id = intval($id);
     $name = sanitize_text_field($name);
     $source = wp_get_nav_menu_object($id);
     $source_items = wp_get_nav_menu_items($id);
     $new_id = wp_create_nav_menu($name);
     if (!$new_id) {
         return false;
     }
     // key is the original db ID, val is the new
     $rel = array();
     $i = 1;
     foreach ($source_items as $menu_item) {
         $args = array('menu-item-db-id' => $menu_item->db_id, 'menu-item-object-id' => $menu_item->object_id, 'menu-item-object' => $menu_item->object, 'menu-item-position' => $i, 'menu-item-type' => $menu_item->type, 'menu-item-title' => $menu_item->title, 'menu-item-url' => $menu_item->url, 'menu-item-description' => $menu_item->description, 'menu-item-attr-title' => $menu_item->attr_title, 'menu-item-target' => $menu_item->target, 'menu-item-classes' => implode(' ', $menu_item->classes), 'menu-item-xfn' => $menu_item->xfn, 'menu-item-status' => $menu_item->post_status);
         $parent_id = wp_update_nav_menu_item($new_id, 0, $args);
         $rel[$menu_item->db_id] = $parent_id;
         // did it have a parent? if so, we need to update with the NEW ID
         if ($menu_item->menu_item_parent) {
             $args['menu-item-parent-id'] = $rel[$menu_item->menu_item_parent];
             $parent_id = wp_update_nav_menu_item($new_id, $parent_id, $args);
         }
         // allow developers to run any custom functionality they'd like
         do_action('duplicate_menu_item', $menu_item, $args);
         $i++;
     }
     return $new_id;
 }
开发者ID:robertmeans,项目名称:evergreentaphouse,代码行数:32,代码来源:duplicate-menu.php

示例5: infinity_register_bp_menu

/**
 * Register and create a custom BuddyPress menu
 */
function infinity_register_bp_menu($menu_name)
{
    global $blog_id;
    // check BP reqs and if our custom default menu already exists
    if (function_exists('bp_core_get_directory_pages') && BP_ROOT_BLOG == $blog_id && !is_nav_menu($menu_name)) {
        // doesn't exist, create it
        $menu_id = wp_create_nav_menu($menu_name);
        // get bp pages
        $pages = bp_core_get_directory_pages();
        // allowed pages
        $pages_ok = array('activity' => true, 'blogs' => true, 'forums' => true, 'groups' => true, 'links' => true, 'members' => true);
        // loop all pages
        foreach ($pages as $config) {
            // make sure we support this page
            if (array_key_exists($config->name, $pages_ok)) {
                // yep, add page as a nav item
                wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'post_type', 'menu-item-status' => 'publish', 'menu-item-object' => 'page', 'menu-item-object-id' => $config->id, 'menu-item-title' => $config->title, 'menu-item-attr-title' => $config->title, 'menu-item-classes' => 'icon-' . $config->name));
            }
        }
        // get location settings
        $locations = get_theme_mod('nav_menu_locations');
        // is main menu location set yet?
        if (empty($locations['main-menu'])) {
            // nope, set it
            $locations['main-menu'] = $menu_id;
            // update theme mode
            set_theme_mod('nav_menu_locations', $locations);
        }
    }
}
开发者ID:shads196770,项目名称:cbox-theme,代码行数:33,代码来源:menus.php

示例6: processMenu

 private function processMenu(&$menu)
 {
     $objMenu = wp_get_nav_menu_object($menu->slug);
     if (!$objMenu) {
         $id = wp_create_nav_menu($menu->slug);
         $objMenu = wp_get_nav_menu_object($menu->slug);
     }
     $menuId = $objMenu->term_id;
     $menu->id = $menuId;
     wp_set_current_user(1);
     $loggedInmenuItems = wp_get_nav_menu_items($menu->slug);
     wp_set_current_user(0);
     $notloggedInmenuItems = wp_get_nav_menu_items($menu->slug);
     $existingMenuItems = array_merge($loggedInmenuItems, $notloggedInmenuItems);
     foreach ($existingMenuItems as $existingMenuItem) {
         $ret = wp_delete_post($existingMenuItem->ID, true);
     }
     foreach ($menu->items as &$objMenuItem) {
         $newTarget = findTargetPostId($objMenuItem->meta->postMeta['_menu_item_object_id'][0]);
         $parentItem = $this->findMenuItem($objMenuItem->meta->postMeta['_menu_item_menu_item_parent'][0]);
         $args = ['menu-item-title' => $objMenuItem->meta->post_title, 'menu-item-position' => $objMenuItem->meta->menu_order, 'menu-item-description' => $objMenuItem->meta->post_content, 'menu-item-attr-title' => $objMenuItem->meta->post_title, 'menu-item-status' => $objMenuItem->meta->post_status, 'menu-item-type' => $objMenuItem->meta->postMeta['_menu_item_type'][0], 'menu-item-object' => $objMenuItem->meta->postMeta['_menu_item_object'][0], 'menu-item-object-id' => $newTarget, 'menu-item-url' => $objMenuItem->meta->postMeta['_menu_item_url'][0], 'menu-item-parent-id' => $parentItem];
         $ret = wp_update_nav_menu_item($menuId, 0, $args);
         $objMenuItem->id = $ret;
         foreach ($objMenuItem->meta->postMeta as $key => $meta) {
             if (in_array($key, $this->skipped_meta_fields) || substr($key, 0, 1) == '_') {
                 continue;
             }
             $val = $meta[0];
             update_post_meta($ret, $key, $val);
         }
     }
 }
开发者ID:eriktorsner,项目名称:bookwordpressdevops,代码行数:32,代码来源:Pushmenus.php

示例7: setup

 private static function setup()
 {
     $menu_id = wp_create_nav_menu(self::$description);
     $locations = get_theme_mod('nav_menu_locations');
     $locations['main-nav'] = $menu_id;
     set_theme_mod('nav_menu_locations', $locations);
 }
开发者ID:guimachiavelli,项目名称:vac,代码行数:7,代码来源:navigation.php

示例8: bb_register_navmenus

/**
 *
 * Function for registering wp_nav_menu() in 3 locations
 */
function bb_register_navmenus()
{
    register_nav_menus(array('Top' => __('Top Navigation'), 'Header' => __('Header Navigation'), 'Footer' => __('Footer Navigation')));
    // Check if Top menu exists and make it if not
    if (!is_nav_menu('Top')) {
        $menu_id = wp_create_nav_menu('Top');
        $menu = array('menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'), 'menu-item-title' => 'Home');
        wp_update_nav_menu_item($menu_id, 1, $menu);
    }
    // Check if Header menu exists and make it if not
    if (!is_nav_menu('Header')) {
        $menu_id = wp_create_nav_menu('Header');
        $menu = array('menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'), 'menu-item-title' => 'Home');
        wp_update_nav_menu_item($menu_id, 1, $menu);
    }
    // Check if Footer menu exists and make it if not
    if (!is_nav_menu('Footer')) {
        $menu_id = wp_create_nav_menu('Footer');
        $menu = array('menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'), 'menu-item-title' => 'Home');
        wp_update_nav_menu_item($menu_id, 1, $menu);
    }
    // Get any menu locations that dont have a menu assigned to it and give it on
    /*
    $loc = array('Top', 'Header', 'Footer');
    if ( has_nav_menu( $location )) {
    	$locations = get_nav_menu_locations();
    	return (!empty( $locations[ $location ] ));
    }
    */
}
开发者ID:jaredwilli,项目名称:3.0basics,代码行数:34,代码来源:functions.php

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

示例10: xt_install_menu

function xt_install_menu($global)
{
    $menu_id = wp_create_nav_menu('新淘客菜单');
    if ($menu_id) {
        //home
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'), 'menu-item-title' => '首页', 'menu-item-status' => 'publish', 'menu-item-position' => 1));
        //shares
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_shares_search_url(), 'menu-item-title' => '逛街啦', 'menu-item-status' => 'publish', 'menu-item-position' => 2));
        //albums
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_albums_search_url(), 'menu-item-title' => '专辑', 'menu-item-status' => 'publish', 'menu-item-position' => 3));
        //taobaos
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_taobao_search_url(), 'menu-item-title' => '淘宝', 'menu-item-status' => 'publish', 'menu-item-position' => 6));
        //paipais
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_paipai_search_url(), 'menu-item-title' => '拍拍', 'menu-item-status' => 'publish', 'menu-item-position' => 7));
        //bijias
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_bijia_search_url(), 'menu-item-title' => '比价', 'menu-item-status' => 'publish', 'menu-item-position' => 8));
        //tuans
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_tuan_search_url(), 'menu-item-title' => '团购', 'menu-item-status' => 'publish', 'menu-item-position' => 9));
        //coupons
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_coupon_search_url(), 'menu-item-title' => '折扣', 'menu-item-status' => 'publish', 'menu-item-position' => 10));
        //temais
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_temai_search_url(), 'menu-item-title' => '特卖', 'menu-item-status' => 'publish', 'menu-item-position' => 11));
        //stars
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_site_url('stars'), 'menu-item-title' => '明星', 'menu-item-status' => 'publish', 'menu-item-position' => 12));
        //brands
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_site_url('brands'), 'menu-item-title' => '品牌', 'menu-item-status' => 'publish', 'menu-item-position' => 13));
        set_theme_mod('nav_menu_locations', array('primary' => $menu_id));
        $global['isMenu'] = 1;
        update_option(XT_OPTION_GLOBAL, $global);
    }
}
开发者ID:aspirin,项目名称:wp-xintaoke,代码行数:31,代码来源:xt-installer-functions.php

示例11: rksnwp_add_sentinote_menu

function rksnwp_add_sentinote_menu()
{
    $menu = apply_filters('sentinote_menu_name_filter', __('Sentinote Menu'));
    $menu_exists = wp_get_nav_menu_object($menu);
    if (!$menu_exists) {
        $menu_id = wp_create_nav_menu($menu);
    }
}
开发者ID:hiroki-uchida,项目名称:mb_sentinote,代码行数:8,代码来源:activate.php

示例12: register_navmenus

function register_navmenus()
{
    register_nav_menus(array('Header' => __('Header Navigation')));
    // Check if Header menu exists and make it if not
    if (!is_nav_menu('Header')) {
        $menu_id = wp_create_nav_menu('Header');
    }
}
开发者ID:rafahigueros,项目名称:maju,代码行数:8,代码来源:functions.php

示例13: make_menu

 function make_menu($menu_name)
 {
     $menu_exists = wp_get_nav_menu_object($menu_name);
     // If it doesn't exist, let's create it.
     if (!$menu_exists) {
         $menu_id = wp_create_nav_menu($menu_slug);
     }
 }
开发者ID:danilowm,项目名称:jigsaw,代码行数:8,代码来源:jigsaw-bootstrap.php

示例14: beans_do_register_default_menu

/**
 * Register default menu.
 *
 * @since 1.0.0
 */
function beans_do_register_default_menu()
{
    // Stop here if a menu already exists.
    if (wp_get_nav_menus()) {
        return;
    }
    // Set up default menu.
    wp_update_nav_menu_item(wp_create_nav_menu(__('Navigation', 'beans')), 0, array('menu-item-title' => __('Home', 'beans'), 'menu-item-classes' => 'home', 'menu-item-url' => home_url('/'), 'menu-item-status' => 'publish'));
}
开发者ID:ThemeButler,项目名称:tm-demo,代码行数:14,代码来源:menu.php

示例15: create_pages

function create_pages()
{
    // Argument dla strony Głównej
    $main_page_args = array('post_status' => 'publish', 'post_type' => 'page', 'post_name' => 'main', 'page_template' => 'page-templates/main.php', 'post_title' => 'Główna', 'post_content' => '');
    if (get_page_by_title('Główna') == null) {
        $main_page = wp_insert_post($main_page_args);
        update_option('page_on_front', $main_page);
        update_option('show_on_front', 'page');
        echo '<div class="updated"> <p>Utworzono stronę "Główna"</p></div>';
    }
    // Argument dla strony Blog
    $blog_page_args = array('post_status' => 'publish', 'post_type' => 'page', 'post_name' => 'blog', 'page_template' => 'page-templates/blog.php', 'post_title' => 'Blog', 'post_content' => '');
    if (get_page_by_title('Blog') == null) {
        wp_insert_post($blog_page_args);
        echo '<div class="updated"> <p>Utworzono stronę "Blog"</p></div>';
    }
    // Argument dla strony Projekty
    $projects_page_args = array('post_status' => 'publish', 'post_type' => 'page', 'post_name' => 'projects', 'page_template' => 'page-templates/projects.php', 'post_title' => 'Projekty', 'post_content' => '');
    if (get_page_by_title('Projekty') == null) {
        wp_insert_post($projects_page_args);
        echo '<div class="updated"> <p>Utworzono stronę "Projekty"</p></div>';
    }
    // Argument dla strony Login
    $login_page_args = array('post_status' => 'publish', 'post_type' => 'page', 'post_name' => 'login', 'page_template' => 'page-templates/login.php', 'post_title' => 'Logowanie', 'post_content' => '');
    if (get_page_by_title('Logowanie') == null) {
        wp_insert_post($login_page_args);
        echo '<div class="updated"> <p>Utworzono stronę "Logowanie"</p></div>';
    }
    // Argument dla strony Członkowie
    $members_page_args = array('post_status' => 'publish', 'post_type' => 'page', 'post_name' => 'members', 'page_template' => 'page-templates/members.php', 'post_title' => 'Członkowie', 'post_content' => '');
    if (get_page_by_title('Członkowie') == null) {
        wp_insert_post($members_page_args);
        echo '<div class="updated"> <p>Utworzono stronę "Członkowie"</p></div>';
    }
    // Argument dla strony O nas
    $about_page_args = array('post_status' => 'publish', 'post_type' => 'page', 'post_name' => 'about', 'post_title' => 'O nas', 'post_content' => 'Jakiś tekst o nas');
    if (get_page_by_title('O nas') == null) {
        wp_insert_post($about_page_args);
        echo '<div class="updated"> <p>Utworzono stronę "O nas"</p></div>';
    }
    // Tworzymy menu i dodajemy do niego pozycje //
    if (!is_nav_menu('topbar_menu')) {
        $menu_id = wp_create_nav_menu('topbar_menu');
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => 'Blog', 'menu-item-object' => 'page', 'menu-item-object-id' => get_page_by_path('blog')->ID, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish'));
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => 'Członkowie', 'menu-item-object' => 'page', 'menu-item-object-id' => get_page_by_path('members')->ID, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish'));
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => 'O nas', 'menu-item-object' => 'page', 'menu-item-object-id' => get_page_by_path('about')->ID, 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish'));
        // Grab the theme locations and assign our newly-created menu
        // to the BuddyPress menu location.
        if (!has_nav_menu('topbar_menu')) {
            $locations = get_theme_mod('nav_menu_locations');
            $locations['main_menu'] = $menu_id;
            set_theme_mod('nav_menu_locations', $locations);
            echo '<div class="updated"> <p>Utworzono menu</p></div>';
        }
    }
}
开发者ID:synergia,项目名称:mknm-synergia-theme,代码行数:56,代码来源:setup.php


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