Giter VIP home page Giter VIP logo

classy's Introduction

alt tag

Scrutinizer Code Quality Build Status

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.

Why Blade?

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.

Code example:
@extends('layout.default')

@section('content')
	@if ($post)
		<article>
			<h1>{{ $post->title() }}</h1>
			
			<section class="body">
				{{ $post->content() }}
			</section>
		</article>
	@endif
@stop

What’s about structure?

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.

alt tag

How it works?

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.

Example of project structure

alt tag

Getting started

  1. Navigate to your WordPress themes directory cd ~/Sites/mysite/wp-content/themes
  2. Clone repository git clone [email protected]:anrw/classy.git
  3. Navigate to it cd classy
  4. Install composer dependencies composer install

Config file

Check our GitHub Wiki

Page Templates

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:

  1. views/page/templatename.blade.php
  2. views/template/templatename.blade.php
  3. views/template-name/templatename.blade.php

Useful links

  1. Blade documentation
  2. WordPress Code Style
  3. PHP Mess Detector

Requirements:

  • WordPress: 4.5+
  • PHP: 5.6+

How to check php code style

Check WP Code Style composer cs

How to run static code analyzer

Check PHPMD composer md

Contribute

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!

Big thanks to:

anrw LehaMotovilov konstantp
anrw LehaMotovilov konstantp

License

Classy is under GNU General Public Licence (GPL). You can use it in your personal and commercial work.

classy's People

Contributors

lehamotovilov avatar webdeveric avatar septembermd avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.