Introduction
When using WPML, the language switcher appears by default at the upper middle of the login or registration page. If a custom background is enabled on the login page, the switcher may be hidden behind it. You can fix this by adding a small custom code snippet to your theme. This guide explains how you can fix an unaligned language switcher on the login page.
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- In your WordPress admin dashboard, go to Appearance > Theme Editor.
- Under Select theme to edit, choose your active theme (preferably BuddyBoss Child Theme), then click Select.
- From the Theme Files list, click Theme Functions (functions.php).
- Paste the following code just before the closing PHP tag (?>):
function custom_login_logo() {
echo '<style type="text/css">
.wpml-login-ls { text-align: right !important; margin-right: 34px !important; }
.login form { margin-top: 0px !important; }
</style>';
}
add_action('login_head', 'custom_login_logo');add_action(‘login_head’, ‘custom_login_logo’);
- Click Update File to save your changes.
Troubleshooting and FAQs
Q: The language switcher is still behind the background, what should I check?
A: Make sure the code is added to the active theme’s functions.php and clear any caches.
Q: Can I adjust the position further?
A: Yes, modify the margin-right or text-align values in the CSS within the code snippet.
Q: Will this affect other pages?
A: No, this change only applies to the login and registration pages.
Q: Can I revert this change easily?
A: Yes, remove the code from functions.php and save.
Q: Who can I contact for further assistance?
A: Check the BuddyBoss Support Policy or consult a developer.