Support » Fixing WordPress » Any good theme option samples multi farbtastic

  • Hi Guys,
    I am writing a plugin for creating child themes, and I have no jQuery knowledge to speak of, and I want to use the same color picker as WordPress uses.

    I have had a dig in the admin files for an example, I found the background-color example, this has a script just for the one textbox, as does the header text, but I cannot find an example with multi textboxes.

    I have copied the background color js and added it to pastebin:

    I can add a class (.color) to all color boxes, but I do not know how to code the following scenario.

    Make the script above dynamic, so whichever textbox has the focus can set and return from the color picker.

    I found this code for a .focus script which I am trying to adapt and merge with the above code.

    $(document).ready(function() {
        var f = jQuery.farbtastic('#pickcolor');
        var selected;
          .each(function () { f.linkTo(this); })
          .focus(function() {
            if (selected) {
            jQuery(selected = this).addClass('color-selected');

    I will add a class of .color to the text boxes, and the id will be used to store the result.

    If I can get some code working then I will post a good working theme options solution for all to use!

    Thanks in advance!


Viewing 1 replies (of 1 total)
  • snowboardmommy


    Hi David,

    Did you ever have any luck with this? I have been searching too but unable to find any solid, working examples of using more than one instance of farbtastic, other than to have a million individual instances for every field where I want to choose a color … not ideal


Viewing 1 replies (of 1 total)
  • The topic ‘Any good theme option samples multi farbtastic’ is closed to new replies.