• 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

J Korn

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
  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • February 4, 2013 at 4:48 pm in reply to: How to add a class to an image within loop #18058
    J Korn
    Member

    Thanks for the response, Carrie.

    Are you using your own custom loop/query or using genesis_custom_loop to loop through your posts?

    No.  I'm using a template, archive-customtype.php, and within that, just trying to filter the image to add in/modify the class. I was looking through the Genesis code, specifically the image.php file and saw the following within genesis_get_image:

    
    $defaults = apply_filters( 'genesis_get_image_default_args', array(
     'format' => 'html',
     'size' => 'full',
     'num' => 0,
     'attr' => '',
     'fallback' => 'first-attached',
     ) );
    
    

    So, I assumed I could filter the genesis_get_image_default_args, however, my code above seems to have no effect.  I've found another way around what I was trying to do, but seems like using genesis_get_image_default_args would have made more sense.

    For your reference, here is what my archive template looked like before (pretty straight forward):

    remove_action( 'genesis_before_post_content', 'genesis_post_info' ); // Remove post info
    remove_action( 'genesis_after_post_content', 'genesis_post_meta' ); // Remove post meta
    add_filter( 'genesis_get_image_default_args', 'korndev_archive_image'); // Modify image
    
    
    function korndev_archive_image( $args ){
     $args = array( 'attr' => array('class'=>'aligncenter') );
     return $args;
    }
    genesis();
    

    Thanks!

  • Author
    Posts
Viewing 1 post (of 1 total)

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