All Projects → Rarst → Meadow

Rarst / Meadow

Licence: mit
WordPress templating DSL based on Twig.

Projects that are alternatives of or similar to Meadow

Lumberjack
Lumberjack is a powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code.
Stars: ✭ 261 (+257.53%)
Mutual labels:  wordpress, twig
Sugar
Some bonus functionality for Timber
Stars: ✭ 44 (-39.73%)
Mutual labels:  wordpress, twig
Timber
Create WordPress themes with beautiful OOP code and the Twig Template Engine
Stars: ✭ 4,952 (+6683.56%)
Mutual labels:  wordpress, twig
Generator Baukasten
Awesome!
Stars: ✭ 50 (-31.51%)
Mutual labels:  wordpress, twig
Planet4 Master Theme
Wordpress master theme for the Greenpeace Planet 4 project
Stars: ✭ 34 (-53.42%)
Mutual labels:  wordpress, twig
Generator Kittn
The Yeoman Kittn Generator
Stars: ✭ 63 (-13.7%)
Mutual labels:  wordpress, twig
Wp Gistpen
A self-hosted alternative to putting your code snippets on Gist.
Stars: ✭ 67 (-8.22%)
Mutual labels:  wordpress
Wordpress Plugin Installer
A PHP class for installing and activating WordPress plugins.
Stars: ✭ 69 (-5.48%)
Mutual labels:  wordpress
Twig Cache Extension
Stars: ✭ 67 (-8.22%)
Mutual labels:  twig
Wpdatetime
Extension of PHP’s DateTime and DateTimeZone classes for WordPress context.
Stars: ✭ 66 (-9.59%)
Mutual labels:  wordpress
Wp Pro Quiz
Wordpress WP-Pro-Quiz Plugin (Official)
Stars: ✭ 72 (-1.37%)
Mutual labels:  wordpress
Slim3
Slim Framework 3 Skeleton Application
Stars: ✭ 70 (-4.11%)
Mutual labels:  twig
Ext
WP-CLI command which checks the existence of PHP extensions needed to run WordPress.
Stars: ✭ 69 (-5.48%)
Mutual labels:  wordpress
Acf To Rest Api
Exposes Advanced Custom Fields Endpoints in the WordPress REST API
Stars: ✭ 1,152 (+1478.08%)
Mutual labels:  wordpress
Wp Missed Schedule
Find only missed schedule posts, every 15 minutes, and republish correctly 10 items each session. The Original plugin (only this) no longer available on WordPress.org for explicit author request! Compatible with WP 2.1+ to 4.9+ and 5.0-beta3 (100.000+ installs 300.000+ downloads 2016-04-13) Please: do not install unauthorized malware cloned forked!
Stars: ✭ 69 (-5.48%)
Mutual labels:  wordpress
Gulp Wp Pot
Gulp plugin to generate pot file for WordPress plugins and themes
Stars: ✭ 67 (-8.22%)
Mutual labels:  wordpress
Kirki
Extending the customizer
Stars: ✭ 1,175 (+1509.59%)
Mutual labels:  wordpress
Fail2ban.webexploits
This custom Fail2Ban filter and jail will deal with all scans for common Wordpress, Joomla and other Web Exploits being scanned for by automated bots and those seeking to find exploitable web sites.
Stars: ✭ 67 (-8.22%)
Mutual labels:  wordpress
Query Monitor
The Developer Tools Panel for WordPress
Stars: ✭ 1,156 (+1483.56%)
Mutual labels:  wordpress
My Custom Functionality
A basic starter plugin to load assets like CSS and JS files in WordPress.
Stars: ✭ 70 (-4.11%)
Mutual labels:  wordpress

Meadow — WordPress Templating DSL

Write WordPress theme templates with familiar ease and modern features.

Scrutinizer Code Quality Version PHP required PDS Skeleton

Meadow is a theme templating solution, aiming to find a balance between native WordPress concepts and power of Twig dedicated templating language.

Installation

Require package in your theme project with Composer:

composer require rarst/meadow

Instantiate object some time during theme load:

$meadow = new \Rarst\Meadow\Core;
$meadow->enable();

Templating

Meadow follows conventions of WordPress template hierarchy:

  • for example index.php becomes index.twig.
  • {{ get_header() }} will look for header.twig (with fallback to header.php)
  • and so on.

Template Tags

Template Tags API (and PHP functions in general) are set up to work transparently from Twig templates:

{{ the_title() }}

Filters

WordPress filters set up to be available as Twig filters:

{{ 'This is the title'|the_title }}

Template Inheritance

Full range of Twig functionality is naturally available, including template inheritance:

{# single.twig #}
{% extends 'index.twig' %}

{% block entry_title %}
	<div class="page-header">{{ parent() }}</div>
{% endblock %}

To inherit parent template in child theme prepend it with folder's name:

{# child-theme/index.twig #}
{% extends 'parent-theme/index.twig' %}

Domain Specific Language

Meadow attempts not just "map" WordPress to Twig, but also meaningfully extend both to improve historically clunky WP constructs.

This is primarily achieved by implementing custom Twig tags, abstracting away complexities for specific tasks.

Loop

{% loop %}
	<h2><a href="{{ the_permalink() }}">{{ the_title() }}</a></h2>
	{{ the_content() }}
{% endloop %}

Secondary Loop

{% loop { 'post_type' : 'book', 'orderby' : 'title' } %} {# expression for arguments #}
	<h2><a href="{{ the_permalink() }}">{{ the_title() }}</a></h2>
	{{ the_content() }}
{% endloop %}

Comments

<ul class="comment-list">
	{% comments %}
	<li>
		{{ comment_text() }}
	{# no </li> - self-closing #}
	{% endcomments %}
</ul>

Template Examples

In Hybrid Wing theme (work in progress):

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].