Roots Discourse

Custom Template - body classes are inconsistent

I’ve created a custom template, template-basic.blade.php, for pages, posts and my post type, essays.

{{--
  Template Name: Basic Template
  Template Post Type: post, page, essay
--}}

While the classes output on the <body> correctly for pages, they do not for my CPT, essays.

Here are the <body> classes for the Advertising Info page:

<body class="page-template page-template-template-basic template-basic …">

The page includes a template-basic class, but this class name not exist for the CPT post as shown below. Should there be a space between essay-template-views and template-basic?

<body class="essay-template essay-template-views essay-template-template-basic essay-template-viewstemplate-basic single single-essay …">

The whole point of using the same template is to have one unique class name shared between them regardless of post type.

Is there a way of fixing this?

Nevermind, there’s a template-basic-data class shared between them. If I’m not mistaken, I think this class exists because of Sage, not Wordpress. WTH, Wordpress?

template-basic-data is added by soberwp/controller which is not, strictly speaking, part of Sage.

If you want to modify the classes that Sage adds/modifies for the <body> you can do so here: https://github.com/roots/sage/blob/f3e794a09374d2f110742d15b9b975490fcddbee/app/filters.php#L8-L27

Much appreciated @alwaysblank