我需要为每个角色显示不同的WooCommerce仪表板,我已经在子主题中自定义了function.php文件,以显示候选人在登录时将看到的内容,我需要创建一个if(函数)来检查哪个登录用户已注册的角色并显示正确的仪表板,例如候选仪表板或雇主仪表板。
if ( is_user_logged_in(). )
{
function my_account_menu_order() {
$menuOrder = array(
'candidate-dashboard' => __( 'Dashboard', 'woocommerce'),
'job-alerts' => __( 'Matching Job Alerts', 'woocommerce' ),
'my-bookmarks' => __( 'My Bookmarked Salon Jobs', 'woocommerce' ),
'edit-address' => __( 'Billing Addresses', 'woocommerce' ),
'edit-account' => __( 'Personal Account Details', 'woocommerce' ),
'customer-logout' => __( 'Logout', 'woocommerce' )
);
return $menuOrder;
}
add_filter ( 'woocommerce_account_menu_items',
'my_account_menu_order' );
}