Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #886974
    cmeklir
    Participant

    We have a gallery page that is using the layout-portfolio template. It is displaying featured images of portfolio items and cropping them. The stack choice is Integrity.
    What do I need to change in order to stop cropping of the images?

    #887476
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! The featured images will automatically insert the custom image size hard coded in X. This size is set by default which will be calculated based on the global layout settings. If you want to display the full image, what you are trying to accomplish requires a template customization, we would like to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Once you already have your child theme active and ready, please insert this following code 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;
      $full = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
    
      if ( has_post_thumbnail() ) {
    
        $thumb = get_the_post_thumbnail( NULL, 'full', NULL );
    
        //var_dump($thumb);
    
        switch ( is_singular() ) {
          case true:
            printf( '<div class="entry-thumb">%s</div>', $thumb );
            break;
          case false:
            printf( '<a href="%1$s" data-rel="lightbox easy" class="entry-thumb" title="%2$s">%3$s</a>',
              $full[0],
              esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ),
              $thumb
            );
            break;
        }
    
      }
    
    }

    Hope this helps.

    #888435
    cmeklir
    Participant

    Yes, but I want them smaller just not cropped. How would I change the above code to get one of the other WordPress image sizes?

    #889284
    Lely
    Moderator

    Hi There,

    The above suggestion will stop the cropping of the images. If you want to display the image not cropped and smaller, we need to add CSS to manage the display aside from above suggestion. Please do give us the URL of the page so we can help you better with some custom CSS.

    Always,
    X

    #892344
    cmeklir
    Participant

    Thanks that got it without changing any css.

    #892935
    John Ezra
    Member

    You’re most welcome! 🙂

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