Skip to content

Instantly share code, notes, and snippets.

@nayemDevs
Last active December 4, 2023 15:46
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nayemDevs/9d3d3f1bc05eb2e5e8543fb4d6c5b6cd to your computer and use it in GitHub Desktop.
Save nayemDevs/9d3d3f1bc05eb2e5e8543fb4d6c5b6cd to your computer and use it in GitHub Desktop.
Adding extra dashboard menu for Vendor Dashboard ( this code need to be inserted on your theme's functions.php)
<?php
//copy from below line
add_filter( 'dokan_query_var_filter', 'dokan_load_document_menu' );
function dokan_load_document_menu( $query_vars ) {
$query_vars['help'] = 'help';
return $query_vars;
}
add_filter( 'dokan_get_dashboard_nav', 'dokan_add_help_menu' );
function dokan_add_help_menu( $urls ) {
$urls['help'] = array(
'title' => __( 'Help', 'dokan'),
'icon' => '<i class="fa fa-user"></i>',
'url' => dokan_get_navigation_url( 'help' ),
'pos' => 51
);
return $urls;
}
add_action( 'dokan_load_custom_template', 'dokan_load_template' );
function dokan_load_template( $query_vars ) {
if ( isset( $query_vars['help'] ) ) {
require_once dirname( __FILE__ ). '/help.php';
}
}
@Kpk1l
Copy link

Kpk1l commented Sep 4, 2019

Hi. And if I want to add a new menu with submenu how do I do it?

@nayemDevs
Copy link
Author

You can only add sub-menu under the settings panel as like Payment, shipping. In that case, you have to use $sub_settings variable and a different hook which you can find in your dokan template-tags.php file.

@Kpk1l
Copy link

Kpk1l commented Sep 5, 2019

Ok. That's not so good...Thanks

@jjcordoba
Copy link

jjcordoba commented Sep 27, 2021

Good afternoon I followed all the steps but when I click on the new item I get a 404 error. How can I solve it?

@nayemDevs
Copy link
Author

nayemDevs commented Sep 27, 2021 via email

@tayyabwork
Copy link

tayyabwork commented Oct 14, 2021

You can only add sub-menu under the settings panel as like Payment, shipping. In that case, you have to use $sub_settings variable and a different hook which you can find in your dokan template-tags.php file.

@nayemDevs I have added a submenu under the settings tab, but if I click on a new tab it shows this error Warning: Undefined array key 2 in \wp-content\plugins\dokan-lite\includes\template-tags.php on line 539

@jjcordoba
Copy link

if i want to add more than one item to the menu how can i do it?

@djethales
Copy link

if i want to add more than one item to the menu how can i do it?

Duplicate the code that creates the menu and custimize it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment