I imagine I am lacking one thing on media photos.
I’ve created a customized picture measurement with this code:
add_image_size( '250-square', 250, 250, true); // cropped
I’ve then uploaded photos. After I examine within the applicable uploads listing in my set up I see that the picture is uploaded and totally different sizes have been created.
I’ve set my thumbnail dimensions to 75×75 arduous crop in order that there will likely be 2 totally different photos with a 1:1 ratio if a picture is uploaded that isn’t 1:1 as it’s my understanding that is wanted to create a srcsest.
For instance I uploaded a picture (myimage.png) with dimensions of 1507 × 1267.
Within the listing I’ve:
- myimage.png
- myimage-75×75.png
- myimage-250×250.png
- myimage-400×400.png
- myimage-1200×1200.png
- myimage-768×336.png
- myimage-1024×861.png
- myimage-1507×500.png
In my loop I am calling the thumbs with this code:
<div class="product_cat <?php echo $kidcount;?>"> //simply outputs what number of youngsters are within the class
<a href="<?php the_permalink();?>">
<?php the_post_thumbnail('250-square');?>
<h2><?php echo get_the_title();?></h2>
</a>
</div>
Nevertheless that is what’s being generated:
<div class="productCategories grid">
<div class="product_cat 5">
<a href="https://examplesite.com/merchandise/biglight-36-4000-landing-light/">
<img src="https://examplesite.com/wp-content/uploads/2020/10/aeroleds-biglight-4000-landing.png" class="attachment-250-square size-250-square wp-post-image" alt="A picture of Aeroleds biglight 4000 Touchdown" width="250" top="210">
<h2>biglight 36-4000</h2>
</a>
</div>
<div class="product_cat 5">
<a href="https://examplesite.com/merchandise/biglight-36-4000-taxi-light/">
<img src="https://examplesite.com/wp-content/uploads/2020/10/biglight_36_4587_4314_Taxi_SH.png" class="attachment-250-square size-250-square wp-post-image" alt="A picture of biglight 36 4587 4314 Taxi Sh" loading="lazy" srcset="https://examplesite.com/wp-content/uploads/2020/10/biglight_36_4587_4314_Taxi_SH.png 450w, https://examplesite.com/wp-content/uploads/2020/10/biglight_36_4587_4314_Taxi_SH-75x75.png 75w" sizes="(max-width: 250px) 100vw, 250px" width="250" top="250">
<h2>biglight 36-4000</h2>
</a>
</div>
</div>
The primary picture does not generate a srcset and is not loading at 250×250 nor does it name the 250×250 model of the picture. the remainder of the photographs (i eliminated them for simplicity on this query) work because the 2nd picture within the output proven right here.