Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #981929

    majid
    Participant

    Hello , it is possible to put polylang on top menu , i put it on topbar but need to put it switcher on top menu

    #981933

    majid
    Participant
    This reply has been marked as private.
    #982022

    Paul R
    Moderator

    Hi,

    Thanks for writing in! Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.

    #982055

    majid
    Participant

    Hi ,
    Thank you for fast reply
    acctully i want move polylang switcher from topbar to navbar , i put polylang switcher on heard from this topic
    https://community.theme.co/forums/topic/polylang-language-switcher-in-the-top-bar/

    note: i have slider above of my top menu

    #982251

    Paul R
    Moderator

    Hi,

    To add it to your navbar, you can add this in your child theme’s functions.php file.

    
    function add_language_switcher( $items, $args ) {
    echo pll_the_languages();
        if(function_exists( 'pll_the_languages' )) {
        if( $args->theme_location == 'primary' ){
            $items .= '<li class="menu-item language-switcher">'.pll_the_languages().'</li>';
        
        }
        }
        return $items;
    }
     
     
    add_filter('wp_nav_menu_items','add_language_switcher', 99999, 2);
    

    Hope that helps.

    #982376

    majid
    Participant

    thanks, i add the code but dont know why it become like picture

    #982557

    Darshana
    Moderator

    Hi there,

    Please remove the following line, which is the second line of the above code. That should stop duplicating your languages.
    echo pll_the_languages();

    Hope that helps.

    #984142

    majid
    Participant

    Thank you

    #984167

    Darshana
    Moderator

    Glad we were able to help 🙂

    #987596

    majid
    Participant

    Hi again , please have look on picture ,
    i wrote text on picture

    #987800

    Paul R
    Moderator

    Hi,

    In that case, please remove the code added in your child theme functions.php file.

    Then create file _brand.php in wp-content/themes/x-child/framework/views/global and copy the code below into that file.

    
    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_BRAND.PHP
    // -----------------------------------------------------------------------------
    // Outputs the brand.
    // =============================================================================
    
    $site_name        = get_bloginfo( 'name' );
    $site_description = get_bloginfo( 'description' );
    $logo             = x_make_protocol_relative( x_get_option( 'x_logo' ) );
    $site_logo        = '<img src="' . $logo . '" alt="' . $site_description . '">';
    
    ?>
     <?php if(function_exists( 'pll_the_languages' )) { ?>
    <span class="language-switcher"><?php echo pll_the_languages(); ?></span>
    <?php } ?>
    <?php echo ( is_front_page() ) ? '<h1 class="visually-hidden">' . $site_name . '</h1>' : ''; ?>
    
    <a href="<?php echo home_url( '/' ); ?>" class="<?php x_brand_class(); ?>" title="<?php echo $site_description; ?>">
      <?php echo ( $logo == '' ) ? $site_name : $site_logo; ?>
    </a>
    

    Hope that helps.

    #987837

    majid
    Participant

    Thanks for fast reply , something going wrong 🙂

    #988174

    Darshana
    Moderator

    Hi there,

    You can add custom CSS rules to style those area. For example, you can add this under Custom > CSS in the Customizer.

    
    .language-switcher .lang-item {
        float: left;
        list-style: outside none none;
        margin-right: 5px;
    }
    

    Hope that helps.

    #988316

    majid
    Participant

    Hi , Language is duplicate and already hoover , Please have look on Duplicate_Language on attachment

    #988862

    Rad
    Moderator

    Hi there,

    The structure are doubled and no proper wrapper of <ul></ul>.

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks!