All the Dynamic DMS Page Handling You Want…

Posted · Add Comment

pl_breaker_type

One of the long-awaited features now available in DMS v2.1.9.3 (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:

  1. 404 page
  2. Custom Post Type archive
  3. Tag archive: is_tag
  4. Search results: is_search
  5. Category archive: is_category
  6. Author archive: is_author
  7. Archive (e.g. date-based or custom taxonomies): is_archive
  8. Blog Post archive: is_home
  9. Custom Post Type single
  10. Single Page: is_page
  11. Single Post: is_single
  12. Other

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 );

Example

To setup an example use case, let’s say we have this setup:

  • Posts (with Categories and Tags)
  • Pages
  • 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)

Example 1

Notice #7 from the above list of DMS templates: “Archive”.

Well the ‘jetpack-portfolio-type’ has “Archive” as its template.

Prior to DMS v2.1.9.3, 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:

Before:

1101 Before

After:

1101 After

Example 2

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:

Example 3

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:

Conclusion

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!

Comments are closed.