-
-
Notifications
You must be signed in to change notification settings - Fork 165
Create custom page template
Robert Isoski edited this page Oct 9, 2022
·
5 revisions
- To create a custom page template you will need an extra file in your current theme directory with the new CSS file you want to apply.
- For example, if you want to have a custom theme for your page named
home
, you need to create ahome.php
file in your current theme directorythemes/yourTheme/home.php
- If you want to create a custom theme for another page that you have named
example
, the custom file will have to be namedexample.php
To make this easier, create a copy of your theme.php
file and rename it to home.php
or any other page that already exists (example.php
)
- Replace CSS style with the one you wish to apply to the
home
orexample
page and leave everything else as it, unless you also want to change the page structure.
IMPORTANT: Your custom page template will only load if your the page exists and if the slug is the same. Example slug: your-long-page
slug will have to have a file named your-long-page.php
in your currently active theme directory.
- This solution comes in handy if you need a custom page template for each employee.
- The thread with the provided solution can be found here: https://www.wondercms.com/community/viewtopic.php?p=7010#p7010
<?php
// get current $dir
$dir = pathinfo($Wcms->getCurrentPageUrl(), PATHINFO_DIRNAME);
$pattern = '/employees/';
// if 'employees' in the url => profile-page-layout ELSE default layout
if (preg_match($pattern, $dir)) {
echo 'EMPLOYEE PAGE!'; // add here your specific template/layout
} else {
echo 'DEFAULT PAGE!'; // default template/layout
}
?>
Still need help?
- Ask a question or make a request in the community.
- Official website
Intro
- Home
- Demo
- Download
- One step install
- Requirements
- 5 file structure
- List of hooks
- Included libraries
- Create theme in 8 easy steps
- Create a plugin
- Custom modules
- Translations
- All security features described
Basic how to's
- Backup all files
- Change default login URL
- Change default password
- Create custom page template
- Create new editable areas or editable blocks
- Edit 404 page
- Get data from database
- Set data to database
- Hide page from menu
- Caddy web server config
- IIS server config
- NGINX server config
- Login
- Recover login URL
- Reset password
- Restore backup
- Update
- PHP built in server
Themes
- Create theme in 8 easy steps
- Add favicon
- Theme tags
- Update theme to work with WonderCMS 2.0.0
- Update theme to work with WonderCMS 3.0.0
- Share your themes with Custom modules
Plugins
- Quick intro on creating plugins and List of hooks
- Share your plugin with simply with Custom modules
Security
- All security features described
- Add SRI tags to your theme libraries
- Always redirect to https and www
- Additional security configuration(s)
- Add SRI tags to your theme libraries
- Better security mode (HTTPS and other features)
Features description
- One click update
- Optional: functions.php file
- Default database.js
- Allowed extensions file types for uploads
- Login URL doesn't work - 404
- 500 internal server error
- Persistent "New WonderCMS update available" message
- URLs mailformed on Windows IIS
- Other errors