One of the long-awaited features now available in DMS v18.104.22.168 (released March 2015) is the ability to add custom templates/layouts for more “special” types.
By default, PageLines DMS detects/creates these page handler types:
- 404 page
- Custom Post Type archive
- Tag archive: is_tag
- Search results: is_search
- Category archive: is_category
- Author archive: is_author
- Archive (e.g. date-based or custom taxonomies): is_archive
- Blog Post archive: is_home
- Custom Post Type single
- Single Page: is_page
- Single Post: is_single
Now, there’s an option to add our own conditions due to the addition of this code in dms/editor/editor.page.php:
return apply_filters( ‘pl_breaker_type’, $type );
To setup an example use case, let’s say we have this setup:
- Posts (with Categories and Tags)
- Jetpack’s Custom Content Type: Portfolio Projects (a custom post type of ‘jetpack-portfolio’ with ‘jetpack-portfolio-type’ and ‘jetpack-portfolio-tag’ as custom taxonomies)
Notice #7 from the above list of DMS templates: “Archive”.
Well the ‘jetpack-portfolio-type’ has “Archive” as its template.
Prior to DMS v22.214.171.124, this was just the way it is, and all custom taxonomies across all custom post types would have the same DMS layout.
But now we can tell DMS to display a different template in this scenario by adding this code to functions.php:
This will change the WP Admin Bar display from “Archive” type to our custom type:
Essentially, what we did is whitelist the Project Types taxonomy but not any other custom taxonomy, like Project Tags.
This code makes it so all taxonomies get their own page handling type:
Let’s say we want each post category to be its own type so that we could add custom textboxes and other sections to the archive of each post category. And we also want each custom taxonomy archive to be its own type too.
Here you go:
The first example started with whitelisting only the custom taxonomy I wanted to target.
I did this to highlight the idea that you should really only make custom DMS page handling types if you plan to do something with them.
If you’re not going to add some custom content to that archive page, then you probably shouldn’t make it its own page handling type.
Leverage pl_breaker_type wisely!