Your plugin is really great. I love how simple and clean the code is.
I had one question around line 42 — https://plugins.trac.www.ads-software.com/browser/easy-add-thumbnail/trunk/easy-add-thumbnail.php#L42
There’s a filter called eat_exclude_types
:
$exclude_types = array( '' );
$exclude_types = apply_filters( 'eat_exclude_types', $exclude_types );
I understand why you’re excluding some post types. But the eat_exclude_types
filter doesn’t seem to be defined anywhere and just wasn’t sure if that’s actually doing anything or just old code leftover or what. I tried searching around to understand it a bit better, but had a hard time finding info for when a filter fn is undefined.
Thanks!
]]>When I publish any post without selecting featured image, the plug-in does not select first image as featured. I am on latest version WordPress 5.8.2
Edit: I was selecting image from media gallery instead of uploading image. So only new uploaded images associated with that post gets featured image.
]]>Hey I know this plugin is super simple and nothing has broken so could you please bump up the tested up to so www.ads-software.com will stop warning about not being updated.
]]>Thank you very much for this great plugin.
Instead of excluding post_types, I wanted to exclude some post formats (especially, the “video” format, because I want the video to be seen in the feed, not the featured image).
So, in function easy_add_thumbnail, I added :
$post_format = get_post_format( $post->ID );
$exclude_formats = array( '' );
$exclude_formats = apply_filters( 'eat_exclude_formats', $exclude_formats );
and I replaced
if ( ! in_array( $post_type, $exclude_types, true )) {
by
if ( ! in_array( $post_type, $exclude_types, true ) && ! in_array( $post_format, $exclude_formats, true ) ) {
In my child_theme functions.php I included an adaptation of your FAQ code:
//Easy Add Thumbnail: exclude post formats from adding a featured image
add_filter ('eat_exclude_formats', 'my_excluded_formats', 10, 1);
function my_excluded_formats ( $exclude_formats ){
$exclude_formats[] = 'video';
return $exclude_formats;
}
As far as I have tested, it seems to work.
Maybe something that could be included in a future release.
thanks again for your great work.
Fran?ois
I want to remove the featured image for select pages and posts. When I remove the featured image from a page and save it, it repopulates the first image as the featured image. Why is this happening?
]]>If I have 2 pictures named Gaming 1 and Gaming 2. Gaming 1 is applied to both posts.
]]>After updating my site’s wordpress version this plugin stopped working. Did anyone else experience this?
]]>Recently I started loosing featured images. When I stopped and strated this plugin it says I am using an old php version, but my site is running the latest wordpress and php version… Why is the plugin reporting an old version?
Regards, Peter
Hello,
I love your plugin but as minor request, it would be nice if we could center the featured image when not large enough…
I tried different codes from style.css and from function.php in my theme but no luck…
Thanks for your nice job !
Eric Collart
]]>Is there a way to exclude some categories instead of post types?
]]>Thumbnails are generated but with wrong paths.
the correct path to the images
…../wp-content/uploads/2018/10/first-image.jpg
Generated path
…../wp-content/uploads/first-image.jpg
Skipping the year/month directories.
Any idea what’s wrong?
Hello.
Need to use your plugin but it is not updated to the latest WordPress version. Could you tell me if it works and is safe to use it with WP 4.9.8 and are you planning to keep it updated also for next versions?
Thanks for your work.
Hi.
Thanks for your great plugin.
@kri8tiv already asked the same question:
Is it possible that the plugin would take into account also URL image instead of library ones only?
Muchas gracias.
]]>Hi,
Your plugin is very good, however, in my post I inserted an image from outside URL (not from media library) and your plugin doesn’t set it as featured image.
Do you have any solution for this?
Thank you.
kri8tiv
]]>Hello,
Been using this plugin for sometime and it is perfectly fine. However, WP updated the app for iOS and now, when posting, the image doesn’t get the “Featured Image” option automatically.
However, when doing a post directly on the site, it works. So it comes from the app and I simply wanted to know if you could do something about it;-)
Cheers,
Hi,
This does not work for Woocommerce Products, anyone reporting this?
Hi there, I am hoping you can help me.
I am not able to get this plugin to work for new or old posts in 4.7.1
Installed plugin. Viewed page that uses featured image. Featured image is blank and does not show as set on edit post page.
]]>How can I set a fallback image or a default image?
]]>I’m using MH Magazine theme, I’ve installed Easy Add Thumbnail plugin but I can’t seem to find it in the menu.
Is not under Tools nor Settings, where should I find it? I really neede because this new theme works with featurd images and all of my previous theme posts have not one setted, and I have lots of posts to fix.
Thanks for your help
]]>I did some changes to the code and now it works for old posts.
This is the code:
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' ); // This should be in your theme. But we add this here because this way we can have featured images before swicth to a theme that supports them.
function easy_add_thumbnail($post) {
//$already_has_thumb = has_post_thumbnail(); //old
$post_type = get_post_type( $post->ID );
$exclude_types = array('');
$exclude_types = apply_filters( 'eat_exclude_types', $exclude_types );
$feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
// do nothing if the post has already a featured image set
if ( !empty($feat_image) ) {
return;
}
// do the job if the post is not from an excluded type
if ( ! in_array( $post_type, $exclude_types ) ) {
// get first attached image
$attached_image = get_children( "order=ASC&post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
if ( $attached_image ) {
$attachment_values = array_values( $attached_image );
echo $attachment_values[0]->ID;
// add attachment ID
set_post_thumbnail( $post->ID, $attachment_values[0]->ID);
}
}
}
// set featured image before post is displayed (for old posts)
add_action('the_post', 'easy_add_thumbnail');
// hooks added to set the thumbnail when publishing too
add_action('new_to_publish', 'easy_add_thumbnail');
add_action('draft_to_publish', 'easy_add_thumbnail');
add_action('pending_to_publish', 'easy_add_thumbnail');
add_action('future_to_publish', 'easy_add_thumbnail');
}
]]>
I ask because my blog photos are 1000 wide, and my thumbs are only 400 wide. I am looking for a plugin that will replace every featured image, but taking the first image in the post, cropping it to 400*300 dimensions and save it as the featured image.
FYI, i am doing this reduce the massive size of my homepage which is currently pulling huge images and simply shrinking them down to show as the thumb, and not creating new images with a much smaller size.
Thanks guys,
Mike
Hey there – I am using the Hueman theme and I tried adding the snippet of code that you provided in the FAQs to my functions.php file to exclude featured images for pages, however, the featured images don’t seem to disappear. Is there anything else specifically that I need to do?
Thanks! ??
Mike
First of all really love the plugin. It has one downside though.
It seems like it’s picking an image in the post at random and sets that as featured.
For my website it’s quite essential that the first image is set as featured and not a random image in the post.
Do you have any idea how to fix this?
]]>I activated the plugin and I checked to see if the images are uploaded, which they are, however it is still not setting the featured images for my old posts. Any suggestions?
]]>I imported posts from another install; images are being attached – they show in the list of attachments uploaded with the post; But I have 3 images for each post. The problem is, the first image is a blank . . . then there are two more images, either one will work fine. How can I MOD your script to grab the second or third attached pic?
Thanks!!!
]]>I imported posts from another install; images are being attached – they show in the list of attachments uploaded with the post; But I have 3 images for each post. The problem is, the first image is a blank . . . then there are two more images, either one will work fine. How can I MOD your script to grab the second or third attached pic?
Thanks!!!
]]>Hi!
First of all thanks for the plugin, its the only one that does what I want but it still doesn’t quite do the trick.
So the plugin is only working on a few posts. I have checked my posts and they all have an image on it that’s on the media library and that is attached (in the media library it says uploaded to) said post. However, on some posts it sets the featured image and on others it doesn’t. I’m not sure what the difference between posts is as they all follow the same format, have the same type of image and HTML.
Any help would be greatly appreciated.
Thanks!
Hi. Thanks for writing the great and convenient plugin.
I’m using plugin version 1.1.1. When I update a posting, and add a new image to the top of an existing post, the new top image doesn’t become the featured image when I update the posting. The featured image is still the second image in the post, which used to be the first image.
My question is, can I trigger the plugin to run again on the update, or is this being considered for a future release?
Thanks for your reply.
]]>Hello,
The plugin works as described and sets a featured image for posts that didn’t have one.
But happens when deactivating the plugin?
The image set previously as featured remains as such?
Is it possible to remove it?
Thanks.
]]>Yoast’s latest release of their plugin conflicts with your plugin, which results in the media uploader within the Edit Posts page being broken.
I’m hoping Yoast fixes the bug, since it’s likely theirs. But maybe you’re able to determine what’s causing the issue, and resolve it in your next release?
https://www.ads-software.com/support/topic/error-uploading-media-in-post-if-yoast-is-active
]]>