• 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

A featured image for individual 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 › General Discussion › A featured image for individual categories

This topic is: not resolved

Tagged: category pages, featured images

  • This topic has 8 replies, 2 voices, and was last updated 9 years, 3 months ago by Brad Dalton.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • August 22, 2016 at 10:57 am #191794
    studionoobly
    Member

    So I know that you can add a some cool things to a category/archive page like headlines and content but I would really like to add a featured image which I could then place in the header of said category, is this possible? (note I have already got the code that adds featured images to the header I just need to be able to assign a featured image to a category.)

    Thanks,

    http://n/a
    August 22, 2016 at 11:03 am #191795
    Brad Dalton
    Participant

    Yes, you can use a plugin like WP Display Header.


    Tutorials for StudioPress Themes.

    August 22, 2016 at 11:53 am #191805
    studionoobly
    Member

    Cool thanks, I'll have a look but would prefer to do it with no plugins.

    August 22, 2016 at 11:58 am #191806
    Brad Dalton
    Participant

    Are you referring to adding a different header image to category archive pages?

    Or a different header to posts in different categories

    Or using featured images from single posts as different headers?

    Also, can you embed the code you have already that adds featured images to the header


    Tutorials for StudioPress Themes.

    August 22, 2016 at 12:56 pm #191812
    studionoobly
    Member

    Yea I'd like to add a different header image to each of the category archive pages - so the way I would envisage it would be the user clicks on Category settings and somewhere in there they could add a featured image to the category.

    This is the current code that adds featured images to the header

    add_action( 'genesis_entry_header', 'themeprefix_featured_image', 1 );
    function themeprefix_featured_image() {
    	$image = genesis_get_image( array( // more options here -> genesis/lib/functions/image.php
    			'format'	=> 'html',
    			'size'		=> 'large',// add in your image size either a custom one or a default - https://codex.wordpress.org/Post_Thumbnails
    			'context' => '',
    			'attr'		=> array ( 'class' => 'aligncenter' ), // set a default WP image class
    
    		) );
    	if ( is_singular() || is_page() ) {
    		if ( $image ) {
    			printf( '<div class="featured-image">%s</div>', $image ); // wraps the featured image in a div with css class you can control
    		}
    	}
    }
    August 22, 2016 at 1:08 pm #191814
    Brad Dalton
    Participant

    Are your referring to the entry header or site header? The code you posted hooks a featured image added to the featured image meta box on single posts to the entry header which is where the single post entry title is.

    Also, featured images are unique to each single post. I assume you mean adding a unique image ( not featured image ) to the site header, not the entry header?


    Tutorials for StudioPress Themes.

    August 22, 2016 at 1:32 pm #191816
    studionoobly
    Member

    Yes a unique image but not in the site header currently I have the main menu there, I would need the image to go into the content just above the category title.

    August 23, 2016 at 12:23 am #191851
    Brad Dalton
    Participant

    Use the genesis before loop hook to hook in each image with the is_category conditional tag.


    Tutorials for StudioPress Themes.

    August 23, 2016 at 2:22 am #191854
    Brad Dalton
    Participant

    Here's 2 complete solutions i spent a few hours coding for members.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘General Discussion’ 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

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