-
AuthorPosts
-
April 12, 2020 at 2:44 pm #1203092
Today I discovered that in some archive pages the images are not showing.
Where can the problem be?
I have this functions you shared.
// tag and archive as grid add_filter('avf_blog_style','avia_change_tag_blog_layout', 10, 2); function avia_change_tag_blog_layout($layout, $context){ if($context == 'tag') $layout = 'blog-grid'; return $layout; } add_filter('avf_blog_style','avia_change_category_blog_layout', 10, 2); function avia_change_category_blog_layout($layout, $context){ if($context == 'archive') $layout = 'blog-grid'; return $layout; } // tag and archive as grid /** * Set sizes atribute for responsive images and better performance * @param array $attr markup attributes * @param object $attachment WP_Post image attachment post * @param string|array $size named image size or array * @return array markup attributes */ function avf_responsive_img_sizes( $attr, $attachment, $size ) { if ( is_array( $size ) ) { $attr['sizes'] = $size[0] . 'px'; } elseif ( $size == 'widget') { $attr['sizes'] = '36px'; } elseif ( $size == 'square') { $attr['sizes'] = '180px'; } elseif ( $size == 'featured') { $attr['sizes'] = '1500px'; } elseif ( $size == 'featured_large') { $attr['sizes'] = '1500px'; } elseif ( $size == 'extra_large' ) { $attr['sizes'] = '1500px'; } elseif ( $size == 'portfolio' ) { $attr['sizes'] = '495px'; } elseif ( $size == 'portfolio_small' ) { $attr['sizes'] = '260px'; } elseif ( $size == 'gallery' ) { $attr['sizes'] = '845px'; } elseif ( $size == 'magazine' ) { $attr['sizes'] = '710px'; } elseif ( $size == 'masonry' ) { $attr['sizes'] = '705px'; } elseif ( $size == 'entry_with_sidebar' ) { $attr['sizes'] = '845px'; } elseif ( $size == 'entry_without_sidebar' ) { $attr['sizes'] = '1210px'; } return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'avf_responsive_img_sizes', 30, 3 );
Should I remove the ones for images?
Thanks.
April 12, 2020 at 10:25 pm #1203169April 12, 2020 at 10:50 pm #1203170I didn’t remove images for some posts and others not to have things incorrect. Starting page 3 till the end all images appear fine, so there is something else.
How can I fix those and regenerate them?
Thanks.
April 13, 2020 at 2:02 am #1203193Hi,
Each of those images are using the original full-size image and not the 495 image.
To regenerate the images you could try this plugin, but I recommend checking that the “portfolio” size is being created, try adding this code to the end of your functions.php file in Appearance > Editor:function your_thumbnail_sizes() { global $_wp_additional_image_sizes; print '<pre>'; print_r( $_wp_additional_image_sizes ); print '</pre>'; } add_shortcode('your-sizes', 'your_thumbnail_sizes');
and then create a new page with this shortcode
[your-sizes]
to display the sizes.Best regards,
MikeApril 13, 2020 at 8:30 am #1203246Each of those images are using the original full-size image and not the 495 image.
You mean post?
But it is not using full size, it is a 404 error.
I get this:
Array ( [1536x1536] => Array ( [width] => 1536 [height] => 1536 [crop] => ) [2048x2048] => Array ( [width] => 2048 [height] => 2048 [crop] => ) [widget] => Array ( [width] => 36 [height] => 36 [crop] => ) [square] => Array ( [width] => 180 [height] => 180 [crop] => ) [featured] => Array ( [width] => 1500 [height] => 430 [crop] => ) [featured_large] => Array ( [width] => 1500 [height] => 630 [crop] => ) [extra_large] => Array ( [width] => 1500 [height] => 1500 [crop] => ) [portfolio] => Array ( [width] => 495 [height] => 400 [crop] => ) [portfolio_small] => Array ( [width] => 260 [height] => 185 [crop] => 1 ) [gallery] => Array ( [width] => 845 [height] => 684 [crop] => ) [magazine] => Array ( [width] => 710 [height] => 375 [crop] => ) [masonry] => Array ( [width] => 705 [height] => 705 [crop] => ) [entry_with_sidebar] => Array ( [width] => 845 [height] => 321 [crop] => ) [entry_without_sidebar] => Array ( [width] => 1210 [height] => 423 [crop] => ) [medium_large] => Array ( [width] => 768 [height] => 0 [crop] => ) [shop_thumbnail] => Array ( [width] => 120 [height] => 120 [crop] => ) [shop_catalog] => Array ( [width] => 450 [height] => 450 [crop] => ) [shop_single] => Array ( [width] => 450 [height] => 999 [crop] => ) )
How can I regenerate those 30 ones. I don’t want to regenerate 50,000 images.
Thanks.
April 14, 2020 at 1:50 pm #1203576Hi,
It looks like your “portfolio” size, 495, is activate so they should regenerate.
The Regenerate Thumbnails has the option to skip over images that already have correctly-sized thumbnails.
This should leave only the missing ones to regenerate.Best regards,
MikeApril 14, 2020 at 2:17 pm #1203591It goes for all images that exists and marks 8 days for the job.
I need to update 30 posts. Manually if it’s the case.
How to regenerate “ONLY” the missing images.
Thanks.
April 15, 2020 at 1:33 pm #1203967Hi,
It looks like WP-CLI can only generate thumbnails for images missing image sizes with[--only-missing]
, if you know how to use WP-CLI Here is the official site. This answer says it takes about 30 seconds for this to correct 4000 images.
But I didn’t find an alternative to this or a plugin to do the same, perhaps I missed it.
Did you try to manually regenerate one image to see if this helps?Best regards,
MikeApril 15, 2020 at 3:51 pm #1204019How can I regenerate it manually?
Thanks.
April 18, 2020 at 5:39 pm #1205057 -
AuthorPosts
- You must be logged in to reply to this topic.