Can anyone help me figure this out??

  • Anonymous


    I know it’s not Graphene specific… but I was hoping someone out there might be able to help me with this final piece of the puzzle. (I get so fed up over on the wordpress forums… sigh)

    Here is the code:

    function jwl_tinycolor_css_callback_function() {
    $options = get_option('jwl_tinycolor_css_field_id');
    $items = array("Default", "Pink", "Green");
    echo "<select id='tinycolor' name='jwl_tinycolor_css_field_id[tinycolor]'>";
    foreach($items as $item) {
    $selected = ($options['tinycolor']==$item) ? 'selected="selected"' : '';
    echo "<option value='$item' $selected>$item</option>";
    echo "</select>";

    The code displays the dropdown on my settings page, populates it with the values, and saves the selection. Awesome!!

    The problem:

    How do I extract a single value and assign it to a variable? Basically I am running a stylesheet selector from within my plugin admin page. I would like to have three variables.. $default, $pink, and $green… for example. Then, I’m going to run it through an if/else statement to display the different stylesheets.

    Sooo, can anyone help me find out how to isolate these values, and assign them to a variable I can use?

    Thanks so much!!


    Kenneth John Odle


    Well, you can take a look at the style sheet switcher I use on my main web site (I’ve spent weeks rewriting all the css and php for it), which I got from here:

    Might give you some ideas…



    Ooops… I guess I should have mentioned I am trying to do this from within my plugin page.

    Ken, you’re awesome! I really like that site. Also, I like how it retains what you had selected from your last visit. I’m going to be sure to include it on my site, regardless of whether I can get it working in the plugin 🙂

    Thanks buddy!

    I’ve spent weeks rewriting all the css and php for it

    Haha… pouding out some code, eh?? How many options are you offering users?



    Got this working. Thanks again, Ken (although I didn’t use your suggestion 😉

    What’s your main website? I’d like to see your work on the switcher.



    What’s your main website? I’d like to see your work on the switcher.


    Kenneth John Odle


    Still have some more stylesheets to go.

    Josh, are you planning a separate plugin for this?



    Thanks Prasanna… you nifty little moderator, you 😉 I’m thrilled to see you as part of the team!

    @ Ken,

    Nice work. I can see this will probably be one of those “never-ending” projects for you. You know, one of those things that are NEVER fully tweaked 🙂

    I really like it. I’m definitely going to add something similar to my site. I really like your “tropical” setting… that’s the kind of water I like to be around (unfortunately, we don’t have much of it here in Kentucky)!!

    I’ve just been experimenting. Ultimate Tinymce has grown by leaps and bounds. Just crossed over 100,000 downloads. Currently, I have implemented it as another feature… but I’ve considered making it a separate plugin as well…

    That’s one thing I love about wordpress… so many options!!!

    Check out a few screenshots of what I’ve been experimenting with:



    Looks Kool! [Erm.. Using ‘K’ubuntu right now 🙂 ] I’m waiting for it.

    Congratulations for crossing 100,000 mark! I’ve observed the stats this evening..

Viewing 8 posts - 1 through 8 (of 8 total)

  • You must be logged in to reply to this topic.