Site icon Graph Paper Press

Announcing the Base Theme Framework for WordPress

Base WordPress Theme
Base WordPress Theme

Today we are happy to release our latest paid theme, Base, into the wild. Base is a minimally-styled, feature rich, theme framework built specifically to power child themes. It includes an application framework, a theme options framework and support for all the latest and greatest WordPress features.

This release marks a significant milestone in our theme development and it has been guided by these goals: To bring our customers more themes, quicker and make theme upgrades a breeze.  Two child themes, Uno and Sidewinder, will be released in the coming days that will show the flexibility and versatility of the Base theme framework.

Development Philosophy

Built To Power Child Themes

Base was built specifically with child theming in mind.  A Base child theme might merely consist of a stylesheet (style.css) and a functions file (functions.php) containing hooks.  Base’s unique approach to apps, theme options and hooks simplifies and streamlines the process of child theme development so we can bring you more themes, faster.

Application Framework

One of the most unique features in Base is the application framework.  New applications such as a Slideshow, Slider or Category Columns have become transportable, self-contained “apps” that can be loaded either directly inside child themes or via plugins.  Certain child themes will contain certain apps and these apps can be easily transported into other child themes or a new child theme that you create.  All apps contain theme options and can be sorted with a simple drag-drop interface to create the design you desire.

Theme Options Framework

Creating theme options is the most difficult part of theme development.  More options means more code.  More code means more complexities.  More complexities means it takes us longer to develop new themes.  Our goal with Base was to create efficiencies in how theme options are created and modified in child themes.  Using filter hooks, adding new options to either Base or a Base child theme is very simple.  For example, the following snippet could be added in your functions.php file of a child theme to add more theme options to control design elements contained in a child theme:

<?php

global $gpp_base_child_options, $hello;
if(!isset($hello)) {$hello = "false" ;}
$shortname = "gpp_base";

$options = array();

$options[] = array(	"name" => "Hello",
					"type" => "heading");

$options[] = array(	"name" => "Turn on",
					"desc" => "Check this to show a hello message on the homepage.",
					"id" => $shortname."_hello",
					"std" => $hello,
					"type" => "checkbox");

$options[] = array(	"name" => "Hello Message",
					"desc" => "Enter your hello message",
					"id" => $shortname."_hello_message",
					"std" => "",
					"type" => "textarea",
					"pid" => $shortname."_hello pid");

$options[] = array( "name" => "Hello Category" ,
					"desc" => "",
					"id" => $shortname."_hello_cat",
					"std" => "",
					"type" => "select",
					"options" => $categories,
					"pid" => $shortname."_hello pid");

$gpp_base_child_options = array_merge($gpp_base_child_options,$options);
?>

In the code above, we’ve essentially add three things to the theme options page:

  1. A new option section called Hello
  2. A new checkbox option to show or hide the Hello message
  3. A new textarea field for the hello message. This option is only shown if the Hello checkbox is checked. The option dependency is specified using this:
    "pid" => $shortname."_hello pid");
  4. A select box containing a list of all categories used in your site. This option is only shown if the Hello checkbox is checked. The option dependency is specified using this:
    "pid" => $shortname."_hello pid");

Now that we have added some new options, lets check these options and then do some stuff if the option is turned on:

<?php

function gpp_base_slider_include() {
	global $gpp;
	$hello_cat_ID = get_option('gpp_base_hello_cat');
	$hello_cat = get_cat_name($hello_cat_ID);

	echo 'Hello is turned on!';
        if($gpp['gpp_base_hello_message'] <> ""){
            echo stripslashes(stripslashes($gpp['gpp_base_hello_message']));
        } else {
            _e('You haven't entered a hello message');
        }
	echo 'The Hello category is '.$slider_cat_ID;

}

if((isset($gpp['gpp_base_slider']) && $gpp['gpp_base_slider']=='true') || $gpp === FALSE) {
	add_action('gpp_base_apps', 'gpp_base_slider_include');
}

?>

Don’t worry if the above code seems intimidating; it’s primarily for WordPress developers. We’re doing this stuff for you in our child themes.

Action Hooks & Filter Hooks

This section will probably only be useful for theme developers, but it should give all readers a better idea as to why we refer to Base as a theme framework built specifically for powering child themes.

View the documentation on the hooks used in Base.

When added to child themes, hooks provide theme developers with ways to dramatically change the design and functionality of parent themes (Base).  A child theme might merely consist of a stylesheet (style.css) and a functions file (functions.php) containing hooks.

Support For Latest WordPress Features

Base support these features, plus many more, in WordPress (currently at version 3.0.3 at the time of this posting):

Exit mobile version