Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1293093
    gonpla
    Participant

    Hi,
    We have the following website with this theme: http://blog.garciajoyeros.com/
    When I launch page speed process (https://developers.google.com/speed/pagespeed/insights) I have errors with the image optimization because the image is shown on the homepage little but the image you are picking up internally is larger.
    It only affects the homepage.
    I attach a snapshot.

    Please, can you help me?
    Thank you.

    Regards,
    Rubén.

    #1293333
    Nico
    Moderator

    Hey Gonpla,

    Thanks for writing in.

    Please see our article on performance at https://theme.co/x/member/kb/performance/. Overall website performance is a complex setup and that depends on many other factors. With that said, that requires a separate service beyond the scope of our support. If you’re not comfortable dealing with technical things, we recommend that you seek advice or help from a WordPress developer.

    Thank you for understanding.

    #1293930
    gonpla
    Participant

    Hi, I know that the performance is complex, but I understand that the theme is not working correct. One thing is performance, cache, etc. and another thing is that the main page does not capture the images in the size in which it shows them. It should get a thumbnail instead of the big picture.

    I bought this theme twice ($64 x 2) and for once I ask a question you don’t give me support.

    I know I culd contact a developer and fix it but I don’t have to. I bought a theme and it doesn’t work as it should.
    I’m a developer, but I don’t know the structure of the theme. At least I would need to be given a guide to the files that I must modify in order to work as it should.

    Regards.

    #1293954
    Rue Nel
    Moderator

    Hello There,

    Sorry for the confusion. Please be advise that by default X will display a custom image size with your featured image. This image dimension were calculated based from your site width and layout being set in customizer. If the image uploaded is quite smaller than the custom image size, it will use the original image instead. And if you want to override this default way of displaying the images, you can modify this instead and display smaller size or the thumbnail.

    Because 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.

    After the child theme is set up, please add the following code in your child theme’s functions.php file

    // Use thumbnail or medium size image for 
    // feature image in blog index or archive pages
    // =============================================================================
    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() || is_search() ) {
            //
            // you can use 'thumbnail' or 'medium'
            //
            $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;
    // =============================================================================

    Once you have the code in place, the image size displayed in your site should changed.

    Please let us know how it goes.

    #1294036
    gonpla
    Participant

    Hello,
    Since the above answer was not helpful, I’ve been investigating myself and found exactly that code in the template (in /themes/x/framework/functions/global/featured.php). Specifically I have put “medium” instead of “thumbnail” and it works perfectly.
    Thank you.

    #1294076
    Christian
    Moderator

    Glad you’ve sorted it out.

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