Image File Names

Those numeric suffixes are image sizes corresponding to the width/height values in wp-admin->Settings->Media. It is part of the thumbnail system. If the right image manipulation libraries are installed on the server, WordPress will create these different image sizes when you upload an image. The idea is that you can then load appropriately sized images for … Read more

Display latest 12 images from media library

Simply omit the parent value. $args = array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘published’, ‘numberposts’ => 12, ); Check the documentation for other arguments: Function_Reference/get_posts. Maybe you’d like to use the PHP command shuffle, like shuffle( $attachments );.

3.5 media.editor: what is the event listener for choosing an image?

Found out that overriding some of the wp.media.editor objects methods is the best solution, because it allows you to customize the event handling, but will also preserve a lot of the backend processing and handling that WP has in place for processing images. I basically overrode wp.media.editor.send.attachment, wp.media.gallery.shortcode with my own methods, and wp.media.editor.remove, in … Read more

Why html tags are being appended to my pictures?

Sometimes, WordPress likes wrapping <img … tags with extra HTML. You could try something like as listed on http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/. In your theme’s functions.php file, add the following lines of code near the top: function filter_ptags_on_images($content){ return preg_replace(‘/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU’, ‘\1\2\3’, $content); } add_filter(‘the_content’, ‘filter_ptags_on_images’);

How to get image extension from wp image editor object?

I tried using generate_filename yesterday but probably it was kind of late and I was trying and didnt manage to make it work, today I managed to workaround the problem without fetching the image another time like this: $save_path = WP_CONTENT_DIR . ‘/tmp/’ . $img_name . “-” . $nw . “x” . $nh; $wp_img->save($save_path); $img_name … Read more

Broken urls with http site and https wp-admin

My advice is to make the whole site https. Either add https to the settings -> wordpress address & settings -> site address or remove https if it appears in either of those inputs. For securing admin login panel only: easy method but doesn’t show secure icon. right result but more steps to consider method.