<?php
/*
File Name: Wordpress Theme Toolkit Implementation for Theme Minimalissimplistic
Version: 1.0
Author: Ozh
Author URI: http://planetOzh.com/
*/
/************************************************************************************
* THEME USERS : don't touch anything !! Or don't ask the theme author for support :)
************************************************************************************/
include(dirname(__FILE__).'/themetoolkit.php');
/************************************************************************************
* THEME AUTHOR : edit the following function call :
************************************************************************************/
themetoolkit(
'mytheme', /* Make yourself at home :
* Name of the variable that will contain all the options of
* your theme admin menu (in the form of an array)
* Name it according to PHP naming rules (http://php.net/variables) */
array( /* Variables used by your theme features (i.e. things the end user will
* want to customize through the admin menu)
* Syntax :
* 'option_variable' => 'Option Title ## optionnal explanations',
* 'option_variable' => 'Option Title {radio|value1|Text1|value2|Text2} ## optionnal explanations',
* 'option_variable' => 'Option Title {textarea|rows|cols} ## optionnal explanations',
* 'option_variable' => 'Option Title {checkbox|option_var1|value1|Text1|option_var2|value2|Text2} ## optionnal explanations',
* Examples :
* 'your_age' => 'Your Age',
* 'cc_number' => 'Credit Card Number ## I can swear I will not misuse it :P',
* 'gender' => 'Gender {radio|girl|You are a female|boy|You are a male} ## What is your gender ?'
* Dont forget the comma at the end of each line ! */
'width' => 'Overall Width ## Set layout width. Can be pixels, em or percent ("700px", "80%", "56em"). Using em\'s will make the design <em>elastic</em> (too small values can break layout in IE)',
'floatbar' => 'Sidebar Menu on the {radio|left|Left Hand|right|Right Hand}',
'textcolor' => 'Text color ## Enter an HTML color ("red", "#abc", "#a1b2c3", etc...)',
'bgcolor' => 'Page background color',
'wrapcolor' => 'Layout background color',
'asides' => 'Asides ## Name of the category for posts that are displayed as "<a href="http://codex.wordpress.org/Adding_Asides">Asides</a>" <br>(Leave empty to display all posts normally)',
'says' => 'Comment Replies {textarea|6|50} ## New line separated list of synomyms of the word "says", to display readers\' comments (the "<em>nick says</em>" part)',
'debug' => 'debug', /* this is a fake entry that will activate the "Programmer's Corner"
* showing you vars and values while you build your theme. Remove it
* when your theme is ready for shipping */
),
__FILE__ /* Parent. DO NOT MODIFY THIS LINE !
* This is used to check which file (and thus theme) is calling
* the function (useful when another theme with a Theme Toolkit
* was installed before */
);
/************************************************************************************
* THEME AUTHOR : Congratulations ! The hard work is all done now :)
*
* From now on, you can create functions for your theme that will use the array
* of variables $mytheme->option. For example there will be now a variable
* $mytheme->option['your_age'] with value as set by theme end-user in the admin menu.
************************************************************************************/
/***************************************
* Additionnal Features and Functions for
* Theme 'minimalissimplistic'
*
* Create your own functions using the array
* of user defined variables $mytheme->option.
* An example of function could be :
*
* function creditcard() {
* global $mytheme;
* print "My Credit Card Number is : ";
* print $mytheme->option['creditcard'];
* }
*
**************************************/
/* mytheme_about
use <?php mytheme_about() ?> to print either what the author
wrote in his profile (Admin Area, Users page), or a friendly
message if nothing has been filled in.
*/
function mytheme_about() {
if (get_the_author_description()) {
print get_the_author_description();
} else {
print "The author does not say much about himself";
}
}
/* mytheme_is_asides
If an Aside category has been specified, returns TRUE
when a post belongs to this category, FALSE otherwise
Usage :
<?php if (mytheme_is_asides()) { ?>
html & php if aside
<?php } else { ?>
html & php if not aside
<?php } ?>
*/
function mytheme_is_asides() {
global $mytheme;
$categories = array ();
/* get all categories for the post we are processing */
foreach((get_the_category()) as $cat) {
$categories[] = $cat->cat_name;
}
/* is one of these categories the same as our Asides cat ? */
if (in_array($mytheme->option['asides'],$categories)) {
return true;
} else {
return false;
}
}
/* mytheme_sidebar()
Prints css style according to what has been defined
in the admin pannel
*/
function mytheme_sidebar() {
global $mytheme;
if ($mytheme->option['floatbar'] == 'right') {
echo '
/* Menu on the Right */
#content {float: left;}
#menu {float: right;}
';
} else {
echo '
/* Menu of the Left */
#content {float: right;}
#menu {float: left;}
';
}
}
/* mytheme_width()
Prints css style according to what has been defined
in the admin pannel
*/
function mytheme_width() {
global $mytheme;
if ( $mytheme->option['width'] ) print '#wrap{width:' .$mytheme->option['width']." ;}\n";
}
/* mytheme_colors()
Prints css style according to what has been defined
in the admin pannel
*/
function mytheme_colors() {
global $mytheme;
if ( $mytheme->option['textcolor'] or $mytheme->option['bgcolor'] ) print "body {\n";
if ($mytheme->option['textcolor']) print 'color: '. $mytheme->option['textcolor'] . ";\n";
if ($mytheme->option['bgcolor']) print 'background: '. $mytheme->option['bgcolor'] .";\n";
if ($mytheme->option['textcolor'] or $mytheme->option['bgcolor']) print "}\n";
if ($mytheme->option['textcolor']) print 'a{color: '. $mytheme->option['textcolor'] . ";}\n";
if ($mytheme->option['wrapcolor']) print '#wrap{background: '. $mytheme->option['wrapcolor'] . ";}\n";
}
/* mytheme_says()
Print a random element of the list defined in the admin pannel
Use it to replace "Someone says" with "Someone thought", "Someone
wrote", "Someone declared that", etc...
*/
function mytheme_says() {
global $mytheme;
if (!$mytheme->option['says']) {
print "Says";
} else {
srand((float) microtime()*1000000);
$replies = split("\n",$mytheme->option['says']);
print (trim($replies[rand(1,count($replies)-1)],"\r\n"));
}
}
?>
Return to listing of minimalissimplistic.zip