Home Plugins blade
Blade logo

Blade

by Mikael Mattsson on WordPress.org

Brings Laravel's great template engine, Blade, to Wordpress. Just install and start using blade in your theme.

(7)

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.

echo/print

{{$foo}}

Turns into…

if()

@if(has_post_thumbnail())
    {{the_post_thumbnail() }}
@else 
    
@endif

Turns into…

{{the_title()}}
@wpempty

404

@wpend

Turns into…

{{the_title()}} @wpempty

  • {{ __('Sorry, no posts matched your criteria.') }}
  • @wpend

    Turns into….

      ‘post’) ); ?>
      have_posts() ) : ?>
      have_posts() ) : $query->the_post(); ?>

    Including other templates

    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.

    Layouts

    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

    Active installations300+
    Weekly downloads
    17-10.53%
    Version0.3.7
    Last updated12/1/2015
    WordPress version3.0.0
    Tested up to3.9.40
    Tags
    BladeengineLaraveltemplate