Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Duncan

    (@fdutine)

    There’s a direct download link to the revised file as well.

    Regards,
    Frank

    Twig

    (@palpatine1976)

    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?

    Thanks!

    Twig

    (@palpatine1976)

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

    Twig

    (@palpatine1976)

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

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

    Fix:
    —-
    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

    (@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.