How can the alt be added to this wooCommerce category image?

Something like this? $image_alt = get_post_meta( $image->id, ‘_wp_attachment_image_alt’, true); To use in your string: if ($image) echo ‘<img src=”‘ . esc_url($image) .'” alt=”.$image_alt.”>woocommerce-CJD”>’; Use it under the $image declaration. In your $image declaration make sure youll get the image attachment via wp_get_attachment_image() function.

Image linking and lightbox

So, the problem is that on Expositio theme they are adding some jQuery code to all links, that if you’re not closing the mobile menu, after a configurable number of seconds (1 second by default) just redirect site to the link url. If you go to line 260 of js/functions.js you find this: $(‘a’).on(‘click’, function(e) … Read more

Adding a URL Parameter to JPEG images in posts

function add_jpeg_params($content){ preg_match_all(“/https?:\/\/[^\/\s]+\/\S+\.(jpg|jpeg)/”, $content, $output_array); $items_to_replace = array_unique($output_array[0]); $items_to_replace = array_values($items_to_replace); for ($j = 0; $j < sizeof($items_to_replace); $j++) { $content = str_replace($items_to_replace[$j], $items_to_replace[$j] . ‘?t=” . time(), $content); } return $content; } add_filter(“the_content’,’add_jpeg_params’,10); add_filter(‘post_thumbnail_html’, ‘add_jpeg_params’ );

Image Uploader Doesn’t Open Modal in Widget

After many hours of testing and exploring I finally found what causing the problem. If I add class to the button it’s working. But not any class, only class deo-btn. So, this will work: <input type=”button” id=”image-upload-button” class=”deo-btn button button-primary” value=”Add Image”> And this is not: <input type=”button” id=”image-upload-button” class=”button button-primary” value=”Add Image”> Also, this … Read more

Image automatically resized

The ‘?w=640’ on the end of the image file is not a bad thing, it just tells the browser what size to display. If you want to modify the size of the image try these methods: (1) The simplest method is to edit the image on the page. When you’re in the Visual Editor of … Read more

WooCommerce Variation Swatches and Photos – get attribute thumbnail

I resolved it by using get_woocommerce_term_meta $terms = get_terms( array( ‘taxonomy’ => ‘pa_texture’, ‘hide_empty’ => false, )); foreach ( $terms as $term ) : $thumbnail_id = get_woocommerce_term_meta( $term->term_id, ‘pa_texture_swatches_id_photo’, true ); $textureImg = wp_get_attachment_image_src( $thumbnail_id, ‘full’ ); ?> <img src=”https://wordpress.stackexchange.com/questions/274247/<?php echo $textureImg[0]; ?>”> endforeach;

Run function before uploaded image is saved

WordPress already compresses jpeg files, doing it a second time will just degrade the quality with recompression artefacts Instead, adjust the compression percentage via the jpeg_quality filter: add_filter( ‘jpeg_quality’, function() { return 80; // 80% });