Why does WordPress convert my jpg’s to png?

A peek into the WP core file – wp-admin/includes/file.php confirms it is not WP which is doing this. Can you try the following: Check functions.php file in your active theme Try switching to other themes and check if the issue persists Try deactivating all the plugins and then activating them one by one and checking … Read more

Add custom metabox to media library images

Sure! Just follow this guide and make these changes: Hook into the add_meta_boxes_attachment action instead of the add_meta_boxes action In the add_meta_box() call, pass ‘attachment’ as the $screen parameter Hook into the save_post_attachment action instead of the save_post action And of course, make sure to customize the example code to your specific needs.

Omit image captions from get_the_content()

It turned out that the method called strip_tags(preg_replace(” (\[.*?\])”, ”, $output)) before strip_shortcodes($output), which caused aforementioned issue, since the code removed shortcode in square brackets, but retained contained image captions. I could fix it by swapping the two method calls like this: $output = get_the_content(); $output = strip_shortcodes($output); // Strip WordPress shortcodes first! $output = … Read more

Disable lazy loading on specific images

You can manage WordPress lazy loading with the loading parameter. Below code echo’s your image without using the lazy load function. echo wp_get_attachment_image( $image, $size, false, [ ‘class’ => ‘your-class-here’, ‘loading’ => ‘eager’ ] );

Correctly implementing the Facebook Like button

Yoast.com actually covered this quite recently… if ( is_singular() ) { global $post; if ( current_theme_supports(‘post-thumbnails’) && has_post_thumbnail( $post->ID ) ) { $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘thumbnail’, false); echo ‘<meta property=”og:image” content=”‘.$thumbnail[0].'” />’; } echo ‘<meta property=”og:title” content=”‘.get_the_title().'” />’; if ( get_the_excerpt() != ” ) echo ‘<meta property=”og:description” content=”‘.strip_tags( get_the_excerpt() ).'” />’; } … Read more

TImthumb not working for absolute path

I always do this with Timthumb: // this is the absolute path $url=”http://crizaze.com/wp-content/themes/joorang/wp-content/uploads/2011/01/ami166a-e1295733091216.jpg”; // convert it into relative path $url = str_replace(get_bloginfo(‘url’), ”, $url); // get the image url, resized by timthumb $timthumb_url = get_stylesheet_directory_uri() . “/timthumb.php?src=$url&w=80&h=80”;

WordPress 3.0 embedded images

You actually can, there’s a field on the upload image named “Link URL” which you can leave blank or just click the “None” button when you upload or edit an image in a post. Is this what you mean?

Native gallery sorting is ignored

The Problem was caused by the plugin “Post Types Order”. It takes control over all post orders including the order within galleries. Since there does not seem to be an option to exclude galleries properly, you will have to deactivate the plugin to have control over the gallery order again.