Warning: Creating default object from empty value in /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php on line 31

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/yourls-wordpress-to-twitter/plugin.php on line 73

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/yourls-wordpress-to-twitter/plugin.php on line 73

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 62

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads.php on line 630

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads.php on line 631

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/themes/planetozh/functions.php on line 172

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/themes/planetozh/functions.php on line 173
WordPress Theme Toolkit « planetOzh
On: 2005/09/03 Viewed: 388257 times
Shorter URL for this page: http://ozh.in/ko

Simple syntax, detailed results

The syntax of options you can add into the option array, in functions.php, is very simple, yet it allows you to create detailed and complex admin forms : input fields, checkboxes, radio buttons, multiline text areas, mostly everything you will need. Let's make another menu with the following entries in the array of options :

Input field :
Regular input field, with the text "optional explanations" below it.

  1. 'cc_number' => 'Credit Card Number ## Display it on your site.'

Bare Input field :
When the option is self explanatory, trim it to the minimum.

  1. 'age' => 'Your age'

Text Area :
Adding {textarea|number of rows|number of columns} create a textarea input field.

  1. 'politics' => 'Political Views {textarea|6|50} ## What are your views ?'

Radio Buttons :
Use {radio|value1|text1|value2|text2} with any number of options to add radio buttons.

  1. 'menu' => 'Sidebar Menu on the {radio|left|Left Hand|right|Right Hand}'

Check Boxes :
Checkbox syntax is the following : {checkbox|name of variable|value of variable when checked|text} with any number of options.

  1. 'blah' => 'You are ... {checkbox|is_happy|yes|Happy ?|is_human|human|Human ?} ## Check if applicable'

Separator :
You can add a separator line if you feel your options list gets too long.

  1. 'some_random_and_unique_name' => 'This is a separator {separator}'

The result of such an array of options would be the following admin menu (click to enlarge)
Theme Toolkit : admin menu example

Handy to Programmers

What you probably like, as a PHP programmer who wants to write your own functions, is to know any time what variables you have, and their values. WordPress Theme Toolkit come in with a handy feature called the Programmer's Corner.

Just add this fake entry in your array of options :

  1. 'debug' => 'debug'

And whenever you input something in the admin menu, you will be shown the list of option variables and their values : (click to enlarge)
Theme Toolkit : admin menu example

Nice to WordPress

WordPress Theme Toolkit likes to be discreet :
Everything you will input in your fresh admin menu will be stored in a single entry, in WordPress' option table (wp_options, most of the time). It's not like those dirty plugins who add ten entries in the database !

WordPress Theme Toolkit likes to be clean :
Admin menu created will include a "Delete" option, so that when a user decides to remove your theme and clean the option table, it's just one click away.

WordPress Theme Toolkit likes to be smart :
Even if you run 10 themes that come with their own copy of WordPress Theme Toolkit, its modular architecture and code relying on PHP classes make that only one is actually included in memory. And the 10 admin menus are functional, of course.

WordPress Theme Toolkit likes to be light :
Reading options stored in your database won't cost you a single additional MySQL query. No extra database lookup. Everything at light speed just as if there was no Theme Toolkit behind the hoods.

WordPress Theme Toolkit likes to be compatible :
Wordpress 2.0 and the WordPress Theme Toolkit are friends. With WordPress versions 1.5xx, you need to add an include line at the beginning of header.php, while this is not necessary with 2.0 (although leaving the line is harmless)

Adding custom functions

Now, in functions.php, add your own functions that will make use of input values. Be sure to add a global declaration for your options array, and here you go. Syntax of your functions will be something like :

  1. function mytheme_creditcard () {
  2.     global $mytheme;
  3.     print $mytheme->option['cc_number'] ;
  4. }
Page: #1 #2 #3 #4 #5

Shorter URL

Want to share or tweet this page? Please use this short URL: http://ozh.in/ko


This page "WordPress Theme Toolkit" was posted on 03/09/2005 at 2:36 pm
Watch this discussion : Comments RSS 2.0.

196 Blablas

    Pages: « 1 2 3 [4] Show All

  1. 151
    My Comment Count is Bigger Than Your Com... United States »
    pingback on 23/Aug/08 at 11:17 pm # :

    […] WordPress Theme Toolkit […]

  2. 152
    Abhishek India »
    said, on 25/Aug/08 at 3:45 am # :

    Thanks for the solution !!

  3. 153
    WordPress Theme Toolkit: Anything You Wa... United States »
    pingback on 28/Aug/08 at 4:51 pm # :

    […] WordPress Theme Toolkit is a tool that allows theme authors add an admin menu as easily as editing 3 lines, and it powers […]

  4. 154
    Andrea Panama »
    thought, on 01/Sep/08 at 3:23 am # :

    Thanks man. Very useful to those of us who need to knock out lots of different blogs…

  5. 155
    Nerino 2.2 - Template per wordpress grat... Italy »
    pingback on 16/Sep/08 at 10:56 am # :

    […] disponibile anche la versione senza pannello di amministrazione. Nerino utilizza il noto toolkit open source per temi wordpress, tuttavia qualcuno ha segnalato problemi con l'editor di scrittura avanzato, per questo metto […]

  6. 156
    diplodGeek: tema wordpress gratuito in s... Italy »
    pingback on 16/Sep/08 at 11:21 am # :

    […] disponibile anche la versione senza pannello di amministrazione. Nerino utilizza il noto toolkit open source per temi wordpress, tuttavia qualcuno ha segnalato problemi con l’editor di scrittura avanzato, per questo metto a […]

  7. 157
    Sportemplate: tema wordpress per societ... Italy »
    pingback on 16/Sep/08 at 11:25 am # :

    […] disponibile anche la versione senza pannello di amministrazione. Sportemplate utilizza il noto toolkit open source per temi wordpress, tuttavia qualcuno ha segnalato problemi con l’editor di scrittura avanzato, per questo metto a […]

  8. 158
    mike United States »
    thought, on 19/Sep/08 at 1:24 am # :

    i messed up my blog big time and need your help…not sure what i did but its not working http://www.blackfitnessblog.com…i messed with the themetoolkit.php file help please

  9. 159
    Ozh France »
    replied, on 19/Sep/08 at 2:05 am # :

    mike » This is for theme author who know what to do with it (ie add an admin menu). Sorry I cant help with this.

  10. 160
    Coffee Time Magazine Theme | Premium The... United States »
    pingback on 27/Oct/08 at 4:47 pm # :

    […] Theme ToolKit […]

  11. 161
    storebb» Blog Archive » WP F... United States »
    pingback on 28/Nov/08 at 8:00 am # :

    […] Theme ToolKit […]

  12. 162
    A Magic Blog » Blog Archive »... Taiwan »
    pingback on 02/Dec/08 at 9:31 am # :

    […] http://planetozh.com/blog/my-projects/wordpress-theme-toolkit-admin-menu/ […]

  13. 163
    :: BeAN :: » Blog Archive » ... Mexico »
    pingback on 18/Dec/08 at 6:28 pm # :

    […] Theme toolkit :  Por algunos Scripts que me fusilé de ahi pero como son libres no es tanto fusil. […]

  14. 164
    Wordpress Updates » Blog Archive &... United States »
    pingback on 20/Dec/08 at 1:31 pm # :

    […] once been known to cause major problems with WordPress MU, Ozh's WordPress Theme Development Toolkit, which allows designers to easily add theme options into the back end seems to be working […]

  15. 165
    Wordpress Updates » Blog Archive &... United States »
    pingback on 29/Dec/08 at 7:08 am # :

    […] and or a slightly better grasp of what's going-on within the back-end of themes, perhaps Ozh's Theme Toolkit is not enough. Fortunately, In The Woods added a detailed explanation of how to build […]

  16. 166
    Elbujero.com United States »
    pingback on 30/Dec/08 at 9:38 pm # :

    […] Theme ToolKit […]

  17. 167
    ReCharge United States »
    pingback on 31/Dec/08 at 8:52 pm # :

    […] Theme ToolKit […]

  18. 168
    Mint Tree United States »
    said, on 26/Feb/09 at 11:00 am # :

    Hi Ozh,

    Is there an example to get the specific values for the Multiple Checkbox?


  19. 169
    Mint Tree United States »
    thought, on 26/Feb/09 at 11:06 am # :

    Never mind, I got it through the DEBUG =P… was stuck on what the values got stored ;).

    Anyway, tips to all the future programmer: uncomment the debug (FYI: it's 1:05 am here, so I think that's why I hit a brick wall =).

  20. 170
    futuRich United States »
    wrote, on 21/Mar/09 at 12:51 am # :

    so what exactly does the end product look like? examples = thanx :o

  21. 171
    Ozh France »
    commented, on 21/Mar/09 at 1:41 am # :

    futuRich » I think you didn't understand what this is for. The end product is what the theme designer decides to make of it. This is just an internal tool.

  22. 172
    Jesh United States »
    thought, on 26/Mar/09 at 9:59 pm # :

    Hi Ozh. You'll have to excuse the question because I didn't look through all 171 comments on this post (who has the time?) to see if it's already been answered, but why haven't you supplied the download link as a zip or tar? It's pretty "wonky" for a user to grab your scripts as is. I can't really complain though. Thanks for the awesome Admin Menu.

  23. 173
    Anthony India »
    said, on 27/Mar/09 at 11:22 am # :

    Pretty comprehensive guide..even though I do play a lot with html and scripts, having menu driven edits are far better than editing wordpress pages, digging through the code.

  24. 174
    Introducing UnderCon - Better, Sweeter, ... Malaysia »
    pingback on 19/Apr/09 at 8:49 pm # :

    […] Logo ('DizCow') from the awesome and free LogoInstant. – Theme Options made possible by Theme Toolkit, with some minor […]

  25. 175
    Studio8.net - iamnotagoodartist United States »
    pingback on 28/Apr/09 at 3:30 am # :

    […] the wonderful planetOzh's Theme Toolkit, the pigtopus speech text at the top can be changed, as well as the top navigation bar links, the […]

  26. 176
    James Callaway Canada »
    replied, on 01/May/09 at 12:33 am # :

    Hey there Ozh,

    I've been following this page for a bit. Good stuff. Any plans to bring the tool kit up to 2.7.1 compatibility?

  27. 177
    Ozh France »
    replied, on 01/May/09 at 9:39 am # :

    James: yeah, this has been on my todo list for ages

  28. 178
    Bedo Ireland »
    wrote, on 21/May/09 at 4:15 pm # :

    Hi Ozh,
    I´ve dowloaded a theme which includes also your Theme Toolkit. http://wpjunction.com/themes/corporate/
    It´t cool, but I am struggling to find the bug which is causing that my custom Home page is not showing up.
    eg. I would like to have my custom home page and the blog section elsewhere. Some how when I change the wp option for the home page, it´s always calling the index file. However I could locate it to your toolkit. Can you help me?
    Wp 2.7.1, thank you!

  29. 179
    Steve United States »
    replied, on 09/Jun/09 at 3:08 am # :

    Thanks so much for this tool! I have used is successfully for a friends website: twistedamerica.com. Please forgive me if you have answered this question before but is there anyway I can edit the code so that it doesn't mess up single quotes? Its fine when you first store the options, but when you come back the text is always broken, like it added a break after any single quotes. I'm kind of a newbie at code so please excuse me if I am asking a silly question.
    Thanks again

  30. 180
    Anil India »
    thought, on 12/Jun/09 at 9:59 am # :

    It seems like this doesn't work with wordpress 2.8. It stopped functioning perfectly when i upgraded. I think problem is with get_Category

  31. 181
    Elpie New Zealand (Aotearoa) »
    said, on 23/Jun/09 at 3:55 pm # :

    @Anil, the Toolkit does not use get_category but a customised one might ;)

    You may be running into a WordPress problem here. 2.8 has a known issue with category functions and this has been fixed in 2.8.1, which is currently in beta testing.
    See here for more info: http://wordpress.org/support/topic/280256?replies=26#post-1104991

    I am running 2.8.1 Beta on some production sites now because of some of the issues in 2.8. You might like to consider doing the same (or waiting a bit for the final release). Try it on a test site first and see if the problem with your Toolkit goes away.

  32. 182
    Carlos Guatemala »
    thought, on 23/Jul/09 at 7:32 am # :

    Hey Ozh,
    I known your are a busy person, but if you can bring the tool kit up to 2.8.1 compatibility will be more than great, you will make more people happy ;)

    Theres a option to pay for this compatibility? Please let me know, write to my email.


  33. 183
    NewsPaper « Storelicious :: Premiu... United States »
    pingback on 07/Sep/09 at 2:39 pm # :

    […] Theme ToolKit […]

  34. 184
    Coffee Time « Storelicious :: Prem... United States »
    pingback on 07/Sep/09 at 2:39 pm # :

    […] Theme ToolKit […]

  35. 185
    WP Folio XL « Storelicious :: Prem... United States »
    pingback on 07/Sep/09 at 2:39 pm # :

    […] Theme ToolKit […]

  36. 186
    kymac United States »
    said, on 27/Nov/09 at 5:26 pm # :

    This is an awesome tool for me! I have fixed a problem with checkboxes and now have it working under WP 2.8.6.

    Here is the modified read_options()

    1. /* Read theme options as defined by user and populate the array $this->option */
    2.         function read_options() {
    3.             $options = get_option('theme-'.$this->infos['theme_shortname'].'-options');
    4.             $options['_________junk-entry________'] = 'ozh is my god';
    5.             $this->option = array();
    6.             foreach ($options as $key=>$val) {
    7.                 // is_array check needed for Multiple Choice
    8.                 if (is_array($val)) {
    9.                     foreach ($val as $key2=>$val2) {
    10.                         $this->option["$key2"] = stripslashes($val2);
    11.                     }
    12.                 } else {
    13.                     $this->option["$key"] = stripslashes($val);
    14.                 }
    15.             }
    16.             array_pop($this->option);
    17.             return $this->option;
    18.             /* Curious about this "junk-entry" ? :) A few explanations then.
    19.              * The problem is that get_option always return an array, even if
    20.              * no settings has been previously saved in table wp_options. This
    21.              * junk entry is here to populate the array with at least one value,
    22.              * removed afterwards, so that the foreach loop doesn't go moo. */
    23.         }
  37. 187
    kymac United States »
    commented, on 27/Nov/09 at 6:07 pm # :

    I just realized that I am using a modified version of themetoolkit.php that was included with the Simplicity theme by Lai Zit Seng. Lai fixed a bug with an extraneous dollar sign, and corrected some HTML ending tags in version 1.12.

    If you will email me using the About->Contact Us form bluegrassmiataclub.com, I will send you this version.

  38. 188
    kymac United States »
    said, on 27/Nov/09 at 6:10 pm # :

    Sorry, I forgot to include to select 'Mac McDonald' as the contact in the form mentioned in my previous post.

  39. 189
    Sherif Egypt »
    said, on 21/Dec/09 at 8:23 pm # :

    im a new web designer not good with php and i look for tutorials or some help of how to use wp theme toolkit.

    i understand the basics and already have done some stuff with my new theme with it but i still need to do some more things but i cant

    so any help plz ?


  40. 190
    John Netherlands »
    wrote, on 11/Nov/10 at 10:00 pm # :

    Is the toolkit compatible with wp3. I see a lot of old stuff, is it up to date?

  41. 191
    Ozh France »
    wrote, on 11/Nov/10 at 10:07 pm # :

    John » Probably. Dunno. Test and report :)

  42. 192
    naomae Philippines »
    replied, on 05/Apr/11 at 8:37 am # :

    thank you for the idea for making themes for blogs more beautiful. hope you can post more about this stuff. thanks!

  43. 193
    Tjobbe United Kingdom »
    wrote, on 16/May/11 at 6:03 pm # :

    This looks like exactly what I need, but I have two questions!

    I have managed to edit the functions.php file and created custom fields which succesffully stores my custom data to the db.

    How do I:

    a) echo these custom fields, one-by-one, into my template?

    b) Can I use some tags to put these custom fields into my posts and pages?

  44. 194
    Jatin Soni Mauritius »
    commented, on 19/Jun/11 at 1:43 am # :

    I am creating new and very first theme for wordpress and even not familiar with php, thanks for this nice tool.

    Now I am very much confused how to create image uploade field into theme panel…

    I have used Image URL for header logo code as below

    Admin Panel code:
    $mytheme->option['site_logo'] = "myurl here"

    Theme I have added below code:

    <a href="/"><img src="option['welcome']; ?>" alt="logo" width="260″ height="125″ border="0″ title=""/>

    But still logo image doesn't appearing at all. It works with direct url.
    Please help me to solve this issue also with image upload option if possible.

    My theme will have lots of images so I required proper image URL and Upload option on admin panel.

    Thanks in advance…

  45. 195
    Jatin Soni Mauritius »
    thought, on 19/Jun/11 at 8:24 am # :

    I check the image coming other places but not at header logo.. :( what is the reason please help me to solve this.

  46. 196
    sugeng tigefa Indonesia »
    said, on 27/Jul/13 at 1:20 am # :

    this themes comptability latest wordpress version? :)

Pages: « 1 2 3 [4] Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.