Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #483475

    Hi there,
    I have a Multisite Installation for a German Site and an English site. Other languages will be done later on.
    I changed the avf_portfolio_sort_first_label:

    add_filter('avf_portfolio_sort_first_label','avia_change_portfolio_label', 10, 2);
    	function avia_change_portfolio_label($all, $params)
    	{
    		$all =  "Aktuelle Kollektion";
    		return $all;
    	}

    and it works fine – the avf_portfolio_sort_first_label shows up my individual expression.

    But when I move to the English site for translating “Aktuelle Kollektion” into “Current Collection” I recognized that the Child Theme is the same for all sites instaled (DE, EN, …) – so changing the
    the code from $all = "Aktuelle Kollektion"; to
    $all = "Current Collection"; affects all other sites.

    Any Idea how I can handle the “sort-first-label” that it is shown on all sites in its proper language?

    Thanks again!
    BR

    #484025

    Hi Peter_kfm!

    Please change the code to following one

    add_filter('avf_portfolio_sort_first_label','avia_change_portfolio_label', 10, 2);
    	function avia_change_portfolio_label($all, $params)
    	{
    if(ICL_LANGUAGE_CODE=='de'){
    		$all =  "Aktuelle Kollektion";
                    return $all;
    }
    elseif(ICL_LANGUAGE_CODE=='en'){
                 $all = "Current Collection";
                 return $all;
    }
    	}

    Regards,
    Yigit

    • This reply was modified 8 years, 9 months ago by Yigit.
    #484038

    Hi Yigit,
    … not working it shows the word ALLE (which even ist not inside the above code!?) on both sites xyz.at/de and xyz.at/en

    #484109

    Hi!

    I have update the code i posted. Can you please try it now?
    Are you using WPML?

    Regards,
    Yigit

    #484326

    Hi!
    Yes – using WPML and this time nothing showed up.
    Peter

    #484456

    Hi!

    Do you mind creating a temporary admin login and posting it here privately so we can look into it?

    Cheers!
    Yigit

    #485400

    Hi Yigit,
    1) I removed the title from the code $all = “Aktuelle Kollektion”; to
    $all = “”; so there is no more title.
    2) I made a new portfolio category called “KOLLEKTION” to which all products are related in addition. So I can modify the category name for each language site without problem.
    The only thing is that the site starts without a title as the sort title now only is displayed if you click on the sort category filter. Any trick for showing the category filter KOLLEKTION as standard when loading the start page?
    Thanks – Peter

    #485787

    Hi,

    Try adding this at the very end of your theme / child theme functions.php file:

    function add_custom_script(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
        	$('a[data-filter="kollektion_sort"]').trigger('click');
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Regards,
    Josue

    #486037

    Hi Josue,
    it works fine for the http://www.xxx.at/de site but not for the /en site. The en site does not show any titel when loaded.
    maybe because the data-filter=”kollektion_sort” is named different within the /en site?
    Thanks for your efforts!
    BR Peter

    #486150

    Hi Peter,

    Yeah, you could mix the code with language conditionals like, something like

    function add_custom_script(){
    	if(ICL_LANGUAGE_CODE=='de'){
    	?>
    	<script>
    	(function($){
    	    $(window).load(function() {
    	    	$('a[data-filter="kollektion_sort"]').trigger('click');
    	    });
    	})(jQuery);
    	</script>
    	<?php
    
    	} elseif (ICL_LANGUAGE_CODE=='en'){
    	?>
    	<script>
    	(function($){
    	    $(window).load(function() {
    	    	$('a[data-filter="collection_sort"]').trigger('click');
    	    });
    	})(jQuery);
    	</script>
    	<?php
    
    	}
    }
    add_action('wp_footer', 'add_custom_script');
    

    Cheers!
    Josue

    #490662

    Hi Josue,
    Sorry for my delay in answering.
    This code did not work for me. The “Titel” is not shown. Neither in DE nor in EN. Maybe I do not utilize “ICL_LANGUAGE_CODE=” as only utilizing EN / DE subdirectories?

    Is there a way to subsititue “ICL_LANGUAGE_CODE=” to “First Subdirectory = EN”?

    Thanks again and BR – Peter

    #491100

    Hi,

    ICL_LANGUAGE_CODE should work regardless of the setting you re using in WPML. Can you please create us a WordPress administrator account? post it here as a private reply.

    Regards,
    Josue

    #493664

    Hi Josue,
    I informed that I am using WPML – I do not … sorry I mixed things up – I use WPMS – WP Multisite … so I think that’s why the code is not working. Nevertheless – If the titel not shows up when loading the “Collection Site” it will not harm the appearance. Thanks – Peter

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Multisite – changing avf_portfolio_sort_first_label – different languages’ is closed to new replies.