wp_get_attachment_url with specific image_size?

You can use single_product_large_thumbnail_size Woocommerce filter as shown in following code to apply custom image size for product. In the above code replace this apply_filters( ‘single_product_large_thumbnail_size’, ‘shop_single’ ) with this apply_filters( ‘single_product_large_thumbnail_size’, ‘custom_thumbnail_size’ );

How to change the target size of images clicked on in WordPress standard gallery

I came across a solution for your functions.php from the following site that looks like it will do the trick. More detail on the implementation here: http://oikos.org.uk/2011/09/tech-notes-using-resized-images-in-wordpress-galleries-and-lightboxes/ Snippet below: function oikos_get_attachment_link_filter( $content, $post_id, $size, $permalink ) { // Only do this if we’re getting the file URL if (! $permalink) { // This returns an … Read more

Custom image sizes without add_image_size()

Docs, docBlocks and Codex … Basically you have a very simple mistake: The $attributes array is the 2nd argument: function the_post_thumbnail( $size=”post-thumbnail”, $attr=”” ) { echo get_the_post_thumbnail( null, $size, $attr ); } How it works internally 1) The HTML itself gets built by wp_get_attachment_image(). 2) Later on, inside this function, the next relevant function call … Read more

wordpress media library shows empty images

Plugins such as Search and Replace can help you to properly fix the URLs in your database. Likewise, consider using backup-and-migration plugins such as BackupBuddy (paid) or Duplicator (free) to properly and more easily move your site (while automatically handling the above search-and-replace operation).

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.

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