欢迎光临
我们一直在努力

wordpress后台默认菜单选项顺排序调整

我们在开发wordpress主题时常常用需要调整一个wordpress程序默认的后台菜单选项,那我们今天讲的是如何调整排序,比如说我需要把wordpress后台默认的页面功能调下文章的下方来提示我们wordpress主题用户页面用常用选项,如何完成这样的操作呢,可以通过custom_menu_order和menu_order来实现,下面分享一下方法。

将以下代码添加到当前主题的 functions.php 文件:

// Rearrange the admin menu
  function custom_menu_order($menu_ord) {
    if (!$menu_ord) return true;
    return array(
      'index.php', // Dashboard
      'edit.php?post_type=custom_type_one', // Custom type one
      'edit.php?post_type=custom_type_two', // Custom type two
      'edit.php?post_type=custom_type_three', // Custom type three
      'edit.php?post_type=custom_type_four', // Custom type four
      'edit.php?post_type=custom_type_five', // Custom type five
      'separator1', // First separator
      'edit.php?post_type=page', // Pages
      'edit.php', // Posts
      'upload.php', // Media
      'link-manager.php', // Links
      'edit-comments.php', // Comments
      'separator2', // Second separator
      'themes.php', // Appearance
      'plugins.php', // Plugins
      'users.php', // Users
      'tools.php', // Tools
      'options-general.php', // Settings
      'separator-last', // Last separator
    );
  }

  add_filter('custom_menu_order', 'custom_menu_order'); // Activate custom_menu_order
  add_filter('menu_order', 'custom_menu_order');

以上是默认的wordpress后台菜单选项排序,我们可以通过位置的调整来改变顺序。

赞(0) 打赏
未经允许不得转载:WORDPRESS大侠 » wordpress后台默认菜单选项顺排序调整

评论 抢沙发

评论前必须登录!

 

更好的WordPress主题

支持快讯、专题、百度收录推送、人机验证、多级分类筛选器,适用于垂直站点、科技博客、个人站,扁平化设计、简洁白色、超多功能配置、会员中心、直达链接、文章图片弹窗、自动缩略图等...

联系我们联系我们

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

登录

找回密码

注册