• 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

Image on certain category only

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 › Image on certain category only

This topic is: not resolved

Tagged: in_category

  • This topic has 2 replies, 2 voices, and was last updated 10 years, 3 months ago by Goob.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • May 2, 2016 at 4:26 pm #184845
    Goob
    Participant

    Hey guys. I'm having trouble styling a specific category on my site. All of my posts contain a featured image beneath the title before going to the paragraphs of text in the post. I have a category called Dead (ID 77) where I want to stamp a 2nd image on top of the featured image (or the first paragraph if there is no image) once I move the post to Dead.

    You can see an example of what I'm going for on my current layout.

    The guy who started working on my new design used the following method:

    add_filter( 'genesis_before_entry_content', 'amd_deadpic' ); 
    function amd_deadpic() {
    echo'<div class="exlabel"><img src="http://www.heyitsfree.net/wp-content/themes/wp-theme-3/images/HIFLabel.png" /></div>';
    }

    However this called the image on every post, so he used a display:none to hide it and only show it when needed. There's got to be a way to only echo that for posts in Dead though, right?

    http://stage.heyitsfree.net/category/dead/
    May 2, 2016 at 9:22 pm #184861
    Brad Dalton
    Participant

    There's different to code this using add_action however the key is to add a conditional tag after the function like this:

    add_action( 'genesis_entry_header', 'amd_deadpic', 15  ); 
    function amd_deadpic() {
    if ( in_category('dead'))
    echo'code-for-your-image';
    }
    

    Also note: You'll find the correct code to use for this in the Workstation Pro child theme by StudioPress.


    Tutorials for StudioPress Themes.

    May 2, 2016 at 11:52 pm #184872
    Goob
    Participant

    Brad, thank you very much! That code was just what I needed.

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