Not signed in ( Sign In)


Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentTimeJan 3rd 2010
    I want to be able to let visitors to my site change the language of the interface themselves. Does anyone know how to write a plugin which will let me put a widget in the sidebar which has a dropdown allowing the user to set their own preferred language which overrides the default one I've set in the admin panel?

    btw, I also want to be able to let the user choose their preferred style, rather like NWM does on this page, although without the thumbnail or the "change" button (so it just changes the theme as soon as the user selects a different one in the dropdown), same as happens when you select a new theme/style in the admin panel. I just really want to allow the user to change the colour scheme though - not the theme itself, in case that makes it a little easier. I was looking at using a Javascript css selector, but maybe a plugin/widget solution would be better?

    Sorry for the two questions in one, the language one is more important for me but the theme style one would also be welcome, and the example I gave helps to illustrate it some more (and NWM has already got this one to work so if this could be widgetised somehow then that would be very helpful).
    • CommentTimeJan 3rd 2010
    the relevant setting for language is in $fp_config['locale']['lang'] ; you have to hook into the 'init' plugin hook and change the default behavior by reading the $_POST of the for embedded in the widget or a cookie value;
    the thing is similar for theme/style (fp_config[general][theme] fp_config[general][style] IIRC)

    I haven't released that plugin because it is a bit of a hack, and it was written for a very old version of flatpress.

    Actually I didn't even make it, it was written by Hydra when she was more active in FP development.
    • CommentTimeJan 3rd 2010
    Ok, that might help. I'm busy writing a new theme so I've been nosing around in all the tpl files and so on, so I'll bear that in mind in case it helps. Thanks!
    • CommentTimeJan 3rd 2010 edited
    In case it helps anyone I used this method to incorporate style switching in my theme - I just added the relevant bits in my theme's header.tpl. It leaves the default (structural) theme intact and just adds whatever colour schemes I want my visitors to choose from.

    It seems to work very well.

    The head section in my header.tpl looks like this:


    <meta http-equiv="Content-Type" content="text/html; charset={$flatpress.charset}" />
    {action hook=wp_head}
    <!-- add user preferred styles -->

    <link rel="alternate stylesheet" type="text/css" media="screen" title="red"
    href="http://localhost/myce/fp-interface/themes/mytheme/res/red.css" />
    <link rel="alternate stylesheet" type="text/css" media="screen" title="blue"
    href="http://localhost/myce/fp-interface/themes/mytheme/res/blue.css" />

    <script src="js/styleswitch.js" type="text/javascript">

    * Style Sheet Switcher v1.1- © Dynamic Drive DHTML code library (
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at for this script and 100s more



    and then just add the dropdown selector where you want.

    Still working on the language selector!