Download the PHP package victorhugobatista/wp-eruptor without Composer
On this page you can find all versions of the php package victorhugobatista/wp-eruptor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download victorhugobatista/wp-eruptor
More information about victorhugobatista/wp-eruptor
Files in victorhugobatista/wp-eruptor
Package wp-eruptor
Short Description Extend your single pages like lava in the water with less setup
License MIT
Informations about the package wp-eruptor
wp-eruptor
Extend your single pages like lava in the water with less setup
Simple usage
Add the lib by composer with the command below:
Add the code below to your functions. Where the template files will be loaded by default at active-theme-dir/single-page-children.
You can pass the root directory where the templates will be loaded as the example below:
Template files
The file structure to place the templates must be like below:
- Template root directory (by now, the template folder must be placed here)
- single-page-children (by now, this name can't be changed)
- single-book (this represents the name of template file of single pages, in case single-book.php)
- child-a.php (/book/existing-post-name/child-a)
- child-b.php (/book/existing-post-name/child-b)
- child-c.php (/book/existing-post-name/child-c)
- single-movie
- child-d.php (/movie/existing-post-name/child-d)
- child-e.php (/movie/existing-post-name/child-e)
- child-f.php (/movie/existing-post-name/child-f)
- single-page-children (by now, this name can't be changed)
The post id of parent single page will be available in the templates as:
Hooks reference
| Hook | Description |
|---|---|
| eruptor/data | Inject data to all templates |
| eruptor/data/type/{post-type-slug} | Inject data to templates children of posts of an post type by slug |
| eruptor/data/post/{parent-single-post-id} | Inject data to templates children of an specific post by id |
| eruptor/data/template/{template-slug} | Inject data to one template by name |
Example for eruptor/data* hook:
*/!\ The wildcard can be replace with any eruptor/data filters above /!\**
The new data will be available on template on $pageData array:
Next steps (from @todo comments added to the code)
- To receive what post types have to be added to routes on main class.
- Add filters to allow the modification of header, content and footer by post type, post name and template name.