• 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

Automatically make the first post image the feature image

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 › Automatically make the first post image the feature image

This topic is: not resolved

Tagged: feature image, post image

  • This topic has 3 replies, 3 voices, and was last updated 8 years, 8 months ago by Brad Dalton.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • May 2, 2016 at 11:36 am #184815
    Tracey
    Member

    I'm creating my first custom child theme for a friend of mine with a 5 year old blog. Her old theme has never supported "feature image".

    How can I modify the child theme to ...
    (a) automatically make the first image of all existing posts the feature image
    (b) continue to make the first image of future posts the feature image, unless she chooses to use the feature image functionality

    Thanks in advance!

    (BTW - I'm working in a dev environment offline so I don't have a URL to share at this point.)

    May 3, 2016 at 5:03 pm #184925
    Brad Dalton
    Participant

    Genesis will do this if no featured image is added, it looks for the first image attachment for the post.

    It won't add it to the featured image meta box but it will display it in archives when the Genesis > Theme Settings > Content Archive settings are configured to display the featured image.

    @uses genesis_get_image_id() Pull an attachment ID from a post, if one exists.

    //* Else if the first (default) image attachment is the fallback, use its id
    	elseif ( 'first-attached' === $args['fallback'] ) {
    		$id = genesis_get_image_id( $args['num'], $args['post_id'] );
    	}
    

    Tutorials for StudioPress Themes.

    November 2, 2016 at 7:51 pm #195655
    MurrinMedia
    Member

    I'd like to solve the original problem on this!

    I have a blog for a friend with 200 posts. All posts have no featured images, but they all have what is considered the featured image, at the top of each post.

    I'd prefer to somehow analyse all the posts and set the first image as the featured image. I understand Genesis using the first image as the featured image if no featured image is set - but that doesn't help for widgets like Genesis - Featured Posts etc... which have a tickbox for featured image on or off.

    November 2, 2016 at 11:33 pm #195657
    Brad Dalton
    Participant

    Link to your blog please.

    I assume you haven't added featured images using the featured image box however you have added a image at the beginning of the editor?


    Tutorials for StudioPress Themes.

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

© 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