Home › Forums › WC Vendors Pro Support › Pro Dashboard in different languages › Reply To: Pro Dashboard in different languages
March 1, 2017 at 4:17 pm
#57959
Participant
Hi,
I temporarily solved it like this, from my plugin code, or functions.php:
function catch_dashboard(){
/* WC Vendors Pro */
if(!function_exists('WCVendors_Pro')) return false;
// Get the dashboard page id, from WC Vendors PRO option
$dashboard_page_id = WCVendors_Pro::get_option( 'dashboard_page_id' );
// Get the original or translated ID form WPML, as appropriate, and chek if both are equal
$is_dashboard = (get_the_ID() == icl_object_id($dashboard_page_id));
return $is_dashboard;
}
// Filter form WC Vendors plugin
add_filter( 'wcv_view_dashboard', 'catch_dashboard' );
Additionally, I filtered the WP body_class too, to get the same style from my theme:
add_filter( 'body_class', function($classes){
if(catch_dashboard()){
$classes[] = 'wcvendors wcvendors-pro wcv-pro-dashboard';
$classes[] = 'vendor-pro-dashboard';
$classes[] = 'woocommerce';
if(current_user_can('administrator')) {
$classes[] = 'administrator';
}
}
return $classes;
});
I hope it will be usefull. Thanks all for the thread.