• Thanks in advance for any help.

    I was here but now I am here.

    In order to add custom CSS to a page template, let’s say text-align center my <h1> for pagetype2.php.

    I’m trying to add the body_class_filter. Unfortunately the codex is incomplete. From the example on that page… where does the code go? If I were to take a wild guess I’d put the below in the page template.

    // Apply filter
    add_filter('body_class', 'multisite_body_classes');

    And the following in the themes function file?

    function multisite_body_classes($classes) {
            $id = get_current_blog_id();
            $slug = strtolower(str_replace(' ', '-', trim(get_bloginfo('name'))));
            $classes[] = $slug;
            $classes[] = 'site-id-'.$id;
            return $classes;
    }

    Am I correct?

    Then do I still add some custom css in my main css file?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘how to add css for custom page template’ is closed to new replies.