Tagged: , ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #351599

    Hi,

    how can I add a extra class to the body tag without JavaScript?
    I’m using a child theme.

    Greez Jens

    #351630

    Found it out by my self … add this to functions.php.

    // Add class to Body via Filter function
    add_filter( 'body_class','add_body_classes' );
    function add_body_classes( $classes ) {
        $classes[] = 'classNameXYZ';
        return $classes;
    }
    #351871

    Hi!

    Thanks for posting your solution. Let us know if you have any other questions.

    Best regards,
    Elliott

    #516930

    Hey there,
    any solution to add a body class with the post author’s name?

    thank you

    #517451

    Hi,

    I’ve never tried it myself and the question might fit better on a general WordPress forum, there’s a thread about it on StackExchange which might help: http://wordpress.stackexchange.com/questions/39553/add-post-author-body-class-to-wordpress

    Thanks,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.