Multiple Post Thumbnails plugin and attachment error

You should trigger the function on some other hook like function add_multiple_post_thumbnails_from_plugin() { new MultiPostThumbnails( array( ‘label’ => ‘Thumbnail Image’ ,’id’ => ‘video-thumbnail’ ,’post_type’ => ‘video’ ) ); } add_action( ‘admin_init’, ‘add_multiple_post_thumbnails_from_plugin’ );

How to display a post’s Featured Image with this code?

Modify your function as such: // This theme displays custom size (page-single) featured image on the Post’s page function InsertFeaturedImage($content) { global $post; $original_content = $content; if ( current_theme_supports( ‘post-thumbnails’ ) ) { if ((is_page()) || (is_single())) { $content = get_the_image( array( ‘size’ => ‘full’ ) ); $content .= $original_content; } } return $content; } … 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

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

Add theme support for post thumbnails

What add_theme_support( ‘post-thumbnails’, array( ‘products’ ) ); did is: it added the support for the post-thumbnail feature, and with the second parameter you fixed the feature support to only post_type = ‘products’. But it actually saying: Ok, load all the necessary things to register a Post Thumbnail — you’re actually introducing ‘Post Thumbnail’ to WordPress. … Read more

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