Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1487964

    Hello,

    We’re creating a website where the client has asked us for a language switcher in the footer. We don’t know what to add to the button to change the current page to the same page in another language. It works on the home page because we’ve included the link to the page in English, but the idea is to duplicate the footer in the rest of the pages and not have to change the link.

    Could you help us?

    Thanks advance,

    BR,

    Antonio.

    #1488024

    Hey Antonio,

    Maybe this will help you out? https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/

    Best regards,
    Rikard

    #1488064

    Hi Rikard,

    I use Polylang, I finally found a solution with this code in case it helps someone else:

    /**
    * Shortcode para mostrar un menú de WordPress
    */
    function rv_print_menu_shortcode( $atts ) {

    /**
    * Normalize
    *
    * Como medida de seguridad limpiamos los atributos
    * introducidos al escribir el Shortcode.
    */
    $atts = array_change_key_case( (array) $atts, CASE_LOWER );
    $atts = array_map( ‘sanitize_text_field’, $atts );

    /**
    * Atributtes
    *
    * A continuación guardamos los atributos en 2 variables
    */
    $menu_name = $atts[‘name’];
    $menu_class = $atts[‘class’];

    /**
    * Creamos la variable $menu_output que va a retornar todo
    * lo que conforma nuestro menú y llamamos a la función
    * de WordPress wp_nav_menu() y le pasamos como
    * parámetros nuestros atributos.
    */
    $menu_output = ‘<div class=”shortcode-menu”>’;

    $menu_output .= wp_nav_menu( array(
    ‘menu’ => esc_attr( $menu_name ),
    ‘menu_class’ => ‘menu ‘ . esc_attr( $menu_class ),
    ‘echo’ => false
    ) );

    $menu_output .= ‘</div>’;

    return $menu_output;

    }

    add_shortcode( ‘print-menu’, ‘rv_print_menu_shortcode’ );

    Then you add this with the name of your menu anywhere and it appears

    [print-menu name=”prueba”]

    I’ve created the different headers for desktop, tablet, and mobile, and now I’ll include them on the pages with a custom layout.

    That’s it, but I have a problem that might be simple, but I’m going crazy and can’t find the solution. The mobile text is centered, but I can’t get the world image and menu to be centered on the same line like desktop and tablet .

    Could you help me?

    Thank you very much in advance.

    BR,

    Antonio.

    #1488078

    Hi,
    I’m trying to understand, you say that you are using “Polylang” but on the link below, both show:
    Screen Shot 2025 08 14 at 4.22.45 PM
    The problem is that both show an error:
    Screen Shot 2025 08 14 at 4.27.04 PM
    So if the header language switcher is not working, the footer also will not.
    Please try to get a working language switcher in at least the header, please note that we are not “Polylang” experts and may not be sure of the settings that you need to change. We know that in the past “Polylang” worked well, but are unsure of the settings.

    Best regards,
    Mike

    #1488083

    Hi Mike,

    Sorry if I didn’t explain myself well, my English isn’t very good. The button in the footer already works, as I explained in the previous email. Sorry, the Spanish page wasn’t created because it gave an error. Now you can test it. The only thing I’m missing is creating the footers for desktop, tablet, and mobile. But the button on mobile is separate from the world image, and I’d like it to be on the same line and centered like the rest of the text. If you narrow the screen you will be able to see it. I’m sending you an image of how it is and how I would like it.

    Many thanks,

    BR,

    Antonio.

    #1488098

    Hi,
    For your footer below 767px where you use a different layout, in your text element you have the globe in a paragraph tag “p” that has the style set to “center”, but the “shortcode-menu”, your language switcher, is in a div below it.
    The two need to be wrapped in a div or the same “p” tag and remove the “center” style on the globe.
    We can not fix this with css, if you can not fix this in the element, please include a admin login so we can help.

    Best regards,
    Mike

    #1488099

    Hi,
    PS: your SSL is now not valid:
    Screen Shot 2025 08 15 at 7.18.51 AM
    Please try to fix.

    Best regards,
    Mike

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.