https://github.com/ahmu83/addvirtualpage-wordpress
Helper class for creating a virtual page in WordPress
https://github.com/ahmu83/addvirtualpage-wordpress
Last synced: 2 months ago
JSON representation
Helper class for creating a virtual page in WordPress
- Host: GitHub
- URL: https://github.com/ahmu83/addvirtualpage-wordpress
- Owner: ahmu83
- Created: 2021-01-26T05:12:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-26T05:23:56.000Z (over 4 years ago)
- Last Synced: 2025-01-24T19:36:20.693Z (4 months ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AddVirtualPage-WordPress
This is a helper class for creating a virtual page in WordPress.
i.e, domain.com/custom-url-slug/
Currently this only adds a simple virtual page without any parameters, but this can be modified to add custom parameters to the url.
# Usage
```
$template_path = get_stylesheet_directory() . '/custom-pages/the-template.php';
new AddVirtualPage('custom-url-slug', $template_path);
```The `$template_path` should be a fully qualified template path
This will add a new virtual page: domain.com/custom-url-slug/
Don't forget to clear your permalink cache for the new virtual page to work