Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 134302

square_eyes on "how to add css for custom page template"

$
0
0

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 all articles
Browse latest Browse all 134302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>