이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

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

설치

  1. Upload folder blade to the /wp-content/plugins/ directory
  2. 워드프레스의 ‘플러그인’ 메뉴에서 플러그인을 활성화하세요.
  3. Make sure that /wp-content/plugins/blade/storage/views/ is writable by php
  4. Done! You can now use Blade in your theme

More options

It is recommended thay you change the path to the location where the compiled views are stored to within your theme. This will fix problems with wpml. To do so, put the following code in your theme folder and create the folder/directory “bladecache” in your theme folder.
if(function_exists(‘blade_set_storage_path’)){
blade_set_storage_path(get_template_directory().’/bladecache’);
}

후기

2018년 12월 1일
I've used this plugin for a large amount of websites, unfortunately it seems it's not being updated and I got an error in PHP 7.2. 4 Stars for making my develop life much easier, could had 5 stars if there was an regular update of the plugin. I'm now making a switch to Timber (Twig)
모든 7 평가 읽기

기여자 & 개발자

“Blade”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “Blade”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

0.3.7

  • Added support for BuddyPress

0.3.6

  • Fixed bug with incorrectly appending to unitialized variable. (perholmang)
  • Fixed issues when using multiple @section. (perholmang)

0.3.5

  • Added support for child/parent-themes (perholmang)

0.3.4

  • Added acf repeater (jaggyspaghetti)

0.3.3

  • Compatibility update for PHP 5.5 (relu)

0.3.2

  • Added @wpposts (mykebates)

0.3.1

  • Changed the structure of all files. (PabloVallejo)

0.2.0

  • The view templates are now loaded differently.
  • Better errorhandling.
  • Added possibility to change the storage path.

0.1.1

  • Added a fix for plugins that import the template file directly using the template path fetched using get_query_template() like WP e-Commerce;

0.1.0

  • initial (beta)