Brings Laravel's great template engine, Blade, to Wordpress. Just install and start using blade in your theme.
평가
4
최근 업데이트일
December 1, 2015
버전
0.3.7
활성화된 설치 항목
300
Blade

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 <img src="{{bloginfo( 'template_url' )}}/images/thumbnail-default.jpg" /> @endif

Turns into…

<img src="/images/thumbnail-default.jpg” />

the loop

@wpposts <a href="{{the_permalink()}}">{{the_title()}}</a><br> @wpempty <p>404</p> @wpend

Turns into…

<a href="”>

404

wordpress query

<ul> @wpquery(array('post_type' => 'post')) <li><a href="{{the_permalink()}}">{{the_title()}}</a></li> @wpempty <li>{{ __('Sorry, no posts matched your criteria.') }}</li> @wpend </ul>

Turns into….

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

  • <a href="”>

Advanced Custom Fields

<ul> @acfrepeater('images') <li>{{ get_sub_field( 'image' ) }}</li> @acfend </ul>

Turns into…

  • <img src="” />

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.

레이아웃

master.php:

@yield(‘content’)

page.php: @layout(‘master’)

@section('content') <p>Lorem ipsum</p> @endsection

See the Blade documentation for more info.

Contribute on github: github.com/MikaelMattsson/blade

무료Creator 요금제에서
활성화된 설치 항목
300
테스트된 버전
3.9.40
이 플러그인은 다운로드 가능하며 워드프레스 독립 호스트 설치에 사용할 수 있습니다.