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 decrease picture size

you will need to add this css to a child theme or install a custom css plugin .blackwell_top_image { height:400px; //change this to whatever height you want the image to be overflow:hidden; } It has to be done this way as the image width is set to 100% so setting a height on the image … 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

Recent posts with featured image or fallback image with permalink

Here’s the relevant part of your code that should work: // This will make a URL like http://yoursite.com/path/to/fallback.png $fallback_image = site_url( ‘/path/to/fallback.png’ ); $fallback_image = “<img src=”https://wordpress.stackexchange.com/questions/224740/{$fallback_image}” />”; foreach( $recent_posts as $recent ){ echo ‘<div class=”sidebar-entries”>’; $featured_image = get_the_post_thumbnail( $recent[‘ID’], ‘sidebar-thumb’, array( ‘class’ => ‘sidebar-image’ ) ); if ( ! strlen( $featured_image ) ) { … 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’);

How to add an image from web-link?

This is some specific shortcode to some plugin, that if you just want to paste an image in wordpress editor isn’t necessary. (Also there is not enough info about what this shortcode is about). So there is simple HTML that will simply display link you want as an image, following: <img src=”http://here-goes-some-url-of-your-image” /> Make sure … Read more