Formatting, adding/updating links

This commit is contained in:
Ben Word
2013-11-07 21:28:52 -06:00
parent e362daecf2
commit 840ee637bf
14 changed files with 23 additions and 21 deletions

View File

@@ -2,6 +2,7 @@
/**
* Theme wrapper
*
* @link http://roots.io/an-introduction-to-the-roots-theme-wrapper/
* @link http://scribu.net/wordpress/theme-wrappers.html
*/
function roots_template_path() {
@@ -19,21 +20,21 @@ class Roots_Wrapping {
// Stores the base name of the template file; e.g. 'page' for 'page.php' etc.
static $base;
public function __construct($template='base.php') {
public function __construct($template = 'base.php') {
$this->slug = basename($template, '.php');
$this->templates = array($template);
if (self::$base) {
$str = substr($template, 0, -4);
array_unshift($this->templates, sprintf($str . '-%s.php', self::$base));
}
}
public function __toString() {
$this->templates = apply_filters('roots_wrap_' . $this->slug, $this->templates);
return locate_template($this->templates);
}
static function wrap($main) {
self::$main_template = $main;
self::$base = basename(self::$main_template, '.php');
@@ -41,7 +42,7 @@ class Roots_Wrapping {
if (self::$base === 'index') {
self::$base = false;
}
return new Roots_Wrapping();
}
}