Adjusting post width according to the image size

Markup: <div class=”post”> <div class=”thumbnail”> <img class=”thumb” src=”http://placehold.it/950×450/” /> </div> </div> CSS: .post { width: 500px; } .post img.thumb { width: 100%; /* fill available space of parent and keep aspect ratio */ } Fiddle: http://jsfiddle.net/

Retaining original image size

Paste this code in the style.css file of you current active theme. (file path: /wp-content/themes/genesis-sample/style.css ) .entry-content img.size-full { max-width: none !important; }

Extending site width according to the image size

What you need is a responsive theme that can handle wide pages gracefully. I don’t think there is any simple hack that will not break your theme if it was not designed for it. A saner option is to show a scaled down image that fits your theme and open the full image when it … Read more

Black and White Thumbnail in WordPress Gallery

I think the best way to do this would be to add a filter to when the content is pulled into the post/page: <?php add_filter( ‘the_content’, ‘add_bw_thumbnails’ ) ?> Or to when an image is inserted into the editor: add_filter( ‘post_thumbnail_html’, ‘add_bw_thumbnails’, 10 ); add_filter( ‘image_send_to_editor’, ‘add_bw_thumbnails’, 10 ); You then just have to write … Read more

Dynamically adding Captions to images

The media uploader wraps the image and caption in the shortcode. There is a filter called img_caption_shortcode that can do what you want. The caption itself is passed as part of an array to the shortcode handler, as is the image id. add_filter( ‘img_caption_shortcode’, ‘wwm_img_caption_filter’, 10, 3 ); function wwm_img_caption_filter( $empty, $attr, $content ) { … Read more

How to change images size after theme modification?

To change values inside the content can you search/replace in the database, but it is hard to update all values, if the values are different. For a search/replace can you use a plugin or helper. The helper is very good for all ToDos in Search/Replace context. The plugin is useful for search/replace in different tables.