Can I stop wordpress generating media sizes
You can use remove_image_size() to remove previously registered image sizes. Ex : <?php remove_image_size(‘full-width-image-gallery’); ?> Note: Cannot be used on reserved image size names
You can use remove_image_size() to remove previously registered image sizes. Ex : <?php remove_image_size(‘full-width-image-gallery’); ?> Note: Cannot be used on reserved image size names
I think you can simple use this plugin https://wordpress.org/plugins/ewww-image-optimizer/ and then try again. That should work. But solve the problem I need to know if you are using woocommerce plugin or if it is a online store website. If so then you need to adjust the image size first in the woocommerce >> Settings >> … Read more
This is correct. To have the Restore Original Image, you need to alter the image first. Also for the thumbnails, if if ( $thumb && $sub_sizes ) condition is not met (if the image doesn’t have thumbs) you will not see the thumbnails section. File: wp-admin/includes/image-edit.php 143: <?php if ( $thumb && $sub_sizes ) { … Read more
When using the Insert Media button, you need to set the Link To in the attachment details to the media file. This is visible in the following picture in the bottom right:
Using my own code from here, i updated the logic to add the name of the image size instead of the suffix, try adding this to your functions.php file: add_filter(“wp_image_editors”, “my_wp_image_editors”); function my_wp_image_editors($editors) { array_unshift($editors, “WP_Image_Editor_Custom”); return $editors; } // Include the existing classes first in order to extend them. require_once ABSPATH . WPINC . … Read more
esc_attr() might not be necessary on the url retrieved by wp_get_attachment_image_src. I have referred to a code example from the WordPress Codex page on wp_get_attachment_image_src and adapted the following code that works for me. global $post; $thumbnailSrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), ‘medium’); if ( $thumbnailSrc ) : echo ‘<meta property=”og:image” content=”‘.$thumbnailSrc[0].'”>’; endif; Edit: Since you are using … Read more
For the record since I ended up here when experiencing the same issue on my localhost: In php.ini, Uncomment the line with: extension=php_gd2.dll Restart apache / all services This sorted it out for me (I may have switched a few other services on while I was there, but I believe this is what fixed it!)
The get_children function retrieves posts (an upoaded image is also a post) that are dependent on the post with a certain ID. An image becomes a child of a post when it is uploaded while editing that post. It does not become a child of a post when it is reused. So if you are … Read more
<?php $images = get_field(‘gallery’); $size=”full”; // (thumbnail, medium, large, full or custom size) $rand = array_rand($images, 1); if( $images ): ?> <?php echo wp_get_attachment_image( $images[$rand][‘ID’], $size ); ?> <?php endif; ?> This code should work. array_rand() return key if second param set to 1 or array with keys if second param > 1
You can either manually insert the image tags – try adding one through the media library first to see the code it generates, then go into the Text Editor rather than the Visual Editor and change the URL to one of your images – or you can code a theme template that would match up … Read more