WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
Developer wanting to 'lock down' Polylang for drop-down flags menu (2 posts)

  1. stuartmcmillen
    Member
    Posted 2 years ago #

    I am having my website developed by an external dev, and I am keen for Polylang to be installed for multi-language support.

    The design solution I want for swapping languages is a 'drop down' featuring all the language flags for my site. (No text descriptions of the languages - just the flags).

    The dev says that he will need to alter the code in order for the plugin to be styled with the flag drop down. He says this feature is not currently available through Polylang.

    He says that due to this code modification, I will not be able to update Polylang without losing the customised coding.

    - > Question: do you agree that this is my only option to get the 'drop down' flag functionality? Is there no existing solutions within Polylang that the dev can use for this feature?

    Also, what are the risks of going with this 'frozen' customised solution? e.g. will I still be able to update my WordPress installation with the old Polylang version.

    Excuse my non-techie knowledge. :)

    http://wordpress.org/extend/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    I do not recommend going with a frozen 'polylang' version. Most probably, you will not be able to update WordPress one day or the other if you are stuck with a frozen plugin (either customized or not maintained by its author).

    I just looked how it works to add a picture in a dropdown list and took the first result in Google. Basically you need to add a 'title' attribute to options in your html and the script will use it to display the picture. I guess other scripts work more or less the same way.

    So I believe that a bit of Javascript would be sufficient to modify the dropdown without altering Polylang code. However I guess that your dev would prefer working with PHP (I would too).

    I propose to add the following filter at line 700 in include/core.php (v0.7.2):

    $output = apply_filters('pll_the_languages', $output);

    It's similar to what's done by WordPress with the filter 'wp_dropdown_cats'. So with this and some 'str_replace', it should be ok for your dev to output what you want without altering Polylang code.

    Tell me if it's OK.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags