How to change the catalog product image size by product id?

You can use the single_product_archive_thumbnail_size filter to change which image size is used for a particular product: function wpse_287488_product_thumbnail_size( $size ) { global $product; if ( $product->get_id() === 123 ) { $size=”medium”; } return $size; } add_filter( ‘single_product_archive_thumbnail_size’, ‘wpse_287488_product_thumbnail_size’ ); Just replace medium with the registered image size you want to use. See this codex … Read more

Need to convert image url to a Base_64 data url with wordpress function..

In your post you wrote : “which will show an image like below”, I assume that your shortcode return an img tag and you have to find your URL here, tell me if I’m wrong. Using DOMDocument http://php.net/manual/fr/class.domdocument.php to parse your img tag is a good idea. $img = do_shortcode(‘[user_meta_avatar_pic]’); // Here your get your … Read more

Large amount image data transfer

Yes, to answer your question as it is: It is possible. If you’re also looking to find out HOW, you would need to tell us more information about your hosting though. Do you have ssh access, FTP acess? Is it shared hosting or do you have full access? If you have SSH here’s what I … Read more

get_children returns older images

Your problem is here: ‘order’ => ‘ASC’, ‘numberposts’ => ‘-1’, ‘orderby’ => ‘menu_order ID’)); You asked for them to be ordered by menu order, then ID. Then you asked for them to be given in ascending order. Since newer posts have higher IDs than older posts, older posts get shown first. Flip the ASC to … Read more

Display attached images as background-image css

using this code <?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ ); ?> <div class=”single-parallax-image” style=”background-image:url(“<?=$image[0]; ?>”)”><?=get_the_content()?></div> </div> <?php endif; ?>

Alt text not showing up

Your caption shortcode seems to be missing the most important part: the image. The caption shortcode in WordPress usually looks like this: There you can see the alt attribute, which is automatically set when you enter the alt text after uploading an image (here: “Kanagawa”). The alt text is not visible to users, but to … Read more

Hide Featured Image box – isn’t working?

The context or the 3rd parameter of remove_meta_box() function for tags meta box and featured image meta box is side. And perfect hook to remove meta box is add_meta_boxes. So try the following code, hope it’ll work as expected. function my_remove_meta_boxes() { if ( ! current_user_can( ‘administrator’ ) ) { remove_meta_box( ‘tagsdiv-post_tag’, ‘post’, ‘side’ ); … Read more