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.
Installs: 135 591
Dependents: 1
Suggesters: 0
Security: 0
Stars: 24
Watchers: 12
Forks: 10
Open Issues: 30
Requires
- php: >=7.4
- twig/html-extra: ^3.1
- twig/intl-extra: ^3.1
- twig/markdown-extra: ^3.1
- twig/string-extra: ^3.1
- twig/twig: ^3.1
Requires (Dev)
- 10up/wp_mock: ^0.4.2
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.0
- giacocorsiglia/wordpress-stubs: ^5.1
- phpcompatibility/php-compatibility: ^9.3
- vimeo/psalm: ^3.4
- wp-coding-standards/wpcs: ^2.3
- dev-master
- 1.8.1
- 1.8.0
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.1
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- 1.0.0-rc5
- 1.0.0-rc4
- 1.0.0-rc3
- 1.0.0-rc2
- 1.0.0-rc1
- 0.4.11
- 0.4.10
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.3
- 0.3.2
- 0.3.1
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-fixes-for-psalm
- dev-update/twig-to-version-3
- dev-feature/get-biography-for-clarkson-user
- dev-0.4-lts
- dev-0.5-lts
- dev-fix/endless_render_callback_loop
- dev-fix/php-8.2-deprecation-warnings-in-v0.4.-
- dev-update/test.yml-to-also-test-on-php-version-8.0
- dev-update-twig-package
- dev-NielsdeBlaauw-patch-2
- dev-fix/0_4_lts_3rd_param_original_render_callback
- dev-fix/article-date
- dev-dependabot/npm_and_yarn/minimist-and-mkdirp-1.2.8
- dev-dependabot/npm_and_yarn/markdown-it-and-jsdoc-12.3.2
- dev-dependabot/npm_and_yarn/marked-and-jsdoc-4.1.1
- dev-dependabot/npm_and_yarn/underscore-and-jsdoc-1.13.6
- dev-Fix/comment_for_get_comments_function
- dev-mark-deprecated-properties
- dev-bump/php7.4
- dev-NielsdeBlaauw-patch-1
- dev-fix/get_thumbnail_id_return_type
- dev-130-extract-twig-creation
- dev-fix/alway_load_role
- dev-feature/archive_object
- dev-0.3-lts
- dev-fix/filename_with_dot_twig
- dev-single-twig-instance
- dev-feature/user-role-base-objects
- dev-improvement/templating
This package is auto-updated.
Last update: 2024-11-23 14:08:00 UTC
README
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
- Clone repository
git@github.com:level-level/Clarkson-Core.git clarkson-core
. - Run
composer install
in the newclarkson-core
directory. - Run
composer run test
.