• Hi,

    I want to know how to do 2 things:

    Locating the polylang switcher in the menu bar, align right (the rest of the menu on the left) and configure it as a drop down (this is not available by default on the menu as a widget).

    Locating the polylang switcher in the place where the text “site-description” appears, align right and also set it to drop down.

    Thank you for your time.

Viewing 15 replies - 1 through 15 (of 15 total)
  • This comment on the Polylang-Customizr snippet shows how to replace the tagline.

    Thread Starter jerenino

    (@jerenino)

    Sorry but this solution… not work. I told you.

    Because in principle language switcher is located at the desired location, but amending the title of the site that appears on the left. It adds the following features:

    “>

    And when you mouse over the title reads, besides the title,

    <select name =

    On the other hand, does not work. While on the desired location, but does not change the language to select. It does nothing.

    Ah, I didn’t know that you are “sergio”.

    The extra “>” looks like a copy-paste error. The functions.php in your child theme should look like this, nothing else:

    <?php
    
    // Replace tagline with Polylang language switcher
    add_filter( 'tc_tagline_tag', function(){ return 'p';} );
    add_filter( 'tc_tagline_text ', function(){ return pll_the_languages( array('echo'=>0,'dropdown'=>1) ); } );

    (Details of how to use functions.php in child themes here.)

    If you still have problems, can you link to your site?

    As to the dropdown not working: You need to have fully customized Polylang for this to work, because Polylang needs to know what language the current page is in and which page to go to. See the Polylang documentation, which is very good.

    Thread Starter jerenino

    (@jerenino)

    Hi ElectricFeet

    I apologize. I thought both comments I used the same nick. I am sorry.

    The problem still exists. The code you sent me is the same and is being used in functions.php

    Regarding the documentation of polylang … I have no idea what to do. That is why I ask for help people, like you, is clear about what needs to be done.

    I think all this (the location and setting of the switcher polylang) should be parameterized by the people who develop polylang and not force us to get us to change code. It is an opinion. Because it makes no sense to develop a plugin language in an excellent manner, but does not allow you to place the switcher polylang simply. Many years ago the places (mainly in the head) used are defined. I still do not understand how it is simplest to the most complicated.

    The website is not published, so do not tell you the link.

    I’m a little disappointed with polylang.

    Thanks for your time. If you think of anything else I can do to solve the problem or any other advice … I look forward to your help. Thank you again.

    I think all this (the location and setting of the switcher polylang) should be parameterized by the people who develop polylang and not force us to get us to change code.

    You specifically asked to put the Polylang switcher where the site description is. That requires code.

    If you want the switcher in the menu, you can do that using Polylang functionality without any code at all. Polylang provides this option where other language plugins don’t.

    Regarding the documentation of polylang … I have no idea what to do.

    I would suggest you read it. It’s very well-written. You can get a rough translation from English using Google Translate.

    For example, this is the documentation in Italian:
    https://translate.google.com/translate?sl=en&tl=it&js=y&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fpolylang.wordpress.com%2Fdocumentation%2F&edit-text=

    Thread Starter jerenino

    (@jerenino)

    The first choice was to locate it in the menu (and then align it to the right), but, I do not understand why, the menu does not allow to configure it as dropdown.

    If I could do these two things:

    1. Putting it to the right of the menu.
    2. Configure it as a dropdown.

    For me it would be fine. You know how to do?.

    Thank you.

    Then you need the code I gave you in the Themes&Co article:

    // Replace tagline with Polylang language switcher
    add_filter( 'tc_tagline_tag', function(){ return 'p';} );
    add_filter( 'tc_tagline_text ', function(){ return pll_the_languages( array('echo'=>0,'dropdown'=>1) ); } );

    If it’s not working then it must be pasted it wrongly or in the wrong place. Where did you paste it?

    Thread Starter jerenino

    (@jerenino)

    The code that you passed me, pasted in functions.php, but does not work. Physically appears … but selecting the languages ​​listed … the language change does not happen.

    That’s why in my last comment I said that Polylang allows placing the switcher menu (so far … all good) but …

    1. Polylang In the menu does not allow (not sure why) and configure the switcher dropdown.
    Two. Would love to align the switcher (on the menu) to the right, so would the rest of the menu on the left (for example).

    And have you set up pages for each language and linked them, following the instructions in the documentation.

    I feel we’re going round in circles here. The code I give above shows you how to put the polylang language switcher where you want it in the tagline.

    But no languages will be selected unless you have fully configured Polylang. You need to assign a language to every page and tell Polylang which page in (say) English corresponds to which page in (say) Italian. Without that, Polylang cannot know which page to switch to when you select a language.

    I explain all these steps in the snippet (which is where we started). You need to follow these steps one by one. They are all essential to allow Polylang to know what to do.

    Thread Starter jerenino

    (@jerenino)

    Yes, obviously have their corresponding pages in each language pair. That’s the first thing you should do. That works correctly. Polylang works very well in that regard.

    The problem comes when we place the switcher. Nothing more. Nothing less.

    1. You know how to set (in the menu) polylang switcher like the dropdown?

    2. Know, at the same time, the way to align polylang switcher (switcher only) right?.

    Finally:

    3. You know the way to show the site-description below the logo?. Customizr explains how to put the title under the logo, but it interests me show site-description below the logo and can not find how.

    Thank you very much for your time and patience.

    OK, I wrote you a snippet for 1 and 2: http://www.themesandco.com/snippet/add-polylang-dropdown-navbar-widget/

    Putting the site description below the logo is similar to putting the title there (as Nicolas does in his snippet). However, first you have to remove the tagline from where it was (so it doesn’t appear twice (N.B. you have to remove it from both the non-responsive header and the responsive header). You also don’t necessarily need to check for the logo as Nicolas does—I’m assuming here that if someone doesn’t have a logo, they’d want to use this code to put the tagline under the title instead.

    This can be done by placing the following code in the functions.php file of your child theme:

    // Remove tagline from responsive and non-responsive header. Hook on the wp_head hook, so it's executed before any html is rendered
    add_action('wp_head', 'reorder_header');
    function reorder_header(){
    
    	remove_action ( '__header' ,  array( TC_header_main::$instance , 'tc_tagline_display' ) , 20 );
    	remove_action ( '__navbar' ,  array( TC_header_main::$instance , 'tc_tagline_display' ) , 20 );
    
    }
    
    // Add tagline after logo block
    add_action( '__after_logo', 'add_site_description_after_logo_block');
    function add_site_description_after_logo_block() {
    
    	printf('<h2 class="site-description">%1$s</h2>',
    		__( esc_attr( get_bloginfo( 'description') ) )
    	);
    }

    Thread Starter jerenino

    (@jerenino)

    Point 3 is resolved perfectly.

    Points 1 and 2 no. Some time ago I had tried to add a widget area, place before where the menu bar is. But the aesthetic setting is very complicated and even more complicated to resize (phones, tablets, browsers, etc.). Device.

    That is why I thought that the solution might be to place the switcher in the menu bar. Inside. Right-aligned.

    But of course, there is the problem of not being able to configure the switcher polylang as dropdown.

    That is why I asked you if you knew how to set the switcher as dropdown in the menu bar (INSIDE), and align it to the right, unlike the rest of the menu.

    I keep wondering why the developers have removed that possibility polylang configuration in (dropdown) menu. By contrast, the current configuration allows to put all languages ​​in the bar menu (?!). Imagine when you have 20 languages ​​… A disaster. It is not logical. Nor aesthetic. The best solution is always the dropdown.

    Do you have any idea.

    Thread Starter jerenino

    (@jerenino)

    Obviously (I forgot to say in the previous post)… thank you very much for your time and your advice.

    I wrote a brand new snippet for 1 & 2. If you cannot make it work, then I suggest you hire someone to help you.

    Thread Starter jerenino

    (@jerenino)

    I appreciate the work you’ve done. Yes, it works. What I said in the previous comment is not not work. I mean wanting to put the switcher into the bar (inside) menu. Not before. Not after. Inside. Right-aligned.
    You know how?

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Polylang switcher in menu or in site-description place’ is closed to new replies.