[Support request] Different header layout per language

Home Forums Support [Support request] Different header layout per language

Home Forums Support Different header layout per language

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1762130
    Yael

    Hello

    I’m currently building a Hebrew English website and would like to display the header differently based on language. I built this site years ago using Astra Pro

    https://matsliahsewer.com/

    https://matsliahsewer.com/he/

    And you see how the header layout goes from LTR and then RTL depending on language.

    For the life of me I can’t remember how I achieved that but wondered if there’s a way to do the same thing with GP.

    I know the customizer settings applies globally, not per language and there’s no custom layouts in the site posted above.

    Any ideas?

    #1762463
    Ying
    Staff
    Customer Support

    Hi Yael,

    There’re some conditional menu plugins can help you achieve this.

    For example, If Menu.

    You could do some google research for that πŸ™‚

    #1762915
    Yael

    Nope, that just applies to menu, not header layout. Okay, it’ll just remain a mystery how I accomplished this previously πŸ™‚

    #1763269
    David
    Staff
    Customer Support

    Hi there,

    the Theme has RTL Styles included – so when an RTL language is selected it should do that automatically for you.

    #1763275
    Yael

    Hmm, it doesn’t do that automatically though.

    https://staging.navavet.com/

    Password: meitar

    I’ve currently the primary navigation to float left.

    #1763437
    David
    Staff
    Customer Support

    So – bit of trial and error here as this is not my strong point.

    1. I would expect the layout to be set as per you would want it displayed in the English language so nav set float right.
    2. Then the RTL language should invoke the RTL styles which will then swap that setting around.

    #1763460
    Yael

    yes, that is how I originally had it but nothing happened when I went to Hebrew so I decided to set default to float right.

    But either way, (primary nav float right or left) nothing happens when you change language.

    #1763505
    David
    Staff
    Customer Support

    Hmmm… odd – can you set it to the layout for the english language and then i can take a look at whats going on?

    #1763506
    Yael

    You mean LTR (float right), yes? If so, I’ve just now done that

    #1763996
    David
    Staff
    Customer Support

    I asked Tom to have a look as that isn’t how i expect it to behave and hes more knowledgable than i on this matter. He should be online soon

    #1764017
    Yael

    Okay, thank you.

    #1764120
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Looks like this could be a bug.

    Does this do anything?:

    add_filter( 'option_generate_settings', function( $settings ) {
        if ( is_rtl() ) {
            $settings['nav_position_setting'] = 'nav-float-left';
        }
    
        return $settings;
    } );
    #1764140
    Yael

    Hello Tom,

    No, it doesn’t; attaching the contents of my GP Child theme functions.php file

    <?php
    /**
     * GeneratePress child theme functions and definitions.
     *
     * Add your custom PHP in this file. 
     * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
     */
    
    function generatepress_child_enqueue_scripts() {
    	if ( is_rtl() ) {
    		wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
    
    add_filter( 'option_generate_settings', function( $settings ) {
        if ( is_rtl() ) {
            $settings['nav_position_setting'] = 'nav-float-left';
        }
    
        return $settings;
    } );
    #1764153
    Yael

    Oh, wait; that did fix it Tom. Sorry I forgot to clear the cache!

    Thank you so much.

    #1764162
    Tom
    Lead Developer
    Lead Developer
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.