{"id":16173376,"url":"https://github.com/rarst/meadow","last_synced_at":"2025-07-29T10:36:18.678Z","repository":{"id":15266042,"uuid":"17995222","full_name":"Rarst/meadow","owner":"Rarst","description":"WordPress templating DSL based on Twig.","archived":false,"fork":false,"pushed_at":"2018-12-31T08:33:54.000Z","size":36,"stargazers_count":72,"open_issues_count":0,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-17T08:50:38.106Z","etag":null,"topics":["twig","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rarst.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-21T21:37:14.000Z","updated_at":"2024-05-12T21:44:11.000Z","dependencies_parsed_at":"2022-09-05T13:41:52.354Z","dependency_job_id":null,"html_url":"https://github.com/Rarst/meadow","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rarst%2Fmeadow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rarst%2Fmeadow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rarst%2Fmeadow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rarst%2Fmeadow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rarst","download_url":"https://codeload.github.com/Rarst/meadow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221662703,"owners_count":16859733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["twig","wordpress"],"created_at":"2024-10-10T04:08:32.881Z","updated_at":"2024-10-27T10:25:16.648Z","avatar_url":"https://github.com/Rarst.png","language":"PHP","readme":"# Meadow — WordPress Templating DSL\n\n_Write WordPress theme templates with familiar ease and modern features._\n\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Rarst/meadow/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Rarst/meadow/?branch=master)\n[![Version](https://img.shields.io/packagist/v/rarst/meadow.svg?label=version)](https://packagist.org/packages/rarst/meadow)\n[![PHP required](https://img.shields.io/packagist/php-v/rarst/meadow.svg)](https://packagist.org/packages/rarst/meadow)\n[![PDS Skeleton](https://img.shields.io/badge/pds-skeleton-blue.svg?style=flat-square)](https://github.com/php-pds/skeleton)\n\nMeadow is a theme templating solution, aiming to find a balance between native WordPress concepts and power of [Twig](http://twig.sensiolabs.org/) dedicated templating language.\n\n## Installation\n\nRequire package in your theme project with [Composer](https://getcomposer.org/):\n\n```bash\ncomposer require rarst/meadow\n```\n\nInstantiate object some time during theme load:\n\n```php\n$meadow = new \\Rarst\\Meadow\\Core;\n$meadow-\u003eenable();\n```\n\n## Templating\n\nMeadow follows conventions of WordPress [template hierarchy](https://codex.wordpress.org/Template_Hierarchy#Visual_Overview):\n\n - for example `index.php` becomes `index.twig`.\n - `{{ get_header() }}` will look for `header.twig` (with fallback to `header.php`)\n - and so on.\n\n### Template Tags\n\nTemplate Tags API (and PHP functions in general) are set up to work transparently from Twig templates:\n\n```twig\n{{ the_title() }}\n```\n\n### Filters\n\nWordPress filters set up to be available as Twig filters:\n\n```twig\n{{ 'This is the title'|the_title }}\n```\n\n### Template Inheritance\n\nFull range of Twig functionality is naturally available, including [template inheritance](http://twig.sensiolabs.org/doc/templates.html#template-inheritance):\n\n```twig\n{# single.twig #}\n{% extends 'index.twig' %}\n\n{% block entry_title %}\n\t\u003cdiv class=\"page-header\"\u003e{{ parent() }}\u003c/div\u003e\n{% endblock %}\n```\n\nTo inherit parent template in child theme prepend it with folder's name:\n\n```twig\n{# child-theme/index.twig #}\n{% extends 'parent-theme/index.twig' %}\n```\n\n## Domain Specific Language\n\nMeadow attempts not just \"map\" WordPress to Twig, but also meaningfully extend both to improve historically clunky WP constructs.\n\nThis is primarily achieved by implementing custom Twig tags, abstracting away complexities for specific tasks.\n\n### Loop\n\n```twig\n{% loop %}\n\t\u003ch2\u003e\u003ca href=\"{{ the_permalink() }}\"\u003e{{ the_title() }}\u003c/a\u003e\u003c/h2\u003e\n\t{{ the_content() }}\n{% endloop %}\n```\n\n### Secondary Loop\n\n```twig\n{% loop { 'post_type' : 'book', 'orderby' : 'title' } %} {# expression for arguments #}\n\t\u003ch2\u003e\u003ca href=\"{{ the_permalink() }}\"\u003e{{ the_title() }}\u003c/a\u003e\u003c/h2\u003e\n\t{{ the_content() }}\n{% endloop %}\n```\n\n### Comments\n\n```twig\n\u003cul class=\"comment-list\"\u003e\n\t{% comments %}\n\t\u003cli\u003e\n\t\t{{ comment_text() }}\n\t{# no \u003c/li\u003e - self-closing #}\n\t{% endcomments %}\n\u003c/ul\u003e\n```\n\n## Template Examples\n\nIn [Hybrid Wing](https://github.com/Rarst/hybrid-wing) theme (work in progress):\n\n - [`index.twig`](https://github.com/Rarst/hybrid-wing/blob/master/index.twig)\n  - [`single.twig`](https://github.com/Rarst/hybrid-wing/blob/master/single.twig)\n   - [`single-post.twig`](https://github.com/Rarst/hybrid-wing/blob/master/single-post.twig)\n  - [`comments.twig`](https://github.com/Rarst/hybrid-wing/blob/master/comments.twig)\n\n## License\n\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frarst%2Fmeadow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frarst%2Fmeadow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frarst%2Fmeadow/lists"}