by Mikael Mattsson on WordPress.org
Brings Laravel's great template engine, Blade, to Wordpress. Just install and start using blade in your theme.
Blade is the template engine for Laravel, a very popular php framework, developed by Taylor Otwell. This plugin brings the same template engine to wordpress.
Using a template engine will result in much cleaner template files and quicker development. Normal php can still be used in the template files.
The plugin also adds a wordpress specific snippet to blade. Check out the examples for more info.
{{$foo}}
Turns into…
@if(has_post_thumbnail())
{{the_post_thumbnail() }}
@else
@endif
Turns into…
{{the_title()}}
@wpempty
404
@wpendTurns into…
{{the_title()}} @wpempty
Turns into….
To include a file with blade use:
@include(‘header’)
Note that you should not type “.php”. Files included with functions, e.g. the_header(), will not be compiled by Blade, however the php code in the file is still executed.
master.php:
@yield(‘content’)
page.php:
@layout(‘master’)
@section('content')
Lorem ipsum
@endsection
See the Blade documentation for more info.
Contribute on github: github.com/MikaelMattsson/blade