Add a Page Type

Essential Concepts

Before making a new page type, you should get a sense for what concrete5 is doing behind-the-scenes when you tell it to render a page.

First, concrete5 looks in the active theme's directory for a file  whose name matches the unique "handle" of the page type and whose file extentsion is ".php". If it finds a file that matches, it uses the code inside to render the page. For example, the Left Sidebar page type uses left_sidebar.php to render the editable area, as well as HTML elements like container divs, etc.

But what if that left_sidebar.php file doesn't exist, or the filename doesn't match? concrete5 needs to render your page content somehow, so it uses the active theme's default.php file instead. This is important, since the next theme you activate might not contain the same page types as the firsr-- and we don't want to show an error to site visitors. We'd rather they see the content they were looking for!

 If you're following the steps below, please keep in mind that you'll need to have the correct PHP file in place in order to render anything besides default.php. More on what code is needed inside your page type can be found in our documentation. Another great way to learn is by checking out an existing page type's code. Even default.php is a great place to start.

Getting Started

From the Page Types page, click the "Add a Page Type" button up at the top of the list. We'll fill in all the pertinent details in the next steps.

55editorsguide_pagetypes.png

The Add Page Type page appears.

55editorsguide_addpagetypes.png

Name and Handle

Here we can specify a name (how users will see it) and handle (your handle must be in all lowercase, no spaces, and not already in use). It's a good idea to make your name and handle relatively similarly-named, just in case you ever need to do some under-the-hood troubleshooting...or work with your page type, programmatically.

55editorsguide_addpagetypes-one.png

Page Type Icon

Choose the page type icon you'd like to represent your page when users select it. Here are the default options:

55editorsguide_addpagetypes-two.png

 

Default Attributes

We can also pick which attributes we'd like to include by default when a new page is created using this page type.

55editorsguide_addpagetypes-three.png

Finishing up...

When you're all set, click Save and you'll be returned to the Page Types list. Your new page type will be included in the list, and you'll be able to apply it to any existing page, or use it when creating a new page.

Recent Discussions on this Topic

Remember to clear the cache

After adding a new page type it may be required to clear the cache. If your site is using the default.php page rather than one named after your page type handle. Thanks

New Page Type not Working

Help! I am unable to create a page type that works. Each attempt at creating a new page type fails as the pages just take on the properties of my default.php file. I have created a new page type called 'nocol' which should be pulling the structure from…

Get more pagetypes

Hello, There is any site to download more pagetypes? Thanks!