{"id":335,"date":"2005-09-03T14:36:38","date_gmt":"2005-09-03T12:36:38","guid":{"rendered":"http:\/\/frenchfragfactory.net\/ozh\/my-projects\/wordpress-theme-toolkit-admin-menu\/"},"modified":"2007-05-09T23:49:28","modified_gmt":"2007-05-09T21:49:28","slug":"wordpress-theme-toolkit-admin-menu","status":"publish","type":"page","link":"https:\/\/planetozh.com\/blog\/my-projects\/wordpress-theme-toolkit-admin-menu\/","title":{"rendered":"WordPress Theme Toolkit"},"content":{"rendered":"<p>In every WordPress theme there are places that are supposed to be edited and customized by the end user who is using the theme : an &quot;About you&quot; block to fill in, a loop to customize when you want to add &quot;Asides&quot; post style, some CSS to tweak to use an personal image in header, etc&#8230;<\/p>\n<p>The problem is : most bloggers are not PHP or HTML expert, can&#39;t tell the difference between an HTML tag and a PHP tag, and simple editing of templates can be hazardous and tedious to them. Adding an admin menu in your theme ensures that end users can customize things without editing source files, just as naturally as changing a WordPress option in the admin area.<\/p>\n<p><em>WordPress Theme Toolkit<\/em> is a PHP class that gives WordPress theme authors the opportunity of creating a persistent admin menu for their theme <strong>as easily as editing 3 lines in a file<\/strong>.<\/p>\n<p>You are a theme author ? Have enough skills to edit three lines ? Add an admin menu to your theme ! (click to enlarge)<br \/>\n<a href=\"\/blog\/images\/themetoolkit\/themetoolkit_2.gif\" rel=\"lightbox\"><img decoding=\"async\" src=\"\/blog\/images\/themetoolkit\/themetoolkit_2-s.gif\" alt=\"Theme Toolkit : admin menu example\"><\/a><\/p>\n<p>Just to be sure : <strong>WordPress Theme Toolkit<\/strong> is not a theme with an admin menu. It is something that makes adding an admin menu to an existing theme as easy as 1-2-3.<\/p>\n<p>This long article is divided in shorter sections :<\/p>\n<ol>\n<li><a href=\"\/blog\/my-projects\/wordpress-theme-toolkit-admin-menu\/1\/\">Intro<\/a> : well, here.<\/li>\n<li><a href=\"\/blog\/my-projects\/wordpress-theme-toolkit-admin-menu\/2\/\">Overview<\/a> : a quick tour about features and how easy things are.<\/li>\n<li><a href=\"\/blog\/my-projects\/wordpress-theme-toolkit-admin-menu\/3\/\">Manual<\/a> : detailed features  and how-to<\/li>\n<li><a href=\"\/blog\/my-projects\/wordpress-theme-toolkit-admin-menu\/4\/\">Download !<\/a> : files and credits.<\/li>\n<li><a href=\"\/blog\/my-projects\/wordpress-theme-toolkit-admin-menu\/5\/\">Ideas and Examples<\/a> : suggestions and ideas of what you could add to your theme &#8230; and a real WordPress Theme as an example of use.<\/li>\n<\/ol>\n<p><!--nextpage--><\/p>\n<h2>What is it exactly ?<\/h2>\n<p><strong>WordPress Theme Toolkit<\/strong> is just a set of 2 PHP files you will drop into your theme directory (see Page 4 for download links)<\/p>\n<ul>\n<li><strong>themetoolkit.php<\/strong> : the class definition. You&#39;ll never need to do anything with it. Put it in the directory, forget about it.<\/li>\n<li><strong>functions.php<\/strong> : this small file contains the few things you will edit.<\/li>\n<\/ul>\n<h2>So, how easily ?<\/h2>\n<p>Ready for a 3 minutes tour ? Let&#39;s create our admin menu. Say we are working on a theme named, how original, &quot;My Neat Theme&quot;, which would sit in <em>wp-content\/themes\/mytheme<\/em>.<\/p>\n<ul>\n<li><strong>Step 1<\/strong><br \/>\nPut the required files<strong> functions.php <\/strong>and <strong>themetoolkit.php <\/strong>in your theme directory.\n<\/li>\n<li><strong>Step 2<\/strong><br \/>\nFile <strong>functions.php<\/strong> looks like this :<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">include<span style=\"color:#006600;font-weight:bold\">&#040;<\/span>dirname<span style=\"color:#006600;font-weight:bold\">&#040;<\/span>__FILE__<span style=\"color:#006600;font-weight:bold\">&#041;<\/span>.<span style=\"color:#CC0000\">'\/themetoolkit.php'<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span>;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">themetoolkit<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color:#CC0000\">'mytheme'<\/span>,<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; array<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color:#CC0000\">'option1'<\/span> =&gt; <span style=\"color:#CC0000\">'Text for Option One'<\/span>,<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color:#CC0000\">'option2'<\/span> =&gt; <span style=\"color:#CC0000\">'Text for Option Two'<\/span>,<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color:#CC0000\">'option3'<\/span> =&gt; <span style=\"color:#CC0000\">'Text for Option Two'<\/span>,<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color:#006600;font-weight:bold\">&#041;<\/span>,<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; __FILE__&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color:#006600;font-weight:bold\">&#041;<\/span>;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">?&gt;<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>First line is where the class definition is included. Nothing to edit here.<\/p>\n<p>Then, a function call with three parameters : <em>themetoolkit()<\/em>, which is passed a theme name, an array of options, and PHP predefined constant __FILE__.  Leave this last parameter untouched, edit the first two to suit your needs.\n<\/li>\n<li><strong>Step 3<\/strong><br \/>\n(This step is not required with WordPress 2.0, but is for WP 1.5 compatibility. Once the whole world will have switched to 2.0, you can just skip it !)<br \/>\nAdd this line to your template <em>header.php <\/em>:<\/p>\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php include_once<span style=\"color:#006600;font-weight:bold\">&#040;<\/span>dirname<span style=\"color:#006600;font-weight:bold\">&#040;<\/span>__FILE__<span style=\"color:#006600;font-weight:bold\">&#041;<\/span> . <span style=\"color:#CC0000\">'\/functions.php'<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span>; ?&gt;<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>Now load your blog with your theme enabled.\n<\/li>\n<\/ul>\n<p>And that&#39;s about it.<\/p>\n<h2>And what did that do ?<\/h2>\n<p>These three steps produced a few things :<\/p>\n<ul>\n<li>Now, in the Themes admin area, we have another menu added. Just like a plugin adds a menu, except that this time your theme did the job.<img decoding=\"async\" src=\"\/blog\/images\/themetoolkit\/themetoolkit_1.gif\" alt=\"Theme Toolkit : menu added !\">\n<\/li>\n<li>Let&#39;s click on this menu : here is your theme control panel ! The three lines you edited created a menu, nicely integrated within WordPress admin area, ready to accept some input from theme users. (click image to enlarge) <a href=\"\/blog\/images\/themetoolkit\/themetoolkit_2.gif\" rel=\"lightbox\"><img decoding=\"async\" src=\"\/blog\/images\/themetoolkit\/themetoolkit_2-s.gif\" alt=\"Theme Toolkit : admin menu example\"><\/a>\n<\/li>\n<\/ul>\n<h2>Now what ?<\/h2>\n<p>From now on, everything you will input in the admin menu you&#39;ve just created will be stored in a array of variables, named <strong>$mytheme->option<\/strong>. For example, if you enter in our 3 input fields the values &quot;<em>value1<\/em>&quot;, &quot;<em>43<\/em>&quot;, &quot;<em>some other text<\/em>&quot;, the following array will be available :<\/p>\n<div id=\"ig-sh-3\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">$mytheme-&gt;option['option1'] = &quot;value1&quot;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">$mytheme-&gt;option['option2'] = &quot;43&quot;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">$mytheme-&gt;option['option3'] = &quot;some other text&quot;<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>What you &quot;just&quot; have to do now is create your own functions, add features to your theme that will use these values the user can input. Look below in section &quot;Examples and Ideas&quot; to see what you could use this for.<\/p>\n<p><!--nextpage--><\/p>\n<h2>Simple syntax, detailed results<\/h2>\n<p>The syntax of options you can add into the option array, in <strong>functions.php<\/strong>, 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&#39;s make another menu with the following entries in the array of options :<\/p>\n<p><strong>Input field :<\/strong><br \/>\nRegular input field, with the text &quot;optional explanations&quot; below it.<\/p>\n<div id=\"ig-sh-4\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">'cc_number' =&gt; 'Credit Card Number ## Display it on your site.'<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p><strong>Bare Input field :<\/strong><br \/>\nWhen the option is self explanatory, trim it to the minimum.<\/p>\n<div id=\"ig-sh-5\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">'age' =&gt; 'Your age'<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p><strong>Text Area :<\/strong><br \/>\nAdding <em>{textarea|number of rows|number of columns}<\/em> create a textarea input field.<\/p>\n<div id=\"ig-sh-6\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">'politics' =&gt; 'Political Views {textarea|6|50} ## What are your views ?'<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p><strong>Radio Buttons :<\/strong><br \/>\nUse <em>{radio|value1|text1|value2|text2}<\/em> with any number of options to add radio buttons.<\/p>\n<div id=\"ig-sh-7\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">'menu' =&gt; 'Sidebar Menu on the {radio|left|Left Hand|right|Right Hand}'<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p><strong>Check Boxes :<\/strong><br \/>\nCheckbox syntax is the following : <em>{checkbox|name of variable|value of variable when checked|text}<\/em> with any number of options.<\/p>\n<div id=\"ig-sh-8\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">'blah' =&gt; 'You are ... {checkbox|is_happy|yes|Happy ?|is_human|human|Human ?} ## Check if applicable'<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p><strong>Separator :<\/strong><br \/>\nYou can add a separator line if you feel your options list gets too long.<\/p>\n<div id=\"ig-sh-9\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">'some_random_and_unique_name' =&gt; 'This is a separator {separator}'<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>The result of such an array of options would be the following admin menu (click to enlarge)<br \/>\n<a href=\"\/blog\/images\/themetoolkit\/themetoolkit_3.gif\" rel=\"lightbox\"><img decoding=\"async\" src=\"\/blog\/images\/themetoolkit\/themetoolkit_3-s.gif\" alt=\"Theme Toolkit : admin menu example\"><\/a><\/p>\n<h2>Handy to Programmers<\/h2>\n<p>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. <strong>WordPress Theme Toolkit<\/strong> come in with a handy feature called the <strong>Programmer&#39;s Corner<\/strong>.<\/p>\n<p>Just add this fake entry in your array of options :<\/p>\n<div id=\"ig-sh-10\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">'debug' =&gt; 'debug'<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>And whenever you input something in the admin menu, you will be shown the list of option variables and their values : (click to enlarge)<br \/>\n<a href=\"\/blog\/images\/themetoolkit\/themetoolkit_4.gif\" rel=\"lightbox\"><img decoding=\"async\" src=\"\/blog\/images\/themetoolkit\/themetoolkit_4-s.gif\" alt=\"Theme Toolkit : admin menu example\"><\/a><\/p>\n<h2>Nice to WordPress<\/h2>\n<p><strong>WordPress Theme Toolkit<\/strong> likes to be discreet :<br \/>\nEverything you will input in your fresh admin menu will be stored in a single entry, in WordPress&#39; option table (<em>wp_options<\/em>, most of the time). It&#39;s not like those dirty plugins who add ten entries in the database !<\/p>\n<p><strong>WordPress Theme Toolkit<\/strong> likes to be clean :<br \/>\nAdmin menu created will include a &quot;Delete&quot; option, so that when a user decides to remove your theme and clean the option table, it&#39;s just one click away.<\/p>\n<p><strong>WordPress Theme Toolkit<\/strong> likes to be smart :<br \/>\nEven if you run 10 themes that come with their own copy of <strong>WordPress Theme Toolkit<\/strong>, 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.<\/p>\n<p><strong>WordPress Theme Toolkit<\/strong> likes to be light :<br \/>\nReading options stored in your database won&#39;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.<\/p>\n<p><strong>WordPress Theme Toolkit<\/strong> likes to be compatible :<br \/>\nWordpress 2.0 and the <strong>WordPress Theme Toolkit<\/strong> 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)<\/p>\n<h2>Adding custom functions<\/h2>\n<p>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 :<\/p>\n<div id=\"ig-sh-11\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">function mytheme_creditcard () {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; global $mytheme;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; print $mytheme-&gt;option['cc_number'] ;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">}<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p><!--nextpage--><\/p>\n<h2>Download !<\/h2>\n<p>Ready to make things more accessible and customizable with your theme ? Get these two files !<\/p>\n<ul>\n<li><a href=\"http:\/\/planetozh.com\/download\/themetoolkit\/themetoolkit.txt\">themetoolkit.txt<\/a> (download and save as .php)<\/li>\n<li><a href=\"http:\/\/planetozh.com\/download\/themetoolkit\/themetoolkit.php\">themetoolkit.php<\/a> (highlighted code, copy and paste in a blank file, but do not download as is)<\/li>\n<\/ul>\n<ul>\n<li><a href=\"http:\/\/planetozh.com\/download\/themetoolkit\/functions.txt\">functions.txt<\/a> (download and save as .php)<\/li>\n<li><a href=\"http:\/\/planetozh.com\/download\/themetoolkit\/functions.php\">functions.php<\/a> (highlighted code, copy and paste in a blank file, but do not download as is)<\/li>\n<\/ul>\n<h2>Credits &#038; License<\/h2>\n<p>Once again, coding something with WordPress has been extremely pleasant and the source is so clean that it barely needs a manual. Thank you developpers, and thanks a lot to Cena for maintaining the excellent <a href=\"http:\/\/www.cenamayo.com\/wpxref\/nav.html?index.html\">WordPress Xref<\/a>.<\/p>\n<p><strong>WordPress Theme Toolkit<\/strong> is not Kubrick2 ! It&#39;s just something to help you create something as cool and featured as Kubrick 2 :)<\/p>\n<p>(As time of writing, Kubrick 2 is available as a beta, and will be shipped with an admin menu. Credits for the concept of an admin menu surely goes to Michael from Binary Bonsai who publicly wrote about it in <a href=\"http:\/\/binarybonsai.com\/archives\/2005\/06\/03\/k2-options-panel\/\">June 2005<\/a>. Ever since knowing that this theme would come with an admin menu, I decided not to have a look at it, since this was something I had planned to do for long and I wanted to get it working myself before I would look into someone else\u00e2\u20ac\u2122s code. If you dig into both codes, you&#39;ll probably find things similar, and things different.)<\/p>\n<p>The <strong>Theme Toolkit<\/strong> is free of charge and free to use. I ask for two things in return :<\/p>\n<p>First, leave the file header unmodified, so that people having a peek inside the script will know where it&#39;s from.<\/p>\n<p>Second, <strong>let me know<\/strong> about your theme ! The best way to do so is showing a little link love : blog about your new theme release and link to <a href=\"http:\/\/planetozh.com\">planetOzh<\/a>. Or even, do you <em>really<\/em> want to make my day ? Along with the traditionnal link &quot;Theme by Joe&quot; pointing to your blog or theme page, add something like :<\/p>\n<div id=\"ig-sh-12\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">HTML<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"html4strict\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">Theme by <span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">a<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;yoursite.com&quot;<\/span>&gt;<\/span>Joe<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">a<\/span>&gt;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">with a bit of<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; <span style=\"color: #009900\">&lt;<span style=\"color: #000000;font-weight: bold\">a<\/span> <span style=\"color: #000066\">href<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;http:\/\/planetozh.com\/&quot;<\/span><\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\"> &nbsp;<span style=\"color: #000066\">title<\/span><span style=\"color: #66cc66\">=<\/span><span style=\"color: #ff0000\">&quot;planetOzh : Home of Wordpress Theme Toolkit&quot;<\/span>&gt;<\/span>Ozh<span style=\"color: #009900\">&lt;<span style=\"color: #66cc66\">\/<\/span><span style=\"color: #000000;font-weight: bold\">a<\/span>&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>If you are to sell or otherwise monetize your theme, I kindly request that you do put this credit in.<\/p>\n<p><!--nextpage--><\/p>\n<h2>Suggestions<\/h2>\n<p>If you have ever installed and modified a theme to suit your likes, think of everything that could have been possible from within a simple admin menu, rather than having to edit template files.<\/p>\n<p>Here are a few examples and ideas of additionnal features, which are easy to implement if you have some PHP knowledge.<br \/>\nI will detail the array part you have to edit in functions.php, as well as the PHP function you would add at the end of this file.<\/p>\n<p><strong>Set Layout Width<\/strong><br \/>\nGiving the end user the possibility of setting his own layout width is piece of cake.<\/p>\n<ul>\n<li>Admin menu :\n<div id=\"ig-sh-13\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">array(<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; 'width' =&gt; 'Overall Width ## Set layout width'<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">);<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<\/li>\n<li>Function :\n<div id=\"ig-sh-14\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">function mytheme_width() {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; global $mytheme;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; if ( $mytheme-&gt;option['width'] ) {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; print '#wrap { width:';<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; print $mytheme-&gt;option['width'];<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; print &quot; ;}\\n&quot;;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; }<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">}<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<\/li>\n<li>Usage :<br \/>\nAssuming you have a div named &#39;wrap&#39; wrapping your layout, put the following in the &lt;head> section of header.php :<\/p>\n<div id=\"ig-sh-15\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;style type=&quot;text\/css&quot;&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php mytheme_width<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span> ?&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;\/style&gt;<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<\/li>\n<\/ul>\n<p>Similarly and as easily, you could create options and functions to set anything regarding CSS and style : font color, sidebar floating left or right, location of a header background image &#8230;<\/p>\n<p><strong>Optional Asides<\/strong><br \/>\nHaving to edit a theme&#39;s index.php to implement &quot;Asides&quot; is something that belongs to the past. Instead, you will just have the end user input the name of his Asides category in your admin menu :<\/p>\n<ul>\n<li>Admin menu :\n<div id=\"ig-sh-16\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">array(<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; 'asides' =&gt; 'Asides ## Name of your &quot;Asides&quot; category (leave empty to use none)'<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">);<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<\/li>\n<li>Function :\n<div id=\"ig-sh-17\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">function mytheme_is_asides() {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; global $mytheme;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; $categories = array ();<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; foreach((get_the_category()) as $cat) {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; $categories[] = $cat-&gt;cat_name;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; }<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; if (in_array($mytheme-&gt;option['asides'],$categories)) {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; return true;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; } else {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; return false;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; }<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">}<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<li>Usage :<br \/>\nYou would now modify &quot;The Loop&quot; in your theme&#39;s index.php like this :<\/p>\n<div id=\"ig-sh-18\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php if <span style=\"color:#006600;font-weight:bold\">&#040;<\/span>have_posts<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span> : while <span style=\"color:#006600;font-weight:bold\">&#040;<\/span>have_posts<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span> : the_post<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span>; ?&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php if <span style=\"color:#006600;font-weight:bold\">&#040;<\/span> mytheme_is_asides<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span> and !is_single<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span> <span style=\"color:#006600;font-weight:bold\">&#041;<\/span> <span style=\"color:#006600;font-weight:bold\">&#123;<\/span> ?&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &lt;!-- This post is an aside --&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &lt;div class=&quot;asides&quot;&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &lt;?php echo wptexturize<span style=\"color:#006600;font-weight:bold\">&#040;<\/span>$post-&gt;<span>post_content<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span>; ?&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &lt;a href=&quot;&lt;?php the_permalink<span style=\"color:#006600;font-weight:bold\">&#040;<\/span><span style=\"color:#006600;font-weight:bold\">&#041;<\/span> ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&amp;laquo;&lt;\/a&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &lt;\/div&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php <span style=\"color:#006600;font-weight:bold\">&#125;<\/span> else <span style=\"color:#006600;font-weight:bold\">&#123;<\/span> ?&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &lt;!-- This post is not an asides: do things normally --&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &lt;!-- Here goes your code to display posts --&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php <span style=\"color:#006600;font-weight:bold\">&#125;<\/span> ?&gt; &lt;!-- end of aside or not --&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php endwhile; else: ?&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;p&gt;Sorry, no post found.&lt;\/p&gt;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&lt;?php endif; ?&gt;<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<\/li>\n<\/ul>\n<p><strong>Setting default values<\/strong><br \/>\nYou can of course set default values so that when a user installs your theme, some values and options are already filled. To do so, add something like this at the end of your <em>functions.php<\/em><\/p>\n<div id=\"ig-sh-19\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">\/\/ default options :<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">\/* default values upon theme install *\/<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">if (!$mytheme-&gt;is_installed()) {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp;$set_defaults['some_option] = 'true';<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp;$set_defaults['other_option'] = 'hello option';<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp;$result = $mytheme-&gt;store_options($set_defaults);<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">}<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<h2>Real Live Example<\/h2>\n<p>Why not install and try a real theme that uses <strong>WordPress Theme Toolkit<\/strong> ? Go get <a href=\"http:\/\/planetozh.com\/blog\/my-projects\/wordpress-theme-minimalissimplistic\/\">Minimalissimplistic<\/a> !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In every WordPress theme there are places that are supposed to be edited and customized by the end user who is using the theme : an &quot;About you&quot; block to fill in, a loop to customize when you want to add &quot;Asides&quot; post style, some CSS to tweak to use an personal image in header, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":241,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-335","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=335"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/335\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/241"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}