What is it exactly ?
Wordpress Theme Toolkit is just a set of 2 PHP files you will drop into your theme directory (see Page 4 for download links)
- themetoolkit.php : the class definition. You'll never need to do anything with it. Put it in the directory, forget about it.
- functions.php : this small file contains the few things you will edit.
So, how easily ?
Ready for a 3 minutes tour ? Let's create our admin menu. Say we are working on a theme named, how original, "My Neat Theme", which would sit in wp-content/themes/mytheme.
- Step 1
Put the required files functions.php and themetoolkit.php in your theme directory. - Step 2
File functions.php looks like this :CODE:-
<?php
-
include(dirname(__FILE__).'/themetoolkit.php');
-
-
themetoolkit(
-
'mytheme',
-
-
array(
-
'option1' => 'Text for Option One',
-
'option2' => 'Text for Option Two',
-
'option3' => 'Text for Option Two',
-
),
-
-
__FILE__
-
-
);
-
?>
First line is where the class definition is included. Nothing to edit here.
Then, a function call with three parameters : themetoolkit(), 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.
-
- Step 3
(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 !)
Add this line to your template header.php :CODE:-
<?php include_once(dirname(__FILE__) . '/functions.php'); ?>
Now load your blog with your theme enabled.
-
And that's about it.
And what did that do ?
These three steps produced a few things :
- 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.
- Let'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)
Now what ?
From now on, everything you will input in the admin menu you've just created will be stored in a array of variables, named $mytheme->option. For example, if you enter in our 3 input fields the values "value1", "43", "some other text", the following array will be available :
-
$mytheme->option['option1'] = "value1"
-
$mytheme->option['option2'] = "43"
-
$mytheme->option['option3'] = "some other text"
What you "just" 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 "Examples and Ideas" to see what you could use this for.
Related posts
Page: #1 #2 #3 #4 #5Metastuff
148 Blablas
Pages: « 1 2 3 4 5 6 7 [8] Show All
Pages: « 1 2 3 4 5 6 7 [8] Show All
said, on 29/Jun/08 at 11:08 am # :
Just wanted to say thank you for that wonderful Kit.
pingback on 01/Jul/08 at 11:07 am # :
[...] Theme ToolKit [...]
pingback on 01/Jul/08 at 1:28 pm # :
[...] Wordpress Theme Toolkit « planetOzh [...]
pingback on 03/Jul/08 at 4:54 am # :
[...] pensado liberar el theme WP-Resurrection pero como queria añadirle algunas opciones intente usar Wordpress Theme Toolkit pero tuve algunos errores con el y la verdad no soy tan experto en PHP como para arreglarlo. [...]
pingback on 04/Jul/08 at 5:41 am # :
[...] their latest sketch shoved down the throat of their visitors. With some help from planetOzh’s Theme Toolkit, I put together a YouTube embed box that can be easily changed from the admin [...]
pingback on 09/Jul/08 at 12:32 pm # :
[...] Theme Toolkit Puede ser el mas conocido de todos, Lo use en versiones anteriors de wordpress, pero ahora me da error. Puede ser por mi poco conocimiento de PHP, pero es muy bueno! [...]
thought, on 14/Jul/08 at 9:12 pm # :
i cant do it.
pingback on 19/Jul/08 at 8:23 pm # :
[...] Theme ToolKit [...]