- Manual
- Developer Reference
- Website Skins/Themes
- Using Custom Templates
Using Custom Templates
When you edit a post type, you can define a custom template.
Let’s illustrate this with an example…
An example
Set up
Let’s set up a "Movie Review" post type, like this:

Now, let’s create a new Movie Review Post:

Alternatively, you could also change the type of an existing post here:

What happens
Now, once you save this post, it will appear normally in all lists, but as soon as you try to display the post (disp=single), then b2evolution will try to use a custom template.
In order to understand the following, you need to first read "Understanding the skin files" in the Skin Development Primer.
With a custom post type, b2evolution will vary it’s behavior in the following manner:
- Instead of trying to call the
single.main.php
template, b2evolution will try to callmovie_review.main.php
.- If not found, it will try
single.main.php
in the skin folder. - If not found, it will try
index.main.php
in the skin folder.
- If not found, it will try
- Instead of trying to include the
_single.disp.php
template, b2evolution will try to include_movie_review.disp.php
.- If not found, it will try
_single.disp.php
in the skin folder. - If not found, it will try
_single.disp.php
in the fallback folders.
- If not found, it will try
Also for pages
This works similarly for pages (disp=page):
- Instead of trying to call the
page.main.php
template, b2evolution will try to callmovie_review.main.php
.- If not found, it will try
page.main.php
in the skin folder. - If not found, it will try
index.main.php
in the skin folder.
- If not found, it will try
- Instead of trying to include the
_page.disp.php
template, b2evolution will try to include_movie_review.disp.php
.- If not found, it will try
_page.disp.php
in the skin folder. - If not found, it will try
_page.disp.php
in the fallback folders.
- If not found, it will try
Created by fplanque • Last edit by fplanque on Jun 12, 2015
No feedback yet
Form is loading...