Navigation

Tagged: 

  • Author
    Posts
  • #1325839

    Jan S
    Participant

    Hello,

    when using the Ethos Stack plus the “Post Carussel” Slider at the top, i noticed that all of the images used there are 1:1, original, in my case: super large.

    How can i set the images to be of size “medium” (at most) ?

    Allbest
    Jan

    Attachments:
    You must be logged in to view attached files.
    #1325981

    Rupok
    Moderator

    Hi Jan,

    Thanks for writing in! It looks fine on the screenshot. Would you share your URL so that we can check?

    Cheers!

    #1326965

    Jan S
    Participant

    Rupok,

    It looks fine, yes, but its full res! I need (and recommend) medium size at most.

    Check: http://demo.theme.co/ethos-1/

    “castle.jpg” is 1200x750px, 112kb, where 500x? would be completely sufficient (the image will *never* be much larger than that, so why not serve properly scaled images in favor of faster loading times?)

    In my case, the client users UHD-Images at >2.400px, resulting in like 20 MB just for the top slider!

    #1327128

    Paul R
    Moderator

    Hi,

    To make it pull medium size image, you can add this in your child theme’s functions.php file.

    
     function x_ethos_entry_cover( $location ) {
    
        if ( $location == 'main-content' ) { ?>
    
          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <a class="entry-cover" href="<?php the_permalink(); ?>" style="<?php echo x_ethos_entry_cover_background_image_style(); ?>">
              <h2 class="h-entry-cover"><span><?php x_the_alternate_title(); ?></span></h2>
            </a>
          </article>
    
        <?php } elseif ( $location == 'post-carousel' ) { ?>
    
          <?php GLOBAL $post_carousel_entry_id; ?>
    
          <article <?php post_class(); ?>>
            <a class="entry-cover" href="<?php the_permalink(); ?>" style="background-image: url('<?php echo x_make_protocol_relative( x_get_featured_image_url('medium') );?>');">
              <h2 class="h-entry-cover"><span><?php ( $post_carousel_entry_id == get_the_ID() ) ? the_title() : x_the_alternate_title(); ?></span></h2>
              <div class="x-post-carousel-meta">
                <span class="entry-cover-author"><?php echo get_the_author(); ?></span>
                <span class="entry-cover-categories"><?php echo x_ethos_post_categories(); ?></span>
                <span class="entry-cover-date"><?php echo get_the_date( 'F j, Y' ); ?></span>
              </div>
            </a>
          </article>
    
        <?php }
    
      }
    

    Hope that helps.

    #1331934

    Jan S
    Participant

    Paul,

    imho this should be default, but thank you very, very much for the snippet! Saved work on my end and works perfectly!

    All best
    Jan

    #1331961

    Paul R
    Moderator

    You’re welcome! 🙂

Purchase for access

Buy a copy of X for access to our member center.

Buy