Skip to content

Instantly share code, notes, and snippets.

@sabbir1991
Last active December 11, 2022 08:33
Show Gist options
  • Save sabbir1991/f2db4bd4d3ac1034faac to your computer and use it in GitHub Desktop.
Save sabbir1991/f2db4bd4d3ac1034faac to your computer and use it in GitHub Desktop.
Adding a Main Dashboard Menu in Dokan Dashboard
<?php
add_filter( 'dokan_query_var_filter', 'dokan_load_sabbir_menu' );
function dokan_load_sabbir_menu( $query_vars ) {
$query_vars['sabbir'] = 'sabbir';
return $query_vars;
}
add_filter( 'dokan_get_dashboard_nav', 'dokan_add_sabbir_menu' );
function dokan_add_sabbir_menu( $urls ) {
$urls['sabbir'] = array(
'title' => __( 'Sabbir', 'dokan'),
'icon' => '<i class="fa fa-user"></i>',
'url' => dokan_get_navigation_url( 'sabbir' ),
'pos' => 51
);
return $urls;
}
add_action( 'dokan_load_custom_template', 'dokan_load_template' );
function dokan_load_template( $query_vars ) {
if ( isset( $query_vars['sabbir'] ) ) {
require_once dirname( __FILE__ ). '/sabbir.php';
exit();
}
}
@mithublue
Copy link

It was helpful

@MuhammadRehman277
Copy link

Thanks for the code, but when I added a menu and click on that button it redirects to 404 page.

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