rila/rila

An extensible object-oriented theme framework for WordPress.

Installs: 178

Dependents: 0

Suggesters: 0

Security: 0

Stars: 18

Watchers: 3

Forks: 4

Type:wordpress-plugin

0.11 2017-02-24 23:50 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:31:43 UTC


README

Rila is a data-oriented framework for WordPress with rapid front-end development in mind. It includes a set of lot of lightweight and highly extendable class wrappers, which let you structure you code properly in a MVC-like manner.

Features

  • Wrapper classes, which allow for easy and seamless access to WordPress data.
  • Supports pure PHP, Twig and Blade templates out of the box. Other template engines can be easily used.
  • Focused on performance: Data is available on demand and is never loaded in advance.
  • Integrates seamlessly with plugins for custom fields, has a special helper for Advanced Custom Fields.
  • Built with extensibility in mind: You can finally separate your logic from your views properly.
  • Well-documented code and thorough documentation
  • Extremely intuitive
  • Smart default context: Everything, related to the current page is already available and waiting for you.

Quick example

Your single.php (controller) file:

rila_view( 'single' )->render();

Your single.twig (view) file:

{% extends "base.twig" %}

{% block content %}
	<h1>{{ post.title }}</h1>
	<p class="entry-meta">Posted on {{ post.date }} at {{ post.date.time }} by {{ post.author.name }}</p>

	<div class="rte">
		{{ post.content }}
	</div>

	{% if post.categories %}
		<p>Belongs to {{ post.categories }}</p>
	{% endif %}
{% endblock %}

Beautiful, isn't it?

Installation

  1. Download this repository as a WordPress plugin
  2. Make sure that you have Composer installed and run composer install within the plugin's folder
  3. Activate the plugin
  4. Read the wiki and benefit

Coolest feature: Data mapping

The concept of data mapping allows you to have consistent and predictable properties for item attributes, meta and more. As an example from within the framework, you could have a definition like this:

$this->translate(array(
  'image' => '_thumbnail_id'
));

$this->map(array(
  '_thumbnail_id' => 'image'
));

That code allows you you to use post.image instead of post._thumbnail_id and the value would be an actual image object, so you can go ahead and simply use this within your templates:

{{ post.image }}

Mapping does not only apply to simple objects though - it's being heavily used throughout the whole plugin. You can read more about the topic in the wiki.

Functionality and docs

All of the functionality of the plugin is described in the Wiki.

Author

The framwork is being developed by me, Radoslav Georgiev, web developer at DigitalWerk.

Contributions and pull requests are welcome ;)