Back to Community

How to Fix GTranslate Language Selector Positioning and Alignment Issues

7 threads Sep 16, 2025 PluginTranslate wordpress with gtranslate

Content

Many users of the 'Translate WordPress with GTranslate' plugin encounter challenges when trying to position the language selector flags or dropdown within their site's menu, especially when aiming for a specific alignment like centering or integrating it seamlessly. This is a common theme in support forums, where users seek help for flags appearing in the wrong location, not fitting correctly, or wrapping underneath other menu items.

Why Do These Positioning Issues Happen?

These problems typically occur due to a combination of factors:

  • Theme and Menu Constraints: Your WordPress theme (like OceanWP) and page builder (like Elementor) have specific CSS rules governing the menu's layout and available space. The GTranslate widget must fit within these existing constraints.
  • Lack of Space: As noted in one thread, the selector might simply "not fit, so it wraps" onto a new line underneath your menu items if there isn't sufficient horizontal space.
  • Display Method: The method you choose to display the language selector (e.g., "Show in Menu" option, shortcode, or floating widget) has a significant impact on how it interacts with your theme's styling.
  • Responsive Design: A selector might look fine on a desktop but break or become misaligned on mobile or tablet views, requiring device-specific CSS adjustments.

Common Solutions for Alignment and Positioning

1. Use the [gtranslate] Shortcode for Maximum Control

A frequently recommended solution from the sample threads is to avoid relying solely on the "Show in Menu" option. Instead, use the [gtranslate] shortcode directly within your menu structure.

  • How to do it: In your WordPress dashboard, go to Appearance » Menus. Add a new custom link item to your menu. In the URL field, place the [gtranslate] shortcode. You can leave the link text blank or use a placeholder; it will be replaced by the language selector.
  • Why it works: This method injects the selector directly into the menu's HTML structure, giving you and your theme's CSS much more direct control over its positioning compared to the automated "Show in Menu" feature.

2. Apply Custom CSS for Fine-Tuned Alignment

Custom CSS is the most powerful tool for solving alignment issues. The threads show this is often the key to centering flags or fixing spacing.

  • To Center Flags (e.g., on mobile): As one solution provided, you can use device-specific CSS. For example, if using Elementor, the following code can center the selector on mobile view:
    body[data-elementor-device-mode="mobile"] .gtranslate_wrapper { text-align: center; }
    Add this to the Additional CSS section in your Customizer (Appearance » Customize » Additional CSS).
  • General Styling: You can use CSS rules like text-align, margin, and padding on the .gtranslate_wrapper class to adjust the selector's position and spacing within its container.

3. Consider the Floating Widget Option

If integrating the selector into your main navigation menu proves too difficult due to space or theme limitations, a robust alternative is to use the floating language selector.

  • How to do it: In the GTranslate settings, enable the "Show floating language selector" option. You can then choose its position on the screen (e.g., bottom left, bottom right).
  • Why it works: This completely bypasses theme menu conflicts by placing the selector in a fixed position on the page, ensuring it is always visible to users without affecting your layout.

4. Check for Space and Choose the Right Widget Look

If the selector is wrapping under your menu, it's likely a width issue. A suggested fix is to change the widget's format to something more compact.

  • Try using the "Flags with language name/code" widget look instead of just flags. While this seems counterintuitive, a shorter language code (like "EN") can sometimes take up less space than a flag image, preventing the wrap.
  • Ensure the "Show in menu" option is enabled if you are using that method.

What to Do If the Selector Is Not Showing at All

If the language selector is completely absent from your menu:

  1. First, confirm the plugin is activated and a display option is enabled in its settings.
  2. Verify you are using the correct method. The "Show in menu" option may not be compatible with all themes. The official recommendation in these cases is to use the [gtranslate] shortcode within the menu instead.
  3. For highly customized menus, you can also use the [gt-link lang="en" label="English"] shortcode to create individual menu items for each language link.

Positioning the GTranslate language selector often requires a bit of experimentation with these different methods. Starting with the shortcode inside your menu and then using custom CSS to adjust the alignment is typically the most effective strategy for achieving a perfect, integrated look.