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. 51
    Azmeen Malaysia »
    thought, on 20/Feb/06 at 2:00 pm # :


    You could try something like:


    Can't preview… hope this works.

  2. 52
    Azmeen Malaysia »
    thought, on 20/Feb/06 at 2:06 pm # :

    Bargh… my last comment didn't display as it's supposed to. Hope this clarifies things.

    Basically, you just double the amp bits, ie. if you want to display: […]&test=1[…] you type (but remove the space after the first ampersand, of course):
    […]& amp;amp;test=1[…]

    Should work pretty well.

  3. 53
    RevvedUp 1.4 is out » The R Zone United States »
    pingback on 20/Feb/06 at 5:47 pm # :

    […] It now fully incorporates the WordPress theme toolkit into the package; thus, ad display code and other options are now completely configurable via the theme options page on the WordPress administrative interface […]

  4. 54
    The Groundhog Project » Hyperballa... United Kingdom »
    pingback on 22/Feb/06 at 3:09 pm # :

    […] Several customization options (thanks to the wonderful WordPress Theme Toolkit by Ozh) […]

  5. 55
    Olaf Switzerland »
    commented, on 22/Feb/06 at 8:57 pm # :

    Theme Toolkit is so amazing, thank you Ozh! I`ve created the Sirius theme and it provides a lot of design options in the admin panel. Thanks to Toolkit I could comfortably realize this theme.

    Information and download link under:

  6. 56
    милованов, Ð... Russia »
    pingback on 23/Feb/06 at 12:05 am # :

    […] WordPress Theme Toolkit « planetOzh. […]

  7. 57
    Kaushal Sheth » Blog Archive &raqu... United States »
    pingback on 05/Mar/06 at 5:37 pm # :

    […] Well I have been messing with WordPress Theme Toolkit Admin Menu today and created an updated version of my previous Exquisite theme. The toolkit is really great. […]

  8. 58
    Lisa United States »
    said, on 06/Mar/06 at 6:13 pm # :

    I thought I posted this already, but I must not have pressed submit.
    anyway, I love this plugin – It will work wonders for me and my users, but it is not working well for me. I am sure it is operator error, so please go easy on me!
    I am using the fauna theme for my blog, http://www.lisa.scribblesonline.com/blog/ and have found the options to change stuff using the themetoolkit editor. I can change the sidebar placement, can hide the links etc. But, when I tried to change the header graphic to a custom image hosted on my site, I get a light gray image.
    Also, when I try to use themetoolkit with other themes, I am not able to change anything, the header image, the sidebar placement and other options.
    any help is greatly appreciated!

  9. 59
    Ozh France »
    thought, on 07/Mar/06 at 7:11 pm # :

    Lisa » these are theme issues, contact authors of the themes that are using my Toolkit.

  10. 60
    Lisa United States »
    commented, on 07/Mar/06 at 10:39 pm # :

    ok, I can do that, but the themetoolkit was not something that they packaged with the theme, I added it to the theme, so I doubt that they will be inclined to help.
    but thanks for the suggestion.

  11. 61
    WordPress Theme Toolkit allows users and... United States »
    pingback on 09/Mar/06 at 12:55 am # :

    […] Just found out that Ozh has created a WordPress Theme Toolkit which, upon editing three lines of code in any existing theme, will provide Theme Authors with an admin menu accessible through the WordPress Presentation UI.  Very cool stuff — all would-be wordpress theme authors should check it out!  Same goes for those of you dabbling in modifying existing themes.  Nice work Ozh! Filed under blogging, Weblogs, WordPress, Templates, Themes, wordpress theme toolkit by Emily from How to Blog. Permalink • Print • Email […]

  12. 62
    Adri Italy »
    wrote, on 09/Mar/06 at 8:23 pm # :

    Fantastic tool with excellent documentations!

  13. 63
    Fauna | Fauna Beta 4 Denmark »
    pingback on 12/Mar/06 at 3:57 pm # :

    […] Ozh added "default options" to his themetoolkit That means Fauna now populates the options page with the default options. This makes it easier for you to see what'll happen when you change those options. […]

  14. 64
    jimy Russia »
    commented, on 14/Mar/06 at 12:04 am # :

    Cool cool tool! Thank u! I am going to try it for my themes (:

  15. 65
    | Ehrlich gesagt… Europe »
    pingback on 14/Mar/06 at 7:58 am # :

    […] Fixes: » Moved all font css to fauna-default.css » Wrote some instructions in the top of fauna-default.css » Added an option to specify a custom stylesheet. This might make it easier to upgrade to future versions of Fauna. » Dropped category RSS meta link, since the code wasn’t 2.0 compatible » Due to incredible work by Ozh on his Themetoolkit (http://planetozh.com/blog//my-projects/wordpress-theme-toolkit-admin-menu/), checkboxes now function properly. Ozh has actually made a workaround to a bug in WordPress itself. Send him a thank you note. » Removed a superfluous DIV from page.php and page-archives.php (Thanks Levi) » Added a few HTML comments in some of the templates, including search.php (Thanks Levi) » Fixed a problem in template-postloop.php where uncommenting the_author_link wouldn’t work (Thanks Sadish) » Fixed a problem in template-sidenote.php where it said “1 Comments” (Thanks Sadish) » Had to add class “post” to template-sidenote.php and template-postloop.php in order to fix an overflow problem » Added some default values to the options page. This means the default configuration for Fauna is now actually shown in the options page, rather than the options being empty as they have been so far » Changed noteworthy heart font to Lucida Console, because it looks really good in that font. » Moved an .entry-date border style from style.css to fauna-default.css » Moved a yellow inputfield focus class to fauna-default.css (Thanks Levi) » Fixed a nasty bug where sites with more than one author would have author pages with errors on them (Thanks a lot, Levi) » Made consistent vertical spacing in UL lists in the sidebar (Thanks Simplex) » Did some tweaks to the header width / height options so you can change the header of the all mastheads, not just custom ones » Added option to change background image and color » Removed the searchbox background. I’ve been pondering this for ages. While it did serve the purpose of connecting above with below, visually, I think it looks a bit better without. Your thoughts? » Due to popular demand, I added another special category: Sidenotes. To do this, I renamed the previous “Sidenotes” category to “Asides”. Now it works like this: “Asides” or “Dailies” are small posts in the main post-list, while “Sidenotes” are relegated to the sidebar. For those of you who are using a “Sidenotes” category for your small posts in the main post-list and don’t want those relegated to the sidebar, simply go “Manage > Categories”, and in the “Category slug” for your Sidenotes category, type in “asides” or “dailies”. Then you’ll keep your behaviour. –> […]

  16. 66
    jsekera United States »
    thought, on 15/Mar/06 at 4:44 pm # :

    Wow this is a fantastic tool – well done.

    I have an oddness that’s happening on the back end, and I wanted to run it by you. When I have an item that uses a checkbox, more often than not when I toggle that element (within the admin interface) it doesn’t take the first time, in fact sometimes they take three times to actually register. The other items (radio & text box) don’t seem to have this problem. Am I doing something stupid here, is there a caching issue with this element, or is there something else at work?

    Also – do you have any plans to add dropdown’s to the list of available elements?

    – Thank you – JS

  17. 67
    Blogzor United States »
    said, on 16/Mar/06 at 8:05 am # :

    Is it possible to add a way that the size of the textbox could be configured? Something like {10,20} size/max. It does not look like their is any sanitizing done on the user input. Could this be vulnerable to xss attacks? Thanks for this great tool.

  18. 68
    flipstah.blog » Blog Archive &raqu... United States »
    pingback on 20/Mar/06 at 1:00 pm # :

    […] The work of Ozh, specifically the WordPress Theme Toolkit has helped theme developers come up with interesting ways to manage sidebars, may they be horizontal or vertical. Kyle Neath used the same toolkit when he made the Hemingway theme. […]

  19. 69
    Ron United States »
    said, on 02/Apr/06 at 6:59 pm # :

    Hi, I istalled the 'Tiga' theme and it includes your plug-in. It is installed on WP1.5.1.3.Everything is installed as per instructions. Repeatedly. The problem is that this warning appears;

    Fatal error: Call to undefined function: add_theme_page() in /home/ronpembe/public_html/wp-content/themes/tiga/themetoolkit.php on line 84

    I am still a newbie to PHP; which I only started learning a year ago. Could you please tell me what this could be?

    Thanks in advance


  20. 70
    hadi farnoud Iran »
    said, on 09/Apr/06 at 8:27 pm # :

    i've got this error when use minimalistic theme,
    Fatal error: Call to undefined function add_theme_page() in /home/users/farnoud/wp-content/themes/minimal/themetoolkit.php on line 84

  21. 71
    » Blog Archive » WordPress T... United States »
    pingback on 14/Apr/06 at 5:37 am # :

    […] WordPress Theme Toolkit […]

  22. 72
    Scott United States »
    said, on 24/Apr/06 at 6:29 pm # :

    I've just rereleased two of my themes and a new theme all of which use the WordPress Theme Toolkit. I'm not a coder nor a designer by any means, but I found this tool very, very useful and pretty easy to get a grasp on and use effectively. Well done.

    plaintxt.org » Themes

  23. 73
    felipe.lavin Chile »
    thought, on 14/May/06 at 6:42 am # :

    Excellent work!

    I have a question: how can I pass some variable through the "texturize" filter?

    For instance, I've created an "About" textarea, but I would like that the contents of that textarea could be "texturized", to add paragraphs and breaks. Is this posible?

  24. 74
    Ozh France »
    wrote, on 14/May/06 at 9:40 am # :

    Felipe » well instead of echo($stuff) you just echo wptexturize($stuff) …

  25. 75
    felipe.lavin Chile »
    wrote, on 14/May/06 at 11:19 am # :


    Actually, what I was looking for was wpautop($stuff); that's the filter that manages paragraphs and breaks… just in case anyone was wondering :P

    Once again, great work!

  26. 76
    Scott United States »
    commented, on 31/May/06 at 5:55 pm # :

    Hey Ozh: I've had a lot of luck with the toolkit—awesome. I am, however, going nuts trying to figure something out with my limited PHP/MySQL knowledge.

    I have a home.php with two layouts. Depending on a checkbox in theme options, one is used with a specific post/page, like a CMS. I've made the two layouts, but I can't figure out how to make an option for a page slug to be entered and then placed in the query_posts('pagename=X').

    I would greatly appreciate any help.



  27. 77
    Scott United States »
    said, on 01/Jun/06 at 5:44 pm # :

    Ozh rocked my query from above. Thanks, Ozh. The WP Theme Toolkit has made my themes better. No! it has made my themes actually usable. Thanks for this.

  28. 78
    Ozh France »
    replied, on 01/Jun/06 at 8:59 pm # :

    Scott » you're welcome :) keep releasing neat themes !

  29. 79
    felipe.lavin Chile »
    thought, on 14/Jun/06 at 4:58 am # :

    Hi, it's me again… I just wanted to know if there is any license protecting your work… the thing it's I'm thinking of release a theme with a GPL license, but that license shouldn't include your work, would it? So… what kind of license should be stated as protecting the theme toolkit?

  30. 80
    Ozh France »
    commented, on 14/Jun/06 at 8:08 am # :

    Felipe » GPL is fine. To be honest, I don't even care about this. I always have the feeling that whenever you release some code, well, it's more or less getting public domain. The only thing that I care about is that whenever a theme author releases a new theme using the toolkit, I'm notified (trackback, link, mail) about it. That makes my day :)

  31. 81
    Karthik India »
    commented, on 04/Jul/06 at 1:02 pm # :

    hey i am designing a theme and i wanted a query like this to be generated.. in a function called mytheme_asides()

    // query_posts('category_name="asides"&showposts=4');

    how do i do it.. i want "asides" to be replaced by $mytheme->options['asides'] and 4 to be replaced by $mytheme->options['asides_num']..

    please help me out..

  32. 82
    aseed France »
    commented, on 31/Jul/06 at 8:53 am # :

    Great job merci beaucoup
    sympa knorr ;-)

  33. 83
    sapinto Chile »
    thought, on 22/Sep/06 at 7:42 am # :


    nice work dude ;)

  34. 84
    John Ireland »
    thought, on 20/Oct/06 at 6:34 am # :

    Thank you so much. I am no expert with php and the toolkit has give me loads of options to edit my own blog. This is such a great tool and thank you again!

  35. 85
    Eugen Tuning Germany »
    thought, on 24/Oct/06 at 10:59 pm # :

    Ozh , thanks for tool, great idea. downloaded and installed, but must test in my testblog :)

  36. 86
    arena France »
    commented, on 25/Oct/06 at 12:42 am # :


    j'ai juste rajouté ces quelques lignes dans la fonction print :

    case 'select':
    print $matches[1]."\n";
    print "";
    while ($items) {
    if ($v == $this->option[$key]) $selected=' selected';
    print "$t\n";
    print "";

    et ca marche !!!!!!!!

  37. 87
    Sam Devol :: WordPress Theme: missunders... United States »
    pingback on 30/Oct/06 at 6:22 pm # :

    […] The sidebar is fixed (static), but the header and content-area are fluid to accommodate different sized screens/browsers. I included the WordPress Theme Toolkit by Ozh for user-friendliness. For style and functionality I have included some plugins: jspullquotes by Viper007Bond (for the cute magazine-style pullquotes), Sociable by Peter Harkins (adds Social Bookmarking links to the end of each post), Live Comment Preview by Jeff Minard and Iacovos Constantinou, Optimal Title by Aaron Schaefer (reverses order of post-title/blog-title for SEO/Search friendliness) and Related Posts by By Alexander Malov & Mike Lu (lists related posts at the end of each post). […]

  38. 88
    Sam Devol :: WordPress theme: Corporate ... United States »
    pingback on 30/Oct/06 at 6:50 pm # :

    […] Here is a newsletter-style 2-column with sidebar theme for WordPress which allows some control over which categories are displayed in each column. I included the WordPress Theme Toolkit by Ozh for user-friendliness. This theme is a modified version of Corporate Slave, by dreamLogic . […]

  39. 89
    Update: Widgetized October Special - 5Th... United States »
    pingback on 06/Nov/06 at 9:07 am # :

    […] Now distributed with multiple colors schemes – blue, pink, green, brown, red, and orange – controlled via the Theme Presentations tab thanks to the WordPress Theme Toolkit. […]

  40. 90
    una prueba | Un tipo X (Cómic blog) United States »
    pingback on 07/Nov/06 at 8:25 am # :

    […] Usamos WordPress Theme Toolkit […]

  41. 91
    Taly OnLine » Un camino de ida United States »
    pingback on 15/Nov/06 at 1:15 am # :

    […] Cada segundo que paso online significa incorporar un nuevo conocimiento: desde la lectura del diario ni bien me levanto, hasta aprender a usar el wordpress theme toolkit para ponerselos a mis themes. Desde leer las principales tres revistas medicas todos los días hasta la verdadera historia de Jean y Dark Phoenix. […]

  42. 92
    Martijn Stegink Netherlands »
    replied, on 03/Dec/06 at 11:54 pm # :

    I use your toolkit in my CMS theme. Thanks for creating and sharing this nice tool. A suggestion: it would be nice to be able to add a dropdown list based in a query in the options.

  43. 93
    Widgetized October Special WordPress The... United States »
    pingback on 10/Dec/06 at 7:50 am # :

    […] Now distributed with multiple colors schemes – blue, pink, green, brown, red, and orange – controlled via the Theme Presentations tab thanks to the WordPress Theme Toolkit. […]

  44. 94
    Infected-FX Mexico »
    wrote, on 28/Dec/06 at 4:20 pm # :

    Hi, i'm new using this great featured for themes, but i have a question in the implementation for this.

    I am trying to use conditional for the functions, if they exist that they are and but that they show another thing, but me it does not respect it.

    For example i have a function call inphecthyuz_codeone in my theme put this

    < ? php if (function_exists('inphecthyuz_codeone')) : ? >
    < p >< ? php inphecthyuz_codeone(); ? > < /p >
    < ? php else : ? >
    < h2 >the other thing here
    < ? php endif; ? >

    any idea? :( pls!!

    Thank you!! :) and greetings.

  45. 95
    Kipit France »
    said, on 28/Dec/06 at 6:52 pm # :

    To use it with WPmu (Worpress-Multiuser), as $wp_version='wordpress-mu-1.0′ , drop WP 2.0 (and 1.0) specific code, assuming that current version of WPmu is based upon WP-2.0

  46. 96
    Ozh France »
    wrote, on 28/Dec/06 at 7:52 pm # :

    InfectedFX » your PHP code is correct. The thing is, function_exists is sometimes a bit touchy : at compilation time, PHP sometimes doesn't know if the function will exists or not. This can typically happen when your function_exists test is enclosed in another test, or a class.

    However, there is no reason why a function you're defining in your theme would not exist. So I'm not sure you really need this test :)

  47. 97
    Money From United Kingdom »
    commented, on 05/Jan/07 at 11:09 am # :

    The more code that is added the slower everything will start to run though correct or am I wrong? Is it a noticable shift in performance?

  48. 98
    Ozh France »
    commented, on 06/Jan/07 at 12:36 am # :

    MF » take a look at how many thousands of lines of code are run in WP every time a page is loaded. Adding a single 40 line class and 20 lines of functions code is… nothing :)

  49. 99
    test Germany »
    commented, on 14/Jan/07 at 2:51 am # :

    Sehr gut!

  50. 100
    Andy Wibbels United States »
    commented, on 19/Jan/07 at 3:04 pm # :

    Toyed with getting a option type for dropdown menus. Here's what I came up with – still testing it:

    case 'dropdown':
    print $matches[1]."\n";
    print "";
    while ($items) {
    if ($v == $this->option[$key]) $checked='selected';
    print " $t";
    if (@$items) print "\n";
    print "";
    print "";

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.