<img width="230" height="300" src="https://aaa.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt=""> 

When displaying thumbnails, WordPress adds width = "230" height = "300" to the size of the image, but they really hinder me (I put the masonry grid). How can I remove them so that img does not turn into a 0x0 point?

Or what to do with WordPress, so that it does not display the width and height?

Addition

 <?php while ( have_posts() ) { the_post(); echo "<a class=\"wp-block-image\" href='"; echo the_permalink(); echo "'>"; echo the_post_thumbnail(); echo "</a>"; }; ?> 

js

 var $grid = $('.cat').masonry({ $grid.imagesLoaded().progress( function() { $grid.masonry('layout'); }); 

css

 .wp-block-image { float: left; border: 1px solid hsla(0, 0%, 0%, 0.5); width: calc(33.3% - 20px); } 
  • With proper layout, these widths and heights do not interfere. I output a masonry grid with width, height and srcset, and everything works fine. What is your problem? Show the php code and the resulting html / css. - KAGG Design
  • added output code - Tigran Vardanyan
  • The code is clear. What you specifically fail? - KAGG Design pm
  • The problem was solved, the fact was that if img does not have a given height and assign it height: 100%, then for some reason it gets the value - height: 3.72827e + 07px. And if given, it turns out fine. I did this task after another, in which img was not set to height and did not assign height: 100% because I thought it would spoil everything, but on the contrary, it helped. - Tigran Vardanyan

0