Update image links in database
I re-ran the following update and now my links work! update wp_posts set post_content = REPLACE(post_content, ‘http://domain.com/wp’, ‘http://domain.com/blog’);
I re-ran the following update and now my links work! update wp_posts set post_content = REPLACE(post_content, ‘http://domain.com/wp’, ‘http://domain.com/blog’);
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).
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
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
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
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.
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
You also need to add it to image size chooser.You can do so using the filter image_size_names_choose. add_filter( ‘image_size_names_choose’, ‘wpse_228675_custom_size’ ); function wpse_228675_custom_size( $sizes ) { return array_merge( $sizes, array( ‘image_horizontal’ => __(‘Custom image size’), ) ); }
By default, when you upload an image via the admin, it’s metadata is added to the database, and that’s how you can search through them in the media library etc. If you upload images via ftp then they won’t appear in the DB so won’t show up in the admin area. Use a plugin such … Read more
Is there are better way to change this (annoying) variable please? The Twenty Sixteen theme provides you with the twentysixteen_content_width filter, where the default is 840. To modify it you should be able to use this within your child theme’s functions.php file: add_filter( ‘twentysixteen_content_width’, function( $content_width ) { // Override the default 840 content width … Read more