Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-03-2012, 03:09 AM   PM User | #1
bswb97
New Coder

 
Join Date: Mar 2012
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
bswb97 is an unknown quantity at this point
Best way to update a nested template-specific class

I'm working on a WordPress site right now and I want to style post meta data differently on a category archive page as opposed to a single post page. They are both using the entry-date class but the body that is called is different between the archives and single post.

Here is how the classes and IDs are nested for the archive page:

Code:
<body class="archive category category-blog category-11 logged-in admin-bar browser-gecko">
<div id="page" class="hfeed container">
<div id="main" class="clearfix">
<div id"content" class="sidebar" role="main">
<div class="entry-content">
<span class="entry-meta">
<span class="entry-date">
As comparison, a single post page, everything is the same except the first line:

Code:
<body class="single single-post postid-191 single-format-standard logged-in admin-bar browser-gecko">
In the template's original CSS, there is body.archive, which is what I want to update -- all types of categories (categories, tags, etc.)

How do I add template-specific CSS so that my entry-date styling only affects the pages using body.archive? I've experimented with different nesting techniques but I'm not having any luck.

I would link the site but the WP site is hidden to the public until launch. Thanks for your input!
bswb97 is offline   Reply With Quote
Old 05-03-2012, 02:58 PM   PM User | #2
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,816
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
This is straightforward:

Code:
body.archive .entry-date{...styles...}
will do the trick. So this style will only apply to elements with class of entry-date within body elements that have class archive.
SB65 is offline   Reply With Quote
Reply

Bookmarks

Tags
nesting class, wordpress archive

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:41 PM.


Advertisement
Log in to turn off these ads.