• Resolved dr_tracker

    (@dr_tracker)


    Hi guys, please forgive me for this question that might have been already asked but I have already searched and have not been able to make this work.

    The thing is, I want to use a shortcode according to the current locale, pointing to different contact forms.

    Tried this:

    <?php
    
     if ( pll_current_language() == 'es' ) {
    
    	 [shortcode es]
            }
            elseif ( pll_current_language() == 'en' ) {
    	 [shortcode en]
            }
    
    ?>

    Please let me know if this is possible and if I’m doing it right.

    https://wordpress.org/plugins/polylang/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    I am not sure to understand what you mean. pll_current_language() is a PHP function that you can use in PHP files. Shortcodes are meant to be used in your posts or pages. So both cant’t be used at the same place.

    Thread Starter dr_tracker

    (@dr_tracker)

    Hi Chouby, I have a tab plugin with a contact form on it that is not multilanguage and I tried converting it. In the end I used a PHP code plugin that worked like a charm.

    Thanks for your concern and for developing this great plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Newbie question about pll_current_language’ is closed to new replies.