b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Demo
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manual Home
  • Latest Updates
 
  1. Manual
  2. Developer Reference
  3. Website Skins/Themes
  4. 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:

Using Custom Templates

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

Using Custom Templates

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

Using Custom Templates

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 call movie_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.
  • 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.

Also for pages

This works similarly for pages (disp=page):

  • Instead of trying to call the page.main.php template, b2evolution will try to call movie_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.
  • 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.

Created by fplanque • Last edit by fplanque on Jun 12, 2015

No feedback yet


Form is loading...

Comment feed for this post

Search

  • Manual
  • Introduction
  • Installation / Upgrade
  • User's Guide
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
    • Website Skins/Themes
      • Skin Development Primer
      • Loading additional resources into a skin
      • Photo Gallery Anatomy
      • Where are the skin files?
      • CSS Guidelines
      • Targeted CSS Selectors
      • Introducing evoSkins
      • Modifying evoSkins
      • Creating evoSkins
      • Skin Tags / API
      • Dev Menu
      • Using Grunt
      • How to add a Google Font (WebFont) ?
      • Using HTML 5 tags
      • Skin Quality Control
      • Styling widgets
      • Using Custom Templates
      • Using bootstrap classes in footers
      • Site Skins
    • Email Skins/Themes
    • b2evolution Files
    • Website Integration
    • Plugins
    • Debugging
    • Technical Reference
    • Hacks
    • Development
    • How to... (Customize)
    • Scheduled Tasks Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
powered by b2evolution

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Web Hosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Web hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Internatl: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • Google+
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque · Supported by the Evo Factory