Last active
December 29, 2019 22:07
-
-
Save rashedripon/75d0c33247d8602ddbd878b584ca77cd to your computer and use it in GitHub Desktop.
Dokan Vendor Dashboard Navigation Customization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The filter you want to use is dokan_get_dashboard_nav() / dokan_get_dashboard_settings_nav() | |
* Place these codes under your themes functions.php | |
*/ | |
/** | |
* Remove a menu link from vendor dashboard | |
* @param array $urls | |
* @return array | |
*/ | |
add_filter( 'dokan_get_dashboard_nav', function($urls) { | |
unset ($urls['dashboard']); | |
return $urls; | |
} ); | |
/** | |
* Remove Followers vendor dashboard menu | |
* @param array $settings | |
* @return array | |
*/ | |
add_filter( 'dokan_get_dashboard_nav', function($settings) { | |
unset ($settings['followers']); | |
return $settings; | |
} ); | |
/** | |
* Remove menu which are inside Settings Store/Verification/Shipping vendor dashboard menu | |
* @param array $settings | |
* @return array | |
*/ | |
add_filter( 'dokan_get_dashboard_settings_nav', function ( $sub_settins ) { | |
unset ( $sub_settins['store']); | |
unset ( $sub_settins['verification']); | |
return $sub_settins; | |
} , 12); | |
/** | |
* Insert Visit Store button to the dashboard navigation bar | |
* @param array $urls | |
* @return array | |
*/ | |
$store_url = esc_url( dokan_get_store_url( dokan_get_current_user_id() ) ); | |
add_filter( 'dokan_get_dashboard_nav', 'add_visit_store_link' ); | |
function add_visit_store_link( $urls ) { | |
$urls['store'] = array( | |
'title' => __( 'Visit Store', 'dokan'), | |
'icon' => '<i class="fa fa-users"></i>', | |
'url' => esc_url( dokan_get_store_url( dokan_get_current_user_id() ) ), | |
'pos' => 50 | |
); | |
return $urls; | |
} | |
/** | |
* Insert new URL's to the dashboard navigation bar | |
* @param array $urls | |
* @return array | |
*/ | |
add_filter( 'dokan_get_dashboard_nav', 'prefix_dokan_add_seller_nav' ); | |
function prefix_dokan_add_seller_nav( $urls ) { | |
$urls['help'] = array( | |
'title' => __( 'Help Files', 'dokan'), | |
'icon' => '<i class="fa fa-users"></i>', | |
'url' => 'http://www.help.com', | |
'pos' => 50 | |
); | |
return $urls; | |
} | |
/** | |
* Modify the Position / Title / Icon / URL of the vendor dashboard menus | |
* @param array $urls | |
* @return array | |
*/ | |
add_filter( 'dokan_get_dashboard_nav', 'custom_position', 12); | |
function custom_position( $urls ){ | |
$urls['booking'] = array( | |
'title' => __( 'Booking', 'dokan' ), | |
'icon' => '<i class="fa fa-calendar"></i>', | |
'url' => dokan_get_navigation_url( 'booking' ), | |
'pos' => 10, // you want to put the position here | |
); | |
return $urls; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment