Forum Replies Created

Viewing 15 replies - 1 through 15 (of 64 total)
  • Thread Starter michel.b

    (@michelb-1)

    Thank you for your message, I appreciate.

    I managed to fetch these emails to my Gmail inbox.

    Thread Starter michel.b

    (@michelb-1)

    Thank you for your fast answer, I would like to limit the height of the images to the size of the screen/window. Please excuse me if I cannot give you a URL since the site is private, and I am responsible for the privacy of the pictures of the members.

    Thread Starter michel.b

    (@michelb-1)

    Sorry, that was my mistake, it has nothing to do with your plugin. I am using cloudinary and I did not set it right. We can consider this question resolved.

    Thread Starter michel.b

    (@michelb-1)

    Thank you for your fast answer. I tried it, but it was not the problem. I kept playing with the different parameters and by accident I found what it was : the default value of 100 for the scroll distance was too big in my case. I used 20, 40, 60 and it worked.

    I have another issue. Sometimes the images do not have enough time to fully load, and they appear blurred. I used image_loaded=”true” and Load CSS inline. It improved the situation, fewer images appear blurred, but some remain not fully loaded. Is there anything else I could do ?

    Thread Starter michel.b

    (@michelb-1)

    I found the answer by myself.

    Hello,

    I had the same issue with my multisite and Twenty Twenty-two.
    Now I believe I have found the origin of the problem and a solution.
    The problem : WordPress does not allow a user with the role of super-administrator to create or modify the navigation of the sites. Why not ?
    The solution that works for me : I have created a different user with the role of administrator, and this user can create and modify the navigation.

    Thread Starter michel.b

    (@michelb-1)

    no, I haven’t seen this message. You can check if it is related to my short-code by removing it. Then you can also remove the id of each menu. If the message is still there, it will be another issue.

    Thread Starter michel.b

    (@michelb-1)

    Sorry, I did not make myself clear because I do not know the theme of your site. So I am going to describe my situation, and you will understand what’s similar or different for you.
    The theme of my site is a child theme of Twenty Twenty-Two that I have modified. I am using the same template for all my pages and a different one for all my posts. These 2 templates consist of 3 parts : a header, a main part and a footer. I use the header and the footer to display what I want to appear on each page, respectively each post, without having to retype it each time.
    My page template and my post template use the same header, where I have placed the navigation and the pll short-code. Having only one header guaranties that if the short-code works for the pages, it will work for the posts.

    When you said the short-code woks for the pages and not for the posts I imagine you had one header for the pages and another one for the posts, each with its own navigation and short-code.
    I inspected the “questionnaire-presentation” and did not see the pll switcher : the short code was absent or having some kind of problem. I went to inspect the “language-test” page that you had posted previously and for which the short-code worked. It was now different : the navigation appears twice, in the header and in the main part, the pll switcher was no longer in the header but in the main part. The short-code works everywhere, but if you place it in the main part, you will have to retype it on every page and on every post, if you want the switcher to appear and hide the menus in languages other than the language of the current page or post. The short-code does both things together. If, for example, you want the switcher on pages and not on posts, then you can use 2 different headers, one for pages with the shot-code and all the menus and a different one for posts with only one menu in the language you want.
    Let me know if this makes sense for you or if you have more questions.

    • This reply was modified 2 years, 4 months ago by michel.b.
    • This reply was modified 2 years, 4 months ago by michel.b.
    Thread Starter michel.b

    (@michelb-1)

    The test page has changed : the switcher is no longer in the header but below and the menu appears twice. This why the post page does not show the switcher and displays all the menus.

    Thread Starter michel.b

    (@michelb-1)

    Do you have different headers for posts and pages? Look at the differences between the two to find out what’s wrong in the header for posts.

    Thread Starter michel.b

    (@michelb-1)

    Hi Oolong,

    1) all what my shortcode does is make the switcher appear. I have not touched the way pll finds the translations. If you are directed to the front page is it possible that pll does not function very well. Try to reinstall pll. If it does not solve the problem, try to create a new post and its translation and see if it works for this new post. Let me know the result.
    2) for the problem of the missing switcher, it looks like a mistake that exist on this page and not on the others. I will need a little more time to inspect your pages. I will get back to you asap.

    Regards

    Thread Starter michel.b

    (@michelb-1)

    Hi raquelbr,

    I have corrected a bug, please find below the corrected code :

    function languages_func(){$translations = pll_the_languages( array( 'raw' => 1 ) );						 
    	$translations = pll_the_languages( array( 'raw' => 1 ) );
    	$x = 0;
    	$cba =	'<select name="lang_choice_1" id="lang_choice_1" class="pll-switcher-select" style="font-size: 13.3333px !important;">';			  
    	while($x < count($translations)) {
    		$langurl = array_column($translations, 'url');
    		$langname = array_column($translations, 'name');
    		$languageslug = array_column($translations, 'slug');
    		$selection = array_column($translations, 'current_lang');		
    			if ($selection[$x]) {$y = $x;}
    			else {
    				  $cba = $cba . '<option value=' . $langurl[$x] . ' style="font-size: 13.3333px !important;">' . $langname[$x] . '</option>';
    				  $cba = $cba . '<script type="text/javascript">				  
    				  document.getElementById("menu" + "' . $languageslug[$x] . '").style.display = "none";			  
    				   </script>';
    				 }
      	$x++;		
    	}
    	$cba = $cba . '<option value=' . $langurl[$y] . ' selected="selected"' . ' style="font-size: 13.3333px !important;">' . $langname[$y] . '</option>';					  
    		$cba = $cba . '</select> <script type="text/javascript">
    					//<![CDATA[
    					document.getElementById( "lang_choice_1" ).addEventListener( "change", function ( event ) { location.href = event.currentTarget.value; } )
    					//]]>
    				</script>';				  
    
    	return ($cba);
    }
    add_shortcode( 'languages', 'languages_func' );

    Also, I should have told you about the menus. Probably you want to have a different menu for each language. For my short code to handle this, you need to have as many navigation blocks as you have languages. All together at the same place, probably the header. Each of these navigation blocks should be inside a different group block with an Anchor of the form menuxx where xx is the code of the specific language, for example en for English. The short code will hide all of them except the one corresponding to the language of the current page.

    Finally, I recommend : you back up your site, you use a child theme, you use a security plugin.
    Regards

    • This reply was modified 2 years, 6 months ago by michel.b.
    Thread Starter michel.b

    (@michelb-1)

    Hi raquelbr,

    if you need, I am available to guide you step by step, just let me know.
    Michel

    Thread Starter michel.b

    (@michelb-1)

    Hi Raquelbr,

    I have a solution. But, again, I am not an experimented programmer and if you decide to use it you have to be aware that I might have done something wrong. I have tested it on my site, using 2 languages, and everything works fine for me. At this time, the switcher is limited to the dropdown solution with language names.

    1) At the place where you want the switcher to appear, probably within the header and next to the navigation (the menu), include a Short-Code Block. The name of the short code is [langages].
    2) Open the functions.php file of the theme (preferably a child theme) and paste at the end the following code :

    function languages_func(){$translations = pll_the_languages( array( 'raw' => 1 ) );						 
    	$translations = pll_the_languages( array( 'raw' => 1 ) );
    	$x = 0;
    	$cba =	'<select name="lang_choice_1" id="lang_choice_1" class="pll-switcher-select" style="font-size: 13.3333px !important;">';			  
    	while($x < count($translations)) {
    		$langurl = array_column($translations, 'url');
    		$langname = array_column($translations, 'name');
    		$selection = array_column($translations, 'current_lang');		
    			if ($selection[$x]) {$y = $x;}
    			else {
    				  $cba = $cba . '<option value=' . $langurl[$x] . ' style="font-size: 13.3333px !important;">' . $langname[$x] . '</option>';
    				 }
      	$x++;		
    	}
    	$cba = $cba . '<option value=' . $langurl[$y] . ' selected="selected"' . ' style="font-size: 13.3333px !important;">' . $langname[$y] . '</option>';					  
    	$cba = $cba . '</select> <script type="text/javascript">
    					//<![CDATA[
    					document.getElementById( "lang_choice_1" ).addEventListener( "change", function ( event ) { location.href = event.currentTarget.value; } )
    					//]]>
    				</script>';					  
    
    	return ($cba);
    }
    add_shortcode( 'languages', 'languages_func' );

    I will work now on my switcher to include the other possibilities of Polylang.
    I am available to answer your questions if any. Give me a feedback, I would appreciate.
    Regards

    Thread Starter michel.b

    (@michelb-1)

    Hi Raquelbr,

    I think, I will have a solution. I need some more time to work it out. But I am not an experimented programmer and if I publish something it will be with a notice of caution.

    I will not be able to integrate it into the navigation, at this time. I intend to place (at the header level) within a Line Block both the Navigation Block and a Short Code Block. This short code will display the switcher next to the navigation. It is easy to add a short code to the functions.php file of the theme, preferably of a child theme.
    The function of my short code, when it will work, will more or less reproduce the php, javascript and css codes of Polylang and produce a list or/and a drop-down. Polylang indicates a way for developers to create their own switcher and I think I can do it, if I work hard and put enough hours into it.
    I will keep you posted if it works.
    Regards

Viewing 15 replies - 1 through 15 (of 64 total)