Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 792 Bytes

templates.md

File metadata and controls

25 lines (19 loc) · 792 Bytes

Templates

Using Templates

On Posts, Pages, and Custom Post Types, designate available templates with the static getAvailableTemplates method. Post template values are available in views with the $__template variable.

class Project extends Post implements CustomPostType
{
    public static function getAvailableTemplates() {
        return ['one-column', 'two-column'];
    }

Easily switch between templates and custom pages below with this in your blade file. Just add blade files named after your available templates in the resources/template folder. (i.e.: one-column.blade.php and two-column.blade.php)

@if (isset($__template))
    @include('template.' . $__template)
@else
    @yield('content')
@endif