{"id":15637034,"url":"https://github.com/johnbillion/extended-template-parts","last_synced_at":"2025-04-05T18:08:56.315Z","repository":{"id":3628790,"uuid":"47004185","full_name":"johnbillion/extended-template-parts","owner":"johnbillion","description":"A library which provides extended functionality to WordPress template parts, including template variables and caching.","archived":false,"fork":false,"pushed_at":"2023-05-28T00:15:06.000Z","size":53,"stargazers_count":114,"open_issues_count":2,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T17:09:31.859Z","etag":null,"topics":["wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnbillion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-11-28T00:22:31.000Z","updated_at":"2024-05-20T18:17:28.000Z","dependencies_parsed_at":"2022-08-06T14:01:19.792Z","dependency_job_id":null,"html_url":"https://github.com/johnbillion/extended-template-parts","commit_stats":{"total_commits":64,"total_committers":6,"mean_commits":"10.666666666666666","dds":0.125,"last_synced_commit":"a472830b8fbd224a81749fe1a7082e48e38bb220"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fextended-template-parts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fextended-template-parts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fextended-template-parts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbillion%2Fextended-template-parts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnbillion","download_url":"https://codeload.github.com/johnbillion/extended-template-parts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378149,"owners_count":20929297,"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":["wordpress"],"created_at":"2024-10-03T11:09:41.557Z","updated_at":"2025-04-05T18:08:56.294Z","avatar_url":"https://github.com/johnbillion.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Stable Release](https://img.shields.io/packagist/v/johnbillion/extended-template-parts.svg)](https://packagist.org/packages/johnbillion/extended-template-parts)\n[![License](https://img.shields.io/badge/license-GPL_v2%2B-blue.svg)](https://github.com/johnbillion/extended-template-parts/blob/master/LICENSE)\n![PHP 7](https://img.shields.io/badge/php-7-blue.svg)\n\n# Extended Template Parts\n\nExtended Template Parts is a library which provides extended functionality to WordPress template parts, including template variables and fragment caching.\n\n## Features ##\n\n * Pass variables into your template parts and access them via the `$this-\u003evars` array. No polluting of globals!\n * Easy optional caching of template parts using transients.\n\n## Minimum Requirements ##\n\n**PHP:** 7.0  \n**WordPress:** 4.4  \n\n## Installation ##\n\nExtended Template Parts is a developer library, not a plugin, which means you need to include it somewhere in your own project.\nYou can use Composer:\n\n```bash\ncomposer require johnbillion/extended-template-parts\n```\n\nOr you can download the library and include it manually:\n\n```php\nrequire_once 'extended-template-parts/extended-template-parts.php';\n```\n\n## Basic Usage ##\n\nThe `get_extended_template_part()` function behaves exactly like [WordPress' `get_template_part()` function](https://developer.wordpress.org/reference/functions/get_template_part/), except it loads the template part from the `template-parts` subdirectory of the theme for better file organisation. The usual parent/child theme hierarchy is respected.\n\n```php\nget_extended_template_part( 'foo', 'bar' );\n```\n\nUse the `$vars` parameter to pass in an associative array of variables to the template part:\n\n```php\nget_extended_template_part( 'foo', 'bar', [\n\t'my_variable' =\u003e 'Hello, world!',\n] );\n```\n\nIn your `template-parts/foo-bar.php` template part file, you can access the variables that you passed in by using `$this-\u003evars`:\n\n```php\necho esc_html( $this-\u003evars['my_variable'] );\n```\n\n## Advanced Usage ##\n\nThe `get_extended_template_part()` function also accepts a second optional parameter that controls the directory name and caching.\n\nThe following code will load `foo-bar.php` from the `my-directory` subdirectory and automatically cache its output in a transient for one hour:\n\n```php\nget_extended_template_part( 'foo', 'bar', [\n\t'my_variable' =\u003e 'Hello, world!',\n], [\n\t'dir'   =\u003e 'my-directory',\n\t'cache' =\u003e 1 * HOUR_IN_SECONDS,\n] );\n```\n\n## License: GPLv2 or later ##\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbillion%2Fextended-template-parts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnbillion%2Fextended-template-parts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbillion%2Fextended-template-parts/lists"}