Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter retrogamer

    (@retrogamer)

    Hi @anlino ,

    I think you’re correct with this. It appears the browser will pull in the highest resolution image available from the srcset automatically.

    Now that I’ve removed the 1080px images, it’s pulling in the 1024px versions. So I know it works, and I think I can live with that size and the loading times aren’t too bad!

    I’m happy that this is resolved now and thanks so much for your incredible support.

    Thread Starter retrogamer

    (@retrogamer)

    Hi @anlino

    So this has worked! eksell_preview_image is now registered as 540pixels!

    Now when I refresh the homepage (cache cleared) and inspect a sample image to check its size, I get something like this example:

    <img width="540" height="360" src="https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01-540x360.jpg" class="attachment-eksell_preview_image size-eksell_preview_image wp-post-image" alt="Mario's Time Machine, SNES" decoding="async" loading="lazy" srcset="https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01-540x360.jpg 540w, https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01-300x200.jpg 300w, https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01-1024x683.jpg 1024w, https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01-768x512.jpg 768w, https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01-1536x1024.jpg 1536w, https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01-1080x720.jpg 1080w, https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01.jpg 1600w" sizes="(max-width: 540px) 100vw, 540px">

    But strangely, if I right-click the same image and open in a new tab, it’s the 1080p version. In this case, https://www.mariomuseum.com/wp-content/uploads/2023/01/snes-marios-time-machine-01-1080×720.jpg

    The Chrome code inspector says the image intrinsic size is also 1080 × 720 px

    So I’m not sure if it’s having the desired effect?

    Sorry I don’t wish to take up too much of your time with this. Thank you.

    Thread Starter retrogamer

    (@retrogamer)

    Thanks @anlino

    This makes total sense, thank you.

    I’ve tried the code above in my child theme that I already have set up, and I’m not seeing any change to the registered size for eksell_preview_image. It’s still 1080 pixels.

    To rule other things out, I have also tried it with the following:

    • all plugins deactivated
    • temporarily in the parent theme functions.php
    • all caches cleared each time

    From the quick bit of online research I’ve done, I’m wondering if it’s to do with loading sequence? How do I ensure this code in the child theme redefines the image size?after?the parent theme adds it? I’m guessing the ‘after_setup_theme’ does this?

    I’m at a loss otherwise, but if you have any other suggestions I would be very grateful. I feel as if I’m very close to solving this one!

    • This reply was modified 1 year, 10 months ago by retrogamer.
    Thread Starter retrogamer

    (@retrogamer)

    Hi @anlino

    The “About” page does have some low-resolution images but the vast majority on the site are 1600x1067px, so above the “large” threshold, and these are the ones I’m concerned about as they’re a bit laggy when rendering on the homepage.

    I’ve just noticed that if I change the preset for the gallery block, it does indeed change the size, for example, https://www.mariomuseum.com/wp-content/uploads/2023/01/famicom-robot-01.jpg becomes https://www.mariomuseum.com/wp-content/uploads/2023/01/famicom-robot-01-768×512.jpg

    So not exactly the medium preset of 300px I was expecting, but still reduced, and that’s great for those individual posts.

    But the homepage itself with latest posts, doesn’t seem to have the same kind of option. All the “thumbnails” on the homepage are using the full size images. I’m not sure how to change that now without resizing everything. Is there any hook I can use so it brings in a smaller version?

    • This reply was modified 1 year, 10 months ago by retrogamer.
    Thread Starter retrogamer

    (@retrogamer)

    This works perfectly! Thank you so much @anlino

    I’m really enjoying building my website now using your theme!

    It’s really cool as well that I can use a lightbox plugin to compliment the image gallery option.

    If you could build this in natively in a future update I’m sure many would benefit from it.

    Excellent work!

    Thread Starter retrogamer

    (@retrogamer)

    Hi @anlino

    I’ve tested this in a fresh install to make sure it wasn’t an issue with my site.

    It’s helped me confirm that the filter category does indeed get excluded from the list.

    But the posts assigned with that category still remain. I was hoping that excluding the category from the list would also exclude those posts from appearing.

    Is it possible to do that?

    Thanks very much!
    Steve

    Thread Starter retrogamer

    (@retrogamer)

    Thanks @anlino for your help.

    This doesn’t seem to work for me.

    I’ve followed these steps but no change.

    • Copied the above code into functions.php in the child theme
    • Changed the ID to 59 which is the tag ID of my “Blog” category
    • The test blog post assigned to that category continues to appear on the homepage, after clearing the cache and deactivating/reactivating the child theme
    • As a side note, I got the following code from another site that does remove the post, only for it to appear again, when ‘show all’ is clicked:

      function exclude_category($query) {
      if ( $query->is_home() ) {
      $query->set('cat', '-59');
      }
      return $query;
      }
      add_filter('pre_get_posts', 'exclude_category');
    • This reply was modified 2 years, 4 months ago by retrogamer.
    • This reply was modified 2 years, 4 months ago by retrogamer.
    • This reply was modified 2 years, 4 months ago by retrogamer.
    Thread Starter retrogamer

    (@retrogamer)

    Wow, thanks @anlino

    You’ve made that change really quickly and it works great ??

    There is a minor issue in that empty parent categories return ‘0’ which is technically correct, but in reality when you click them, they contain all their child category posts, so the zero is misleading. An example on my site would be ‘systems’.

    But this is not a big issue though as I can get around it by rethinking how I group my categories.

    Thanks again for the great support.

    Thread Starter retrogamer

    (@retrogamer)

    I think I need to edit this code in template-tags.php?

    // Use the eksell_home_filter_get_terms_args filter to modify which taxonomy is used for the filtration.
    		$terms = get_terms( apply_filters( 'eksell_home_filter_get_terms_args', array(
    			'depth'		=> 1,
    			'taxonomy'	=> $filter_taxonomy,
    		) ) );
    Thread Starter retrogamer

    (@retrogamer)

    That’s awesome, thanks @anlino

    I will keep an eye out for it with interest.

Viewing 10 replies - 1 through 10 (of 10 total)