Reorder the Main Vendor Dashboard Menu

This snippet allows you to customize the Vendor Dashboard’s menu order. On my site, it seemed to make more sense to have them in a little different order. The instructions are embedded in the code.

As always, this is either added to your Child Theme’s functions.php file, or consider using the My Custom Functions Pro plugin to manage and organize all your snippets.

add_filter('wcmp_vendor_dashboard_nav', 'reorder_wcmp_dash_nav');
function reorder_wcmp_dash_nav( $nav ) {
  /*
   * $nav is an array set of dashboard menu.
   * Default Dashboard nav position is 0, others are positioned at a difference of 10 priority.
   * Available menus and their positions:
   * dashboard - 0
   * store-settings - 10
   * vendor-products - 20
   * vendor-promte - 30
   * vendor-report - 40
   * vendor-orders - 50
   * vendor-payments - 60
   * vendor-knowledgebase - 70
   * vendor-tools - 80
  */
  
if(isset($nav['vendor-orders'])){
    $nav['vendor-orders']['position'] = 3; // or set it according to your need. -1 will set it at the top, while any number between 11-19 will set it below Store Settings and 1-9 below Dashboard but above Store Settings.
  }
if(isset($nav['vendor-knowledgebase'])){
    $nav['vendor-knowledgebase']['position'] = 5; // or set it according to your need. -1 will set it at the top, while any number between 11-19 will set it below Store Settings and 1-9 below Dashboard but above Store Settings.
  }  
if(isset($nav['store-settings'])){
    $nav['store-settings']['position'] = 65; // or set it according to your need. -1 will set it at the top, while any number between 11-19 will set it below Store Settings and 1-9 below Dashboard but above Store Settings.
  }  
  return $nav;
}

Comments on this post

Your email address will not be published. Required fields are marked *