• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Style First Post Differently

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Style First Post Differently

This topic is: not resolved

Tagged: css, featured post, first post, php, post title, styling

  • This topic has 8 replies, 4 voices, and was last updated 11 years, 8 months ago by CreativeKristi.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • August 25, 2014 at 1:08 pm #120952
    CreativeKristi
    Member

    Hello! I am working on a test site:

    http://blogtest.creativekristi.com

    This is a current wordpress and Genesis install but the client only wants the Vintage Child Theme to be used so that's what is on there.

    I am trying to use php & css to style the most recent (or first depending on who you ask) post differently than the rest. It's a 3 part issue:

    1. I want to include the measuring tape illustration ONLY on the first post on the home page.
    2. I want to include a post divider image below the post date and above the post content ONLY on the first post on the home page.
    3. I believe I will need to adjust the margins/padding of the Post Title, Post Date/Author line AND the post content but will only need to adjust on that first post only.

    Would love to use the Genesis Simple Hooks plugin for this and add some css into the style.css but so far I'm at a loss as to the php to JUST change that first post on the home page only.

    To get it to show up at all (the illustration and the above post content divider) I have done the following: (and it shows on each post at the moment)
    1. Added the image url of the illustration to the #content .post h2 section and added/increased the height of that to 75px
    2. Because of the height of the #content .post h2 I had to add a negative margin to the post-info line AND because of #3 I increased the bottom margin to 25px.
    3. To add the post divider image to the top of the post content I added the image url as a background to the .entry-content area and increased the top padding to 45px.

    ^^^I tell you all of the above because all those pieces need to be addressed so that ONLY that first post gets those changes and everything else doesn't have those increased margins/padding and backgrounds.

    I've looked at the wordpress forum and saw something similar but was unsure how to apply it to Genesis since the codes all look different.

    Thank you for all of your help in advance!


    I work at Creative Kristi Designs
    I play at Creative Kristi
    Affordable. Beautiful. Personal. Custom. Design for everyone.

    http://blogtest.creativekristi.com
    August 25, 2014 at 1:42 pm #120967
    Porter
    Participant

    I'm horrid at CSS, so I can't help much, but I can teach you something you may not know, that will solve your "only on the home page" issue.

    body.home .someclass {
        font-size: 16px;
    }

    body.home will target just your home page, so hopefully you can use that with whatever CSS you know to accomplish this.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    August 25, 2014 at 1:49 pm #120971
    CreativeKristi
    Member

    Porter,
    I need something that targets only the first post on the home page only, not the entire home page. If that makes sense?


    I work at Creative Kristi Designs
    I play at Creative Kristi
    Affordable. Beautiful. Personal. Custom. Design for everyone.

    August 25, 2014 at 1:54 pm #120975
    Brad Dalton
    Participant

    This works for the featured image http://wpsites.net/web-design/customize-the-first-featured-image-in-the-home-page-loop/


    Tutorials for StudioPress Themes.

    August 25, 2014 at 2:00 pm #120978
    TulioKCardozo
    Member

    Hi Kristi!

    Have you thought about using the CSS:first-child pseudo-element?
    http://www.w3schools.com/cssref/sel_firstchild.asp

    A combination of Porter's suggestion and this should help you target a rule to "hit" the first blog post.

    You may also have to use !important to force the override but check out this article if you haven't already about general guidelines of it's usage.

    When Using !important is The Right Choice

    Hope this helps! Cheers,
    -Tulio

    Edit: Brad's answers is definitely a cleaner way to go!

    August 25, 2014 at 2:03 pm #120981
    CreativeKristi
    Member

    Brad,
    that looks good but I'm at a loss as to change it to add a post title image (and keep the featured image of the post in tact) and add the divider image?


    I work at Creative Kristi Designs
    I play at Creative Kristi
    Affordable. Beautiful. Personal. Custom. Design for everyone.

    August 25, 2014 at 2:43 pm #120991
    Brad Dalton
    Participant

    Please ask one question per topic.

    This code also generates a custom body class and custom post class for the 1st post in the home page loop.


    Tutorials for StudioPress Themes.

    August 26, 2014 at 7:50 am #121106
    CreativeKristi
    Member

    Brad,
    I'm sorry I believe I did only ask one question per topic. My original question had nothing to do with the featured image and your post you linked dealt with changing featured images---I was asking for clarification on how to apply that to what I had asked. Did I misinterpret your answer?

    Tulio,
    Thanks I'll check those out!

    -Kristi


    I work at Creative Kristi Designs
    I play at Creative Kristi
    Affordable. Beautiful. Personal. Custom. Design for everyone.

    August 26, 2014 at 7:58 am #121110
    CreativeKristi
    Member

    Brad--
    That second post you linked to sounds exactly like what I am looking for! Like I said I had figured it out for other wordpress sites but was having trouble translating to Genesis sites! Yahoo!

    I'll let you know if it works the way I'm thinking!

    Thanks for your help all,
    Kristi


    I work at Creative Kristi Designs
    I play at Creative Kristi
    Affordable. Beautiful. Personal. Custom. Design for everyone.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble