Tag Info

Hot answers tagged

7

You can use the wp_generate_attachment_metadata filter: function wpse_183835_to_jpeg( $meta, $post_id ) { $sizes_to_convert = array( 'thumbnail', ); $path = dirname( get_attached_file( $post_id ) ); foreach ( $sizes_to_convert as $size ) { if ( ! empty( $meta['sizes'][ $size ] ) ) { $data = $meta['sizes'][ $size ...


3

WordPress doesn't store path of generated sizes anywhere, you need to build it. As suggested by @kraftner in comments, wp_get_attachment_metadata() can be used to obtain some of the pieces you need to build the path. An alternative is image_get_intermediate_size(). The missing piece is the absolute path of upload folder. In theory, that can be retrieved ...


2

I believe you're using the wrong function. get_the_time() doesn't actually return the current time but instead the time of when the post was published. Maybe what you're looking to use is date( 'H' ).


2

The correct core function should be current_time() Untested, but your code ought to look something like: if (current_time('H') >= 8 && current_time('H') < 20)


1

I've had the same problem and found it was due to the upload file size set for the server (in my case 2mb). There is another setting which escapes me at this point, but is basically a limit on the amount of space that can be used to process uploaded images...which WordPress does when it re-sizes the images on upload. Unfortunately, unless you have root ...


1

Lets start with your first code. If you add texts, captions etc. a shortcode will be generated: [caption] The function img_caption_shortcode() in wp-content/media.php is responsible to execute the shortcode. But this shortcode is only produced, when you use captions. Otherwise, it will be simply inserted the <a>- and <img>-Tag. who decides, what ...


1

There's no native function, but the RICG Responsive Images plugin will add a srcset attribute with the available image sizes. Srcset (along with the <picture> element), is steadily gaining browser support - it doesn't need any javascript and it's up to the browser to decide which is the correct image to load. The attribute is added for posts where ...


1

Assuming we are viewing some king of single - post, page, custom post type etc. <?php $imgs_meta = get_post_meta( get_the_ID(), 'AP_post_image', true ); if ( '' != $imgs_meta ) { $imgs = explode( ',', $imgs_meta ); foreach ( $imgs as $src ) printf( '<img src="%s" />', esc_url( $src ) ); }


1

The renaming to test1.jpg is not due to any cropping / resizing functions WordPress. This is because you already had a file named test.jpg uploaded, and WordPress does not replace files if one exists in the folder that has the same name. If, for some reason you want it to replace files rather than rename it (not recommended) you can use a plugin like: ...


1

This isn't a WordPress issue, although it IS an easy CSS fix. The small space between the end of image and the slideshow is axtually 2 pixels wide and caused by the #left-area div. You can just up the width by 2 pixels on #left-area. Like this: #left-area { width: 639px; } It is currently 637px. You could also up the padding-left by 2 pixels to ...


1

You have to use single_product_large_thumbnail_size filter for Single Product page. something like: function custom_product_large_thumbnail_size() { return 'gallery'; } add_filter('single_product_large_thumbnail_size', 'custom_product_large_thumbnail_size');



Only top voted, non community-wiki answers of a minimum length are eligible