Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Standalone version of the Sage theme layout wrapper for themes.

License

Notifications You must be signed in to change notification settings

mcaskill/wp-sage-theme-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sage Theme Wrapper for WordPress

Standalone version of the Sage Theme Wrapper for themes.

Installation

Require this package, with Composer, in the root directory of your project.

$ composer require mcaskill/sage-theme-wrapper

Usage

  1. Add base.php to your theme's directory.
  2. Add the following filter to your theme's functions.php:

Example #1:

<?php

add_filter('template_include', [ '\\Roots\\Sage\\Wrapper', 'wrap'], 109);

Example #2:

<?php

use Roots\Sage\Wrapper as W;

add_filter('template_include', function ($main) {
    // Check for other filters returning null
    if (!is_string($main)) {
        return $main;
    }

    W::$main_template = $main;
    W::$base = basename(W::$main_template, '.php');

    if (W::$base === 'index') {
        W::$base = false;
    }

    return new W('layouts/base.php');
}, 109);

Credits

All credits & copyrights belongs to people behind Sage.

About

Standalone version of the Sage theme layout wrapper for themes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages