Skip to content

Instantly share code, notes, and snippets.

@Avesha-2016
Forked from taninbkk/functions.php
Created August 17, 2017 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Avesha-2016/d3fbb394c60a862864b8dae6e81a34c5 to your computer and use it in GitHub Desktop.
Save Avesha-2016/d3fbb394c60a862864b8dae6e81a34c5 to your computer and use it in GitHub Desktop.
Polylang Shortcode
// Polylang Shortcode - https://wordpress.org/plugins/polylang/
// Add this code in your functions.php
// Put shortcode [polylang] to post/page for display flags
function polylang_shortcode() {
ob_start();
pll_the_languages(array('show_flags'=>1,'show_names'=>0));
$flags = ob_get_clean();
return $flags;
}
add_shortcode( 'polylang', 'polylang_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment