• 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

Images in post titles for different categories.

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 › Images in post titles for different categories.

This topic is: not resolved

Tagged: blissful, category images

  • This topic has 7 replies, 2 voices, and was last updated 9 years, 5 months ago by Brad Dalton.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • August 19, 2013 at 11:17 am #57354
    krystyn
    Participant

    The site is here.

    When you click on a link to the category, for example, http://www.sweetbeanhome.com/category/green-home/ you'll see the correct image for that category.

    However when you click on a specific post in that category, for example: http://www.sweetbeanhome.com/green-home-test-post/, it uses the default image.

    I've been starring and playing with the code and I can't figure out what I've got wrong. Any suggestions? It's also displaying okay on the home page. Here's a snippet:

    /*Green home*/
    .home #content .category-green-home h2 {
    background: #ffffff url(http://www.sweetbeanhome.com/wp-content/uploads/2013/08/green-house-post.jpg) no-repeat left;
    border-bottom: 1px solid #d597bf;
    height: 34px;
    /*margin: 0 0 10px -30px;*/
    padding: 13px 0 0 55px;
    }

    .page .category-green-home h1,
    .post .category-green-home h1,
    .archive .category-green-home h2 {
    background: #ffffff url(http://www.sweetbeanhome.com/wp-content/uploads/2013/08/green-house-post.jpg) no-repeat left;
    border-bottom: 1px solid #d597bf;
    height: 34px;
    /*margin: 0 0 10px -30px;*/
    padding: 13px 0 0 55px;
    }

    http://www.sweetbeanhome.com
    August 19, 2013 at 2:41 pm #57411
    Brad Dalton
    Participant

    I don't think you can use CSS to display a different header image for posts in a category. Maybe wrong.

    What you can do is use PHP code with a conditional tag for in_category()

    Or you can use a plugin named wp display header. Its a well coded plugin authored by a Theme Wrangler at Automattic, Core Contributor to WordPress 3.4/3.5, Member of the WordPress Theme Review Team.


    Get Help – Book Consultation.

    August 20, 2013 at 1:17 pm #57632
    krystyn
    Participant

    Hmmm..okay, thanks!

    It's strange it works on category pages and the home pages, but it defaults to only one on a post page.

    August 20, 2013 at 3:13 pm #57726
    Brad Dalton
    Participant

    What you want to to do is display the same image for category archives on all posts in that same category?


    Get Help – Book Consultation.

    August 20, 2013 at 6:24 pm #57805
    krystyn
    Participant

    Yes, same on category archives (which I have) as well as on individual posts, which is defaulting to the main one.

    August 21, 2013 at 4:07 pm #58043
    Brad Dalton
    Participant

    All you need to do is use the right classes for single posts in a specific category but i don't think this is possible as i tested over a dozen different options recently and did ask that question at the end of the post.

    I know its easily done using PHP or a plugin.

    Do you know which classes to use for single posts in a category?


    Get Help – Book Consultation.

    August 21, 2013 at 5:21 pm #58066
    krystyn
    Participant

    I would use is_single() for the post, but I'm not sure how to incorporate the in_category() part with it.

    I looked at the plugin, too and that should work. I guess I wanted to figure out the php part.

    August 21, 2013 at 5:37 pm #58070
    Brad Dalton
    Participant

    I think you may want to try out the plugin.

    Here's some PHP code you can modify to suit your needs

    I think its best to use the same method. I.E. All CSS or all PHP code rather than CSS and PHP.

    https://gist.github.com/braddalton/6301615


    Get Help – Book Consultation.

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 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

© 2023 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