Rework template wrapper, bring back template_part()

This commit is contained in:
QWp6t
2016-07-15 05:31:02 -07:00
parent 0a71544b83
commit eb3a7add85
8 changed files with 130 additions and 109 deletions

View File

@@ -37,24 +37,24 @@ class Wrapper implements WrapperInterface
*/
public function __toString()
{
return $this->getTemplate();
return $this->unwrap();
}
/** {@inheritdoc} */
public function getWrapper()
public function wrap()
{
$wrappers = apply_filters('sage/wrap_' . $this->slug, $this->wrapper) ?: $this->wrapper;
return locate_template($wrappers);
}
/** {@inheritdoc} */
public function getSlug()
public function slug()
{
return $this->slug;
}
/** {@inheritdoc} */
public function getTemplate()
public function unwrap()
{
$template = apply_filters('sage/unwrap_' . $this->slug, $this->template) ?: $this->template;
return locate_template($template) ?: $template;