• 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

Specifying image size in grid loop for different pages

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 › Specifying image size in grid loop for different pages

This topic is: resolved
  • This topic has 1 reply, 2 voices, and was last updated 11 years, 5 months ago by Brad Dalton.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • December 5, 2013 at 11:01 am #77238
    SaraGraybill
    Member

    I'm working on http://www.connectcec.com and I have the grid loop set up on three different category archive pages. I have the Genesis Grid Loop plugin installed but I can't figure out how to change the image size based on the archive page. Also on this archive page the images are showing up as different sizes. Does anyone have any suggestions?

    Here are the three archive pages:
    http://www.connectcec.com/category/portfolio/
    http://www.connectcec.com/category/services/
    http://www.connectcec.com/category/leadership/

    I am using this code:

    //Custom Image for Leadership CPT
    function be_cpt_leadership_size( $image_size ) {
      
      // Only run on the 'leadership' post type archive
      if( is_post_type_archive( 'leadership' ) )
        return $image_size;
      
      if( in_array( 'teaser', get_post_class() ) )
        $image_size = 'leadership-image';
      
      return $image_size;
    }
    
    //Custom Image Size for Service and Portfolio CPT
    function be_cpt_image_size( $image_size ) {
      
      // Only run on the 'leadership' post type archive
      if( is_post_type_archive( 'service' || 'project' ) )
        return $image_size;
      
      if( in_array( 'teaser', get_post_class() ) )
        $image_size = 'archive-thumbnail';
      
      return $image_size;
    }
    
    add_filter( 'genesis_pre_get_option_image_size', 'be_cpt_leadership_size', 20 );
    add_filter( 'genesis_pre_get_option_image_size', 'be_cpt_image_size', 20 );

    but it's not showing the right image sizes.


    Graybill Creative | Twitter

    December 5, 2013 at 12:02 pm #77254
    Brad Dalton
    Participant

    Depends on how you generate the archive page.

    1. If you are using a template for each CPT archive, you could add this code to the template file.

    Change the large to your own size set in the WordPress Media Settings or use the name for your custom image sizes.

    Note the 3rd parameter which you may remove or change. The code also includes HTML 5 loop hooks.

    May not work with a plugin you have installed however it does work on CPT archive templates.

    2. Or you could use CSS.

    .category-portfolio .post-image {
    width: 50px;
    height: 50px;
    }
    

    Always a good idea to make sure your featured images are cropped to exactly the same size before adding them to an pages/posts included in an archive.


    Tutorials for StudioPress Themes.

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