Support » Plugin: Custom Category Templates » [Plugin: Custom Category Templates] body_class() Bugfix

Viewing 5 replies - 1 through 5 (of 5 total)
  • There’s a direct download link to the revised file as well.


    I also see that this plugin doesn’t add CSS classes to the body tag – your download link seems to be broken. Could you please clarify the bug fix?


    Nevermind – I discovered my parent theme was overriding the body_class hook.

    Here’s the issue and the bugfix for @shazdeh :

    $this->template is not HTML-class-safe (it contains a period because it is pulling the PHP file name

    Replace body_class() fn on line #56 of init.php with:

    function body_class( $classes ) {
    	$template = sanitize_html_class( str_replace( '.', '-', $this->template ) );
    	$classes[] = 'category-template-' . $template;
    	return $classes;
    Plugin Author shazdeh


    Thank you both for the fixes. I’ll add it to the next version.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Custom Category Templates] body_class() Bugfix’ is closed to new replies.