• Hi guys, thanks for the good work.

    I have an issue which I solved but don’t know if in the right way.
    I put the language selector widget on my “Single Post” sidebar and I did not want it to show up if no translations are available for that post, so I wandered a bit in Polylang’s options and found hide_if_no_translation.

    So I edited polylang/include/switcher.php, function get_switcher_options()
    and appended:

    'hide_if_no_translation' => array('string' => __('Hides the widget if no translation exists', 'polylang'), 'default' => 0),

    to the options array, it worked like a charm so now the option is showing up among the widget’s other options. Apparently it’s working fine.

    I want to know if the solution is the right one and, if so, if you can add permanently the option to Polylang.

    Many thanks!
    Ciro.

    https://www.ads-software.com/plugins/polylang/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I was looking just for this, thank you! I wonder why the author of the plugin doesn’t make it available and lets us modify his plugin…

    Awesome! I’ve been searching everywhere for this. It works great! Thanks @ciromattia

    amazing, thanks! This also works if you have more than two langauges and one of the translations is missing. f.e. if a page is only available in one of the two other languages, then only the available language is displayed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add "Hide if no translation" to the widget options’ is closed to new replies.