Images thumbnail not cropping square
I found the solution. The problem was not in my code, but in the xampp! The GD extension was missing
I found the solution. The problem was not in my code, but in the xampp! The GD extension was missing
Why not attaching images after impoting using wp cli
If you changed the picture and the size still the same, it’s either your code that displays it or just browser caching. If you wanted to view the image after you update the size, try using incognito. I’m being quite abstract here, give more info if this doesn’t work.
Since you’re using Astra Theme , you need to create a new “archives” template and set the display conditions. In that template, you can choose only to show what you want and hide or remove the images. This is Theme related, and not WordPress related as @vancoder pointed out.
If someone has clashed with such problem, I solved it in this way: $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, ‘post_parent’ => $post_id ) ); $thumbId = get_post_thumbnail_id($post_id); foreach ( $attachments as $attachment ) { if($thumbId != $attachment->ID) wp_delete_attachment( $attachment->ID, true ); }
wp_get_attachment_metadata – Retrieve attachment meta field for attachment ID. $image_meta = wp_get_attachment_metadata( $attachment_id, $unfiltered ); As you can see, the width x height is nested in sizes for each size. Array ( [width] => 2400 [height] => 1559 [file] => 2011/12/press_image.jpg [sizes] => Array ( [thumbnail] => Array ( [file] => press_image-150×150.jpg [width] => 150 … Read more
You can get the post thumbnail HTML using the function get_the_post_thumbnail(), so you just need to replace get_the_title() with that function: $string .= ‘<li><a href=”‘. get_permalink() .'”>’. get_the_post_thumbnail() .’ </a></li>’; By default the image will be the size defined by your theme, but you use any of the other available sizes by passing the size … Read more
Strange image artifact on font-page thumbnail image
I changed to: $attch_id = get_post_thumbnail_id( $my_query->post->ID ); $thumbnail_arr = wp_get_attachment_image_src($attch_id, “medium”); $thumbnail = $thumbnail_arr[0]; and $thumbnail is returning what I want now.
get_post_thumbnail_id() not getting correct featured image after post edited