Fuzzy Images in WordPress 4.4

The new responsive images feature takes some tweaking to make it work optimally. The standard settings work only for the most basic of themes. Read up on responsive images, specifically the srcset and sizes attributes. Manipulate the srcset and sizes values through the new wp_calculate_image_srcset and wp_calculate_image_sizes filters. There’s also a max_srcset_image_width filter that allows … Read more

Set Post Image Using Shortcode

The Shortcode API is more geared for altering post content rather than performing actions in response to content, and as such tend to require more creativity to alter other post data – though it can still be done. Ultimately, using a shortcode to set a featured image is kind of bizarre considering that you can … Read more

How to display alt tags in img src?

You are using the Advanced custom fields plugin. The documentation for images: http://www.advancedcustomfields.com/resources/image/ To display the alt-tag for example, you can use this snippet: $image = get_field(‘image’); if( !empty( $image ) ) { $alt = $image[‘alt’]; … echo ‘<img src=”https://wordpress.stackexchange.com/questions/216629/…” alt=” . $alt .”>’ }

How to output images as figure/figcaption

add_theme_support( ‘html5’, array( ‘gallery’ ) ); or with another arguments such as search-form, comment-form, comment-list and caption, its call as Theme Markup Added gallery and caption support was introduced since WordPress version 3.9. As of version 3.9 WordPress uses <figure> and <figcaption> elements, instead of the generic definition list markup to output galleries. More on … Read more

Keep image EXIF info after compressing original image?

The problem is that you are using functions from GD library to manipulate images, not functions from WordPress Image API (WP_Image_Editor class). So, WordPress things doesn’t apply to the generated image by your code. WordPress Image API uses ImageMagick if available, otherwise it uses GD library. In order to keep EXIF data: If GD library … Read more

How to stop images from being wrapped in tags?

this is a function, that unwraps images from p tags inside the_content /** * WP: Unwrap images from <p> tag * @param $content * @return mixed */ function so226099_filter_p_tags_on_images( $content ) { $content = preg_replace(‘/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s’, ‘\1’, $content); return $content; } add_filter(‘the_content’, ‘so226099_filter_p_tags_on_images’);

unattached media files that should be attached

It’s not a problem with WordPress. It’s how it should be. If you see the image below of media library. You can see that the column name is Uploaded to which means that media file was not there before and it’s introduced or uploaded to the below mentioned post/page/etc. Since in your case it’s uploaded … Read more

Where are the resized images coming from?

These various resized images come from registered image sizes, usually from your theme, and sometimes from plugins. If a theme registers an image size, it expects to use that size in the front-end. This is most useful in an image gallery or slideshow, when you need images to be an exact ratio of width to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)