Classy is a framework for building WordPress themes, based on Blade template engine. It's fast with beautiful architecture that allows you to write less code and focus more on project itself. It doesn't provide frontend boilerplate, since every project needs its own, instead it handles all architecture, providing an elegant way to separate logic from view.
Blade is the simple, yet powerful templating engine provided with Laravel. Unlike other popular PHP templating engines, Blade does not restrict you from using plain PHP code in your views. All Blade views are compiled into plain PHP code and cached until they are modified, meaning Blade adds essentially zero overhead to your application.
@extends('layout.default')
@section('content')
@if ($post)
<article>
<h1>{{ $post->title() }}</h1>
<section class="body">
{{ $post->content() }}
</section>
</article>
@endif
@stop
The biggest problem with WordPress theme development is that you always need to repeat same code. New approach, that assumes that template data will be collected and prepared separately from actual render allows you to have the project structured more accurate.
ClassyView
and ClassyScope
repeat the WordPress template hierarchy, however they do it independently. This allows to use the same scope with different templates and different scopes with the same template.
- Navigate to your WordPress themes directory
cd ~/Sites/mysite/wp-content/themes
- Clone repository
git clone git@github.com:anrw/classy.git
- Navigate to it
cd classy
- Install composer dependencies
composer install
Check our GitHub Wiki
To register a template you need simply to put {{-- Template Name: Example --}}
at the top of your blade file.
We recommend you to structure your templates in one of this ways:
- views/
page
/templatename
.blade.php - views/
template
/templatename
.blade.php - views/
template-name
/templatename
.blade.php
- WordPress: 4.5+
- PHP: 5.6+
Check WP Code Style composer cs
Check PHPMD composer md
You can report a bug, implement a feature or simply give an idea on how to make the project better. Every input from your side will be highly appreciated!
anrw | LehaMotovilov | konstantp |
Classy is under GNU General Public Licence (GPL). You can use it in your personal and commercial work.