You should be using post_class
(and body_class
for that matter) but you don’t need it for this. Alter your Loop on your home page to conditionally format the first post.
$first = (!is_paged()) ? true : false;
if (have_posts()) {
while (have_posts()) {
the_post();
if ($first) {
// code to format the first post
$first = false;
} else {
// code to format all the other posts
}
}
}
If all you need is a small change that can be made via CSS then you can pass post_class
a parameter.
$first = (!is_paged()) ? 'is_first' : 'not_first';
if (have_posts()) {
while (have_posts()) {
the_post();
echo '<div ',post_class($first),'>';
// the rest of your Loop
echo '</div>';
$first="not_first";
}
}
Related Posts:
- How to specify a class added to my gallery
- Get parent category class in post_class()
- Duplicate attribute class causing site validation error
- Output terms to post_class()
- post_class not working with css
- adding additional class to get the post thumbnail [duplicate]
- What is the difference among col-lg-*, col-md-* and col-sm-* in Bootstrap?
- Set line spacing
- Outline effect to text
- create a white rgba / CSS3
- Using CSS for a fade-in effect on page load
- Transition of background-color
- How to add a color overlay to a background image?
- Change color of PNG image via CSS?
- css: how to center box div element directly in center?
- Transitions on the CSS display property
- HTML/CSS float: left; is not working properly
- How to get current screen width in CSS?
- margin-right is not working with my HTML. How can I center my content?
- Overflow Scroll css is not working in the div
- Positioning background image, adding padding
- CSS Box Shadow – Top and Bottom Only [duplicate]
- How to place Text and an Image next to each other in HTML?
- Responsive iframe with max width and height
- Overflow-x not working
- Inner glow effect of button
- Hexagon shape with CSS3
- CSS selector for first element with class
- Inbuilt style for jquery-ui-datepicker
- Why is style.css not being enqueued?
- Using theme options to change link colours
- How make theme css be first and not plugin css
- When enqueing a stylesheet, is it possible to remove the type attribute? [duplicate]
- One WordPress and database but multiple subdomains
- Collapsible button inside a ul list does work in jsfiddle but not in WP
- How can I remove css from a child theme?
- wordpress in wamp lan doesn’t load css
- JavaScript added as link/stylesheet
- How to get a value for admin css color either gray or blue
- CSS style button For WP Login Function in page template
- Adding external stylesheet after ALL other styles
- How can I use PurifyCSS to clean WordPress style.css?
- WordPress Twenty Fourteen Theme Sidebar
- How to apply wordpress css styles to a jQueryUi dialog?
- Auto LTR-RTL Text Direction in wordpress post!
- Is there any size difference between single quote ‘ ‘ and double quote ” ” in CSS
- Removing Title From Links to Site
- Admin pages missing css
- WordPress problematic caching
- why this media query is not working / not loading when I put it in child theme?
- Rendering css to screen and debug problem
- How to link theme fonts directory in WordPress CSS?
- WordPress custom styles in menu page
- How to Style Primary Menu with Active Class
- Unable to align my sidebar to the contents section instead of comments
- Get post format and use it as a CSS class in different spans
- Change Header Image on Blog Post for Mobile View
- adding the_custom_logo(); to header
- How do I change the style of just a part of the tagline?
- Apply custom css for user role
- override a css style [closed]
- How to avoid repeating similar properties for all tds of a table in a wordpress post
- Loading bbPress CSS file only on forum directory
- Common page width? [closed]
- Login validation on wordpress
- padding not working
- Hide Some Fields of Post Submit box
- CSS properties in textarea in the Customizer
- WordPress default theme CSS version problem and not loading
- Penscratch 2 – changing color of the main block
- How can customized CSS on WordPress highlight the blog title in white when it’s not intended?
- Are there any CSS classes for the wordpress colours?
- how to modify html on homepage (no home-page.php in my theme)
- Remove dashicons.min.css conditionally
- Remove Parent Style on Carousel
- Fonts are not applying
- how does additional css rendering work?
- Text Not Wrapping Around Right Floated Image [closed]
- header background color changed after drop & import database in phpmyadmin
- Css style removed but still showing via CDN even after clearing browser cache and purging all caches for site
- WordPress – Portfolio – Change number of items in a row
- I cannot make this position properly in WordPress [closed]
- How can I pass a variable from PHP to LESS?
- Large Unwanted Space at the Bottom of Blog Posts [closed]
- How to include backend buttons css on frontend?
- Create a body div using CSS [closed]
- vertical menu bar css
- After upload on server 404 on all pages, no css
- I need css code to divide my webpage sections into two columns
- Images at the same vertical position in multiple columns
- css .active dropdown selects all links
- background changed after WordPress update
- Put CSS on TOP, how?
- I am trying to apply these CSS rules to x3 Post-ID’s but I can’t get it to work – any idea how I can?
- In which file can I find the custom CSS code I entered?
- Some times CSS not Applying
- CSS does not take effects and it doesn’t show in inspect [closed]
- Add Quicksand for mobile devices
- Hiding site title for Twentyfifteen sidebar on (responsive) desktop display size
- Why is the image in div not displayed in full-size?