{"id":23071256,"url":"https://github.com/bigboxwc/wp-template-loader","last_synced_at":"2025-06-13T04:34:39.538Z","repository":{"id":62494066,"uuid":"137493027","full_name":"bigboxwc/wp-template-loader","owner":"bigboxwc","description":"WordPress view/template loading helpers.","archived":false,"fork":false,"pushed_at":"2018-06-15T19:38:50.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-04T07:36:28.366Z","etag":null,"topics":["wordpress","wordpress-development"],"latest_commit_sha":null,"homepage":"https://bigboxwc.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigboxwc.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}},"created_at":"2018-06-15T13:49:17.000Z","updated_at":"2018-07-21T17:30:30.000Z","dependencies_parsed_at":"2022-11-02T11:18:03.185Z","dependency_job_id":null,"html_url":"https://github.com/bigboxwc/wp-template-loader","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bigboxwc/wp-template-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigboxwc%2Fwp-template-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigboxwc%2Fwp-template-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigboxwc%2Fwp-template-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigboxwc%2Fwp-template-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigboxwc","download_url":"https://codeload.github.com/bigboxwc/wp-template-loader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigboxwc%2Fwp-template-loader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259581629,"owners_count":22879890,"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","wordpress-development"],"created_at":"2024-12-16T07:12:10.077Z","updated_at":"2025-06-13T04:34:39.509Z","avatar_url":"https://github.com/bigboxwc.png","language":"PHP","readme":"# BigBox Template Loader Component\n\nAdd sanity to WordPress templating systems.\n\n## Table Of Contents\n\n* [Installation](#installation)\n* [Basic Usage](#basic-usage)\n* [Contributing](#contributing)\n\n## Installation\n\nThe best way to use this component is through Composer:\n\n```BASH\ncomposer require bigboxwc/wp-template-loader\n```\n\n## Basic Usage\n\nInitializing the core template filtering should happen during runtime. This will route WordPress's core template files ([template hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/) to your chosen layout directory (`/resources/views/layout`) by default.\n\n```PHP\n( new \\BigBoxWC\\WP_Template_Loader\\Loader() )::watch();\n```\n\nInstead of loading `/single.php`, `/resources/views/layout/single.php` is loaded instead.\n\n### Defining Custom Directories\n\nThe default view directory is `/resources/views` with a `layout` and `partials` directory relative to that. To change these pass them to the `Loader` instantiation.\n\n```PHP\n( new \\BigBoxWC\\WP_Template_Loader\\Loader( [\n\t'base_path'    =\u003e 'resources/templates',\n\t'layout_dir'   =\u003e 'wp-pages',\n\t'partials_dir' =\u003e 'parts',\n] ) )::watch();\n```\n\n### Loading Views Manually\n\nThe `Loader` class also offers the ability to load views without using the WordPress' template loading system. These can easily be plugged in to any existing template helpers your theme may already be using.\n\n#### Render a View\n\n```PHP\n\\BigBoxWC\\WP_Template_Loader\\Loader::view( 'my-view' );\n```\n\nWill output the contents of `resources/views/my-view.php`\n\n#### Get a View\n\n```PHP\n$view = \\BigBoxWC\\WP_Template_Loader\\Loader::get_view( 'my-view' );\n```\n\nWill assign the contents of `resources/views/my-view.php` to a variable.\n\n#### Render a View in a Custom Directory\n\n```PHP\n\\BigBoxWC\\WP_Template_Loader\\Loader::view( 'global/header' );\n```\n\nWill output the contents of `resources/views/global/header.php`\n\n#### Render a View with Passed Variables\n\n```PHP\n\\BigBoxWC\\WP_Template_Loader\\Loader::view( 'global/header', [\n\t'min' =\u003e true,\n] );\n```\n\nWill output the contents of `resources/views/global/header.php` with the variable `$min` available in the global scope.\n\n#### Render a Partial\n\nThe above methods can be repeated with the `partial()` method instead of `view()` to automatically look in the set `$partial_dir` location.\n\n## Contributing\n\nAll feedback / bug reports / pull requests are welcome.\n\n## License\n\nThis code is released under the GPL license.\n\nFor the full copyright and license information, please view the [`LICENSE`](LICENSE) file distributed with this source code.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigboxwc%2Fwp-template-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigboxwc%2Fwp-template-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigboxwc%2Fwp-template-loader/lists"}