How can I make all post image uploads have data-width and data-height attributes automatically by default?

Yes you can. See my working fiddle here: http://jsfiddle.net/MonkimoE/0wtgm8a1/ You need to add an id. example: <img class=”img” id=”imageid”….. Delete all atribute “data-width” and “data-height”. because it will added automatically. Add this javascript: (you may change the ‘$’ to ‘jQuery’ if doesn’t work with your theme) <script> var img = document.getElementById(‘imageid’); var width = img.naturalWidth; … Read more

Creating page templates with image placeholders

ACF, which you mentioned, would be the easiest/fastest way to get this done. A post by default has a single thumbnail, no magic option to add another with less work than what ACF does. If the design allows for it, you could also insert the second image straight into content and align it to the … Read more

Add “data-” attribute to image links

while googling about the same issue I came upon your question and a similar question from the WordPress forums. You can control the output of the generated code via the image_send_to_editor filter like this: function filter_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) { $html = sprintf(‘<a href=”#” data-rel=”lightbox-0″><img alt=”%2$s” src=”%1$s” /></a>’, esc_attr(esc_url($url)), esc_attr($title)); return … Read more

Is there a way to change wordpress image resize settings?

The file size increase you describe sounds odd. Are you referring to jpegs? Anyway, you can control loss quality for jpegs. Add this to your functions file: add_filter( ‘jpeg_quality’, create_function( ”, ‘return 80;’ ) ); Replacing 80 with whatever percentage you would prefer.

Find unused images?

Is there a reliable up-to-date way to find media that resides on the server but is not used in the WP site? In short: no, not as far as I’m aware. I have found a number of plugins, but all are very old, with lots of negative comments to the effect that they do not … Read more

Lazyload post thumbnails

You got everything you need, simply build your own img-element like this: if ( has_post_thumbnail() ) { $class=”lazy attachment-thumbnail-400-300″; //Get thumbnail source $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), ‘thumbnail-400-300’); $src = $thumb[‘0’]; $placeholder = “//placehold.it/400×300/eee/222/&text=+”; echo ‘<img src=”‘.$placeholder.'” data-original=”‘.$src.'” class=”‘.$class.'” />’; } Besides that, your main performance issue might be generating a new placeholder every time you want … Read more

Get User’s Facebook Photos as WordPress Upload

You can use media_sideload_image() which will take a link to a file and upload it to the media library. You do need to pass it some kind of $post_id @Sumit points out in the comments you could pass NULL into the $post_id field. media_sideload_image( $file_url, $post_id, $image_desc, $return ); If you need the uploaded image … Read more