Welcome! To use this support forum, please Login or Join Today!

   

Different style.css for Static and Blog pages?

{name}
Rank

Total Posts: 15

Joined 2015-07-05

PM

 

Is it possible to use one style.css for static pages and another for blog pages?  I have (with your help, thanks) different header images on them, but a different style.css would let me create a related but distinct branding for the blog.

Previous thread on header images: https://www.simplethemes.com/support/viewthread/2219/

Thanks!

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

Yes, By adding the snippet below to your child theme’s functions.php file, WP will load wp-content/mobius-child/blog.css only on the blog home and single blog posts.

function custom_blog_styles() {
 
// only load stylesheet on blog home and single Posts
 
if (is_home() || is_single()) {
  wp_enqueue_style
('blogstyle'get_bloginfo('stylesheet_directory').'/blog.css', array(), '1.0''screen, projection');
 
}
}
add_action
'wp_enqueue_scripts''custom_blog_styles'); 

https://codex.wordpress.org/Conditional_Tags

{name}
Rank

Total Posts: 15

Joined 2015-07-05

PM

 

Thank you!  I appreciate the help.  I’m going to buy good intro book to coding php and css to learn how to tackle these things solo.

Sean

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

No problem, Sean. The best book is experience so keep on coding smile