• 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

different sized featured image on first post on first page 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 › different sized featured image on first post on first page only

This topic is: not resolved

Tagged: featured, featured image, featured post image, first, first post, image, size

  • This topic has 11 replies, 3 voices, and was last updated 11 years, 2 months ago by wickedsimple.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • August 9, 2014 at 6:18 pm #118002
    kittyridge
    Member

    I'm trying to create a bit of code to put into functions.php that will change the size of the featured image only on the first post on the first page at doesthishousemakemelookfat.com. This is what I've come up with, which isn't working. Any help appreciated:

    remove_action( 'genesis_post_content', 'genesis_do_post_image' );
    add_action('genesis_post_content','first_post_image') ;
    function first_post_image() {
    global $query_string;
    query_posts($query_string . '&meta_key=_thumbnail_id&meta_compare=EXISTS' ); // will only query posts with thumbnails
    if( have_posts() ) :
    	$i = 0;
    	while( have_posts() ) : the_post();
    		$i++; // count
    		if( !$paged && $i == 1) { // assumes you already have a $paged-variable and it is not set
    			the_post_thumbnail( 'full' ); // print a big image for the first post
    		}
    		else {
    			the_post_thumbnail( 'thumbnail' ); // print thumbnails for the rest
    		}
    	endwhile;
    endif;
    }
    http://www.doesthishousemakemelookfat.com
    August 17, 2014 at 11:10 pm #119458
    Brad Dalton
    Participant

    This may help http://www.billerickson.net/code/first-post-class/

    You could change the $opt to a different size image or custom size.


    Tutorials for StudioPress Themes.

    August 18, 2014 at 12:20 am #119465
    Brad Dalton
    Participant

    Here's a full solution which is flexible http://wpsites.net/web-design/customize-the-first-featured-image-in-the-home-page-loop/


    Tutorials for StudioPress Themes.

    August 18, 2014 at 12:19 pm #119572
    kittyridge
    Member

    That did it! This function is so much more elegant and simple than what I was trying to rework. I'm using it very successfully at DoesThisHouseMakeMeLookFat.com. I'll definitely have http://wpsites.net/web-design/customize-the-first-featured-image-in-the-home-page-loop/ bookmarked for future reference. This is an extremely useful function that will come in very handy. Thanks for taking the time to throw this together!!! It will most definitely be very helpful to the StudioPress community!

    August 30, 2014 at 6:38 am #121821
    wickedsimple
    Member

    Hi Brad,

    I came here looking for the answer to the same question! I would like the featured image in the first post on the homepage to be full size. I copied the code in your link above http://wpsites.net/web-design/customize-the-first-featured-image-in-the-home-page-loop/ to my functions.php page and then as a test, I put in your sample CSS:

    .first-image {
    height: 360px;
    }

    but nothing happened. I would like that first image to be full size as my client sometimes has an image as her blog post (without any additional text).

    Donna

    August 30, 2014 at 6:47 am #121825
    Brad Dalton
    Participant

    Hello Donna

    Whats happens if you change the size in the code from thumbnail to full?


    Tutorials for StudioPress Themes.

    August 30, 2014 at 7:04 am #121829
    Brad Dalton
    Participant

    Cooking with gas?


    Tutorials for StudioPress Themes.

    August 30, 2014 at 7:08 am #121835
    wickedsimple
    Member

    This is where I changed it:

    add_filter( 'genesis_get_image_default_args', 'filter_first_featured_image_loop' );
    /**
    * @author Brad Dalton
    * @example http://wpsites.net/web-design/customize-the-first-featured-image-in-the-home-page-loop/
    * @copyright 2014 WP Sites
    */
    function filter_first_featured_image_loop( $defaults ) {
    global $wp_query;
    if( 0 == $wp_query->current_post && is_home() ) :
    the_post_thumbnail( 'full', array( 'class' => 'first-image' ) );
    else:
    return $defaults;
    endif;
    }

    But nothing happened

    August 30, 2014 at 7:12 am #121838
    Brad Dalton
    Participant

    I tested it locally and it works for me.

    Try clearing your caching.

    Do you have any plugins which modify featured images installed?

    Maybe the CSS is causing issues.

    Link to the site please.


    Tutorials for StudioPress Themes.

    August 30, 2014 at 7:19 am #121841
    wickedsimple
    Member

    Cleared the cache. Checked to make sure none of the plugins modified the featured images. Still the same. This site is going to be the end of me, LOL!

    Here's the link:

    http://www.analisamendmentblog.com

    Thanks for your help, Brad!

    August 30, 2014 at 7:25 am #121843
    Brad Dalton
    Participant

    The code works on the home page loop, not widgets.

    Looks like you're using featured posts widgets so you'll need to change the widget settings.


    Tutorials for StudioPress Themes.

    August 30, 2014 at 7:32 am #121844
    wickedsimple
    Member

    Ahh....I adjusted it to show the full "excerpt", which in this case is an image and then removed the featured image and it gave me the desired result.

    Thank you!!!

    Donna

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