level-level/clarkson-core

A plugin to write Object-Oriented code in combination with the Twig templating engine while keeping the WordPress Way of working in mind.

1.8.1 2024-10-23 11:49 UTC

README

Test

Clarkson Core

A plugin to write Object-Oriented code in combination with the Twig templating engine while keeping the WordPress Way of working in mind.

Documentation and getting started

Check out the getting started with Clarkson Core guide if you are just getting to know the project.

Overview

Installation

composer require level-level/clarkson-Core

or read the installation guide.

Template Hierachy

Uses the internal Template Hierarchy so you can replace index.php with index.twig or archive-company.php with archive-company.twig and still have all Posts or CPT's available in "The Loop".

{% extends "layouts/full-width.twig" %}

{% block content %}
    {% for object in objects %}
        {% include 'partials/teaser.twig' %}
    {% endfor %}
{% endblock %}

Autoloading of WordPress-object classes per Custom Post Type.

It autoloads default objects that behave just like WP_Post and other native WordPress object but with some more handy stuff. When you register a Custom Post Type ll_company your custom class ll_company gets loaded in the Twig context as objects variable within the archive-company.twig.

Read up on Clarkson objects and how they are initiated.

More documentation

Tests

Currently

  1. Clone repository git@github.com:level-level/Clarkson-Core.git clarkson-core.
  2. Run composer install in the new clarkson-core directory.
  3. Run composer run test.