Forum Replies Created

Viewing 1 replies (of 1 total)
  • I’ve go a theme that does not “export” all the strings one can enter properly. It happens mainly in lists on the frontpage. I understand that a shortcode isn’t the clean solution and string literals will be on many places. Polylang doesn’t offer anything for such a case, correctly?

    I’ve found a shortcode that would do the thing I am asking. Colinschwebke has it on Github:

    // [polylang lang="en"]English[/polylang][polylang lang="de"]Deutsch[/polylang]
    //Add this code in your functions.php
    function polylang_shortcode($atts, $content = null)
    {
      if (empty($content))
        return '';
      extract( shortcode_atts( array('lang' => ''), $atts ) );
      if (empty($lang))
        return "### You must specify 'lang' using shortcode: polylang";
      return ($lang == pll_current_language()) ? $content : '';
    }
    add_shortcode('polylang', 'polylang_shortcode');
    • This reply was modified 1 year, 9 months ago by asfhdf78as.
Viewing 1 replies (of 1 total)