Featured image

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20477
    YourMedLife
    Customer

      Hello,

      I use “portfolio-thumbnail” (348, 240) on last posts page (http://yourmedlife.com/blog/). That’s ok, but I would like to use “featured-content-sm” (700, 350) above the entry content instead of “portfolio-thumbnail” (maintaining “portfolio-thumbnail” on last posts page)

      How can I do that?

      Thank you

      #20490
      Wes
      Moderator

        I’m actually adding an update to the code for this theme that fixes a minor issue with the Featured Images. This same udpate/code will allow you to add in your own image size. Here’s how to do it –

        First, search for the following code in your functions.php file –

        // Add featured image above the entry content
        add_action( 'genesis_before_entry', 'aspire_featured_photo' );
        function aspire_featured_photo() {
        
            if ( ! ( is_singular() && has_post_thumbnail() ) ) {
                return;
            }
        
            $image = genesis_get_image( 'format=url&size=single-posts' );
        
            $thumb_id = get_post_thumbnail_id( get_the_ID() );
            $alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true );
        
            if ( '' == $alt ) {
                $alt = the_title_attribute( 'echo=0' );
            }
        
            printf( '<div class="featured-image"><img src="%s" alt="%s" class="entry-image"/></div>', esc_url( $image ), $alt );
        }

        Next, “comment out” or completely remove & replace that code with this instead –

        // Register a custom image size for featured image on single Posts
        add_image_size( 'post-image', 740, 460, true );
        
        // Add featured image above the entry content
        add_action( 'genesis_before_entry', 'aspire_featured_photo' );
        function aspire_featured_photo() {
        
            if ( ! ( is_singular() && has_post_thumbnail() ) ) {
                return;
            }
        
            $image = genesis_get_image( 'format=url&size=post-image' );
        
            $thumb_id = get_post_thumbnail_id( get_the_ID() );
            $alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true );
        
            if ( '' == $alt ) {
                $alt = the_title_attribute( 'echo=0' );
            }
        
            printf( '<div class="featured-image"><img src="%s" alt="%s" class="entry-image"/></div>', esc_url( $image ), $alt );
        }

        You can change the 2nd line to whatever size you want it to be.

        If you want me to login and change it for you just let me know. The update for this will be released early next week.

        Let me know if that helps.

        #20491
        YourMedLife
        Customer

          Thank you very much West, it works perfectly 馃槈

        Viewing 3 posts - 1 through 3 (of 3 total)
        • The topic ‘Featured image’ is closed to new replies.