Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1338732
    richardcreative
    Participant

    Hello! Is it possible to have the thumbnail/featured images display on the blog page in their original aspect-ratio? So not cropped? We are using a mix of vertical and horizontal images, and although I’ve set the thumbnail size to 150×150 square, the blog page is showing them not square at all, but horizontal.

    http://591.ccf.myftpupload.com/blog/

    Thanks in advance for your help!

    #1339072
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! By the default, the featured images in the blog index were displaying the entry thumb, (an X default size) and not the thumbnail size. You will have to override the X default so that it will use the thumbnail size. To do that, please insert this following code in your child theme’s functions.php file.

    if ( ! function_exists( 'x_featured_image' ) ) :
      function x_featured_image( $cropped = '' ) {
    
        $stack     = x_get_stack();
        $fullwidth = ( in_array( 'x-full-width-active', 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 ( is_home() || is_archive() ) {
            $thumb = get_the_post_thumbnail( NULL, 'thumbnail', 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;
          }
    
        }
    
      }
    endif;

    We would loved to know if this has work for you. Thank you.

  • <script> jQuery(function($){ $("#no-reply-1338732 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>