【问题标题】:"Menus" settings disappeared from WordPress admin panel“菜单”设置从 WordPress 管理面板中消失
【发布时间】:2015-04-18 22:09:40
【问题描述】:

我需要更改 WordPress 网站上的一些菜单项,但该选项已从管理区域消失。根据documentationMenus 选项应该出现在 Appearance 菜单下,但在我的安装中没有:

我怎样才能让菜单出现在它应该出现的位置?

【问题讨论】:

    标签: wordpress


    【解决方案1】:

    问题可能是由恶意插件覆盖了功能引起的,但我设法通过使用以下代码将functions.php 文件添加到我的自定义主题(在根目录中)来修复它:

    <?php
        add_theme_support( 'menus' );
    ?>
    

    现在菜单又出现了:

    来源:Function Reference/add theme support

    【讨论】:

      【解决方案2】:

      此代码用于在 wp admin 中制作菜单。

      ![add_action('init', 'create_portfolio_post_type');
      
      function create_portfolio_post_type() {
          $args = array(
              'description' => 'Portfolio Post Type',
              'show_ui' => true,
              'menu_position' => 4,
              'exclude_from_search' => true,
              'labels' => array(
                  'name' => 'Portfolios',
                  'singular_name' => 'Portfolios',
                  'add_new' => 'Add New Portfolio',
                  'add_new_item' => 'Add New Portfolio',
                  'edit' => 'Edit Portfolios',
                  'edit_item' => 'Edit Portfolio',
                  'new-item' => 'New Portfolio',
                  'view' => 'View Portfolios',
                  'view_item' => 'View Portfolio',
                  'search_items' => 'Search Portfolios',
                  'not_found' => 'No Portfolios Found',
                  'not_found_in_trash' => 'No Portfolios Found in Trash',
                  'parent' => 'Parent Portfolio'
              ),
              'public' => true,
              'capability_type' => 'post',
              'hierarchical' => false,
              'rewrite' => true,
              'supports' => array('title', 'editor', 'thumbnail', 'comments', 'tags')
          );
          register_post_type('portfolio', $args);
      }
      

      Menu look like this

      【讨论】:

        【解决方案3】:

        您还可以在您的functions.php 中使用此代码来对您的菜单选项卡设置进行更多操作:

        //menu//
        function register_my_menus() {
            register_nav_menus(
            array( 'top-menu' => __( 'Top-Menu' ) )
            );
        }
        

        您还可以根据需要添加许多菜单字段并在主题中替换它。 确保您的文件名为 functions.php

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-12-09
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多