Content of functions.php from minimalissimplistic.zip

without / with line numbers
  1. <?php
    
  2. /*
    
  3. File Name: Wordpress Theme Toolkit Implementation for Theme Minimalissimplistic
    
  4. Version: 1.0
    
  5. Author: Ozh
    
  6. Author URI: http://planetOzh.com/
    
  7. */
    
  8. 
    
  9. /************************************************************************************
    
  10.  * THEME USERS : don't touch anything !! Or don't ask the theme author for support :)
    
  11.  ************************************************************************************/
    
  12. 
    
  13. include(dirname(__FILE__).'/themetoolkit.php');
    
  14. 
    
  15. /************************************************************************************
    
  16.  * THEME AUTHOR : edit the following function call :
    
  17.  ************************************************************************************/
    
  18. 
    
  19. themetoolkit(
    
  20.     'mytheme', /* Make yourself at home :
    
  21.                     * Name of the variable that will contain all the options of
    
  22.                     * your theme admin menu (in the form of an array)
    
  23.                     * Name it according to PHP naming rules (http://php.net/variables) */
    
  24. 
    
  25.     array(     /* Variables used by your theme features (i.e. things the end user will
    
  26.                     * want to customize through the admin menu)
    
  27.                      * Syntax :
    
  28.                     * 'option_variable' => 'Option Title ## optionnal explanations',
    
  29.                     * 'option_variable' => 'Option Title {radio|value1|Text1|value2|Text2} ## optionnal explanations',
    
  30.                     * 'option_variable' => 'Option Title {textarea|rows|cols} ## optionnal explanations',
    
  31.                     * 'option_variable' => 'Option Title {checkbox|option_var1|value1|Text1|option_var2|value2|Text2} ## optionnal explanations',
    
  32.                     * Examples :
    
  33.                     * 'your_age' => 'Your Age',
    
  34.                     * 'cc_number' => 'Credit Card Number ## I can swear I will not misuse it :P',
    
  35.                     * 'gender' => 'Gender {radio|girl|You are a female|boy|You are a male} ## What is your gender ?'
    
  36.                     * Dont forget the comma at the end of each line ! */
    
  37.     '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)',
    
  38.     'floatbar' => 'Sidebar Menu on the {radio|left|Left Hand|right|Right Hand}',
    
  39.     'textcolor' => 'Text color ## Enter an HTML color ("red", "#abc", "#a1b2c3", etc...)',
    
  40.     'bgcolor' => 'Page background color',
    
  41.     'wrapcolor' => 'Layout background color',
    
  42.     '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)',
    
  43.     '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)',
    
  44.     'debug' => 'debug',     /* this is a fake entry that will activate the "Programmer's Corner"
    
  45.                                  * showing you vars and values while you build your theme. Remove it
    
  46.                                  * when your theme is ready for shipping */
    
  47.     ),
    
  48.     __FILE__     /* Parent. DO NOT MODIFY THIS LINE !
    
  49.                   * This is used to check which file (and thus theme) is calling
    
  50.                   * the function (useful when another theme with a Theme Toolkit
    
  51.                   * was installed before */
    
  52. );
    
  53.     
    
  54. /************************************************************************************
    
  55.  * THEME AUTHOR : Congratulations ! The hard work is all done now :)
    
  56.  *
    
  57.  * From now on, you can create functions for your theme that will use the array
    
  58.  * of variables $mytheme->option. For example there will be now a variable
    
  59.  * $mytheme->option['your_age'] with value as set by theme end-user in the admin menu.
    
  60.  ************************************************************************************/
    
  61. 
    
  62. /***************************************
    
  63.  * Additionnal Features and Functions for
    
  64.  * Theme 'minimalissimplistic'
    
  65.  *
    
  66.  * Create your own functions using the array
    
  67.  * of user defined variables $mytheme->option.
    
  68.  * An example of function could be :
    
  69.  *
    
  70.  * function creditcard() {
    
  71.  *        global $mytheme;
    
  72.  *        print "My Credit Card Number is : ";
    
  73.  *     print $mytheme->option['creditcard'];
    
  74.  * }
    
  75.  *
    
  76.  **************************************/
    
  77. 
    
  78. /* mytheme_about
    
  79.     use <?php mytheme_about() ?> to print either what the author
    
  80.     wrote in his profile (Admin Area, Users page), or a friendly
    
  81.     message if nothing has been filled in.
    
  82. */
    
  83. function mytheme_about() {
    
  84.     if (get_the_author_description()) {
    
  85.         print get_the_author_description();
    
  86.     } else {
    
  87.         print "The author does not say much about himself";
    
  88.     }
    
  89. }
    
  90. 
    
  91. 
    
  92. /* mytheme_is_asides
    
  93.     If an Aside category has been specified, returns TRUE
    
  94.     when a post belongs to this category, FALSE otherwise
    
  95.     Usage :
    
  96.     <?php if (mytheme_is_asides()) { ?>
    
  97.          html & php if aside
    
  98.     <?php } else { ?>
    
  99.          html & php if not aside
    
  100.     <?php } ?>
    
  101. */
    
  102. function mytheme_is_asides() {
    
  103.         global $mytheme;
    
  104.         $categories = array ();
    
  105.         /* get all categories for the post we are processing */
    
  106.         foreach((get_the_category()) as $cat) {
    
  107.             $categories[] = $cat->cat_name;
    
  108.         }
    
  109.         /* is one of these categories the same as our Asides cat ? */
    
  110.         if (in_array($mytheme->option['asides'],$categories)) {
    
  111.                 return true;
    
  112.         } else {
    
  113.                 return false;
    
  114.         }
    
  115. }
    
  116. 
    
  117. 
    
  118. /* mytheme_sidebar()
    
  119.     Prints css style according to what has been defined
    
  120.     in the admin pannel
    
  121. */
    
  122. function mytheme_sidebar() {
    
  123.     global $mytheme;
    
  124.     if ($mytheme->option['floatbar'] == 'right') {
    
  125.         echo '
    
  126.         /* Menu on the Right */
    
  127.         #content {float: left;}
    
  128.         #menu {float: right;}
    
  129.         ';
    
  130.     } else {
    
  131.         echo '
    
  132.         /* Menu of the Left */
    
  133.         #content {float: right;}
    
  134.         #menu {float: left;}
    
  135.         ';
    
  136.     }    
    
  137. }
    
  138. 
    
  139. 
    
  140. /* mytheme_width()
    
  141.     Prints css style according to what has been defined
    
  142.     in the admin pannel
    
  143. */
    
  144. function mytheme_width() {
    
  145.     global $mytheme;
    
  146.     if ( $mytheme->option['width'] ) print '#wrap{width:' .$mytheme->option['width']." ;}\n";
    
  147. }
    
  148. 
    
  149. 
    
  150. /* mytheme_colors()
    
  151.     Prints css style according to what has been defined
    
  152.     in the admin pannel
    
  153. */
    
  154. function mytheme_colors() {
    
  155.     global $mytheme;
    
  156.     if ( $mytheme->option['textcolor'] or $mytheme->option['bgcolor'] ) print "body {\n";
    
  157.         if ($mytheme->option['textcolor']) print 'color: '. $mytheme->option['textcolor'] . ";\n";
    
  158.         if ($mytheme->option['bgcolor']) print 'background: '. $mytheme->option['bgcolor'] .";\n";
    
  159.     if ($mytheme->option['textcolor'] or $mytheme->option['bgcolor']) print "}\n";
    
  160.     if ($mytheme->option['textcolor']) print 'a{color: '. $mytheme->option['textcolor'] . ";}\n";
    
  161.     if ($mytheme->option['wrapcolor']) print '#wrap{background: '. $mytheme->option['wrapcolor'] . ";}\n";
    
  162. }
    
  163. 
    
  164. 
    
  165. /* mytheme_says()
    
  166.     Print a random element of the list defined in the admin pannel
    
  167.     Use it to replace "Someone says" with "Someone thought", "Someone
    
  168.     wrote", "Someone declared that", etc...
    
  169. */
    
  170. function mytheme_says() {
    
  171.     global $mytheme;
    
  172.     if (!$mytheme->option['says']) {
    
  173.         print "Says";
    
  174.     } else {
    
  175.         srand((float) microtime()*1000000);
    
  176.         $replies = split("\n",$mytheme->option['says']);
    
  177.         print (trim($replies[rand(1,count($replies)-1)],"\r\n"));
    
  178.     }
    
  179. }
    
  180. 
    
  181. ?>
  182.  

Return to listing of minimalissimplistic.zip