Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am editing the 'Bizz' portfolio Wordpress theme(http://www.wpexplorer.com/bizz-wordpress-theme). It includes custom post types for managing portfolio examples, the highlights on the homepage, etc.

I want to style the background color displayed behind each 'highlights' heading with a different color, but since they're served dynamically, I'm not sure how I should target each h2.

Would it be best to attach a unique class to each of the three headings through the php, or try to target them through CSS selectors? And how would I best do that?

My major concern in using CSS selectors would be backward compatibility, I dont know that I want to bulk up the page with extra bootstraps.

How should I go about it? Thanks!

share|improve this question
add comment

1 Answer

I think it depends on whether you want it to be unique for each of the four "highlighted" project columns on the homepage, or whether you want each "highlighted project" to be different.

Does that make sense?

E.g. if you just want each of the four project "columns" on the homepage to look different then I'd use CSS to achieve this : nth-of-type perhaps.

But if you wanted Project A (when highlighted on the homepage) to have a unique background colour regardless of what column it appears in, then Id use PHP to add the post->ID as a class in addition to portfolio-item and then use CSS to style that.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.