This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Description
Version Information
- WordPress: 4.7x
- MultilingualPress: 2.4.8
Steps to Reproduce
- Create a new Multsite with at least 2 connected Blogs.
- Create a new Nav-Menu in Blog 1 and add all available languages as items
- Navigate to frontend of Blog 1
What I Expected
The Nav-Menu-Item of "Blog 1" should have at least 1 "current"-class e.G. current-[language|blog|menu|...]-item
What Happened Instead
No "current"-class is added.
Screenshot

Howto fix
In Mlp_Nav_Menu_Frontend:prepare_item() the method should contain a check for get_current_blog() compared with the $site_id. If TRUE, we should add at least 1 "current" class to the given $item.
if ( get_current_blog() === $site_id ) {
$item->classes[] = "mlp-current-language-nav-item";
}
Link in 2.4 Branch: https://github.com/inpsyde/multilingual-press/blob/2.4/src/inc/nav-menu/Mlp_Nav_Menu_Frontend.php#L108
Quick mu-plugin to solve this problem directly:
Here's a mu-plugin which will fix this issue by adding a class mlp-current-language-nav-item to the current nav-item:
<?php
/**
* Plugin Name: MLP current nav-item class.
* Author: Christian Brückner
* Author URI: https://www.chrico.info
*/
add_action(
'muplugins_loaded',
function () {
add_action(
'mlp_prepare_nav_menu_item_output',
function ( WP_Post $item, Mlp_Translation_Interface $translation ) {
if ( get_current_blog_id() === $translation->get_target_site_id() ) {
$item->classes[] = 'mlp-current-language-nav-item';
}
},
10,
2
);
}
);