Bind to WPSetAsThumbnail

Yes, on your 2nd question 🙂 From what I saw in set-post-thumbnail.dev.js, it appears that you only need to add a link/anchor with the wp-post-thumbnail class on it in your quick edit screen. And you will get the image faded inside that link when the ajax request completes. For alerting “bacon” after the ajax completes, … Read more

Watermark featured image as soon as it is set on post edit page

“Thumbnails” or “Featured” images are attachments with an entry in the $wpdb->postmeta table under the key _thumbnail_id. A couple of different action hooks run when entries are added to postmeta. I think that probably the one you want is updated_{$meta_type}_meta. In your case, updated_post_meta. Something like this: add_action( ‘updated_post_meta’, function ($meta_id, $object_id, $meta_key, $_meta_value ) … Read more

Add post thumbnail from external image with plugin

you should have a look to this blog post : http://www.maverick.it/tech/create-thumbnails-using-wordpress-built-in-functions then, if you can’t use a remote image, just download it as a temporary file on your server, process and delete it. One your image created, you should then insert it as an attachment (http://codex.wordpress.org/Function_Reference/wp_insert_attachment) and set it as the post thumbnail (http://codex.wordpress.org/Function_Reference/set_post_thumbnail) I … Read more

How to output placeholder image if no featured image set?

I think that you’re adding the code inside the loop of index.php or blog template file. You might be try this kind of things: if ( class_exists( ‘MultiPostThumbnails’ ) && ( MultiPostThumbnails::has_post_thumbnail( get_post_type(), ‘header-image’ , get_the_ID() ) ) ) { MultiPostThumbnails::the_post_thumbnail(get_post_type(), ‘header-image’, NULL, ‘header-image-full’, array(‘class’ => “custom-header-image”) ); } else { $image = get_template_directory_uri() .’/assets/img/placeholders/placeholder.png’; … Read more

Autogenerated Thumbnail compression depending on size

i’m looking for a more discrete and automatic approach. And that is altering the wp_create_thumbnail i think. And that is where you’d be wrong. Here is the entire code for wp_create_thumbnail() from core: function wp_create_thumbnail( $file, $max_side, $deprecated = ” ) { if ( !empty( $deprecated ) ) _deprecated_argument( __FUNCTION__, ‘1.2’ ); $thumbpath = image_resize( … Read more