Featured Image Cropping on Portfolio Page

Hello,

I am utilizing the portfolio page as a “Team Member” page and want the featured images to be square. I’ve tried several solutions that I’ve found in the forum but nothing seems to change the fact that the theme seems to be creating a cropped (1200 x 671) version of the image. How do I get it to use the full size image instead of the cropped image?

http://inspirebx.com/about-us/practice-team-members/

Thanks.

Hi,

To get it to use full size, you can add the code below in your child theme’s functions.php file

 function x_featured_image( $cropped = '' ) {
    $stack     = x_get_stack();
    $fullwidth = ( in_array( 'x-full-width-active', get_body_class() ) ) ? true : false;
    $portfolio_layout = ( in_array( 'post-type-archive-x-portfolio', get_body_class() ) ) ? true : false; 

    if ( has_post_thumbnail() ) {
      if ( $cropped == 'cropped' ) {
        if ( $fullwidth ) {
          $thumb = get_the_post_thumbnail( NULL, 'entry-cropped-fullwidth', NULL );
        } else {
          $thumb = get_the_post_thumbnail( NULL, 'entry-cropped', NULL );
        }
      } else {
        if ( $fullwidth ) {
          $thumb = get_the_post_thumbnail( NULL, 'entry-fullwidth', NULL );
        } else {
          $thumb = get_the_post_thumbnail( NULL, 'entry', NULL );
        }
      }
      
      if($portfolio_layout){
          $thumb = get_the_post_thumbnail( NULL, 'entry-fullwidth', NULL );
      }
            
      
      switch ( is_singular() ) {
        case true:
          printf( '<div class="entry-thumb">%s</div>', $thumb );
          break;
        case false:
          printf( '<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>',
            esc_url( get_permalink() ),
            esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ),
            $thumb
          );
          break;
      }
    }
  }

Thank you! Worked perfectly.

We are delighted to assist you with this.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.