WPBadger icon indicating copy to clipboard operation
WPBadger copied to clipboard

Error with P2 theme: Unable to install plugin, because current theme does not support post-thumbnails

Open lmorchard opened this issue 12 years ago • 2 comments

My blog is running the P2 theme, and I tried activating the plugin. I got this error:

Plugin could not be activated because it triggered a fatal error.

Unable to install plugin, because current theme does not support post-thumbnails.
You can fix this by adding the following line to your current theme's functions.php file: add_theme_support( 'post-thumbnails' );

If this isn't easily fixed, then a mention of theme compatibility could be handy in the README

lmorchard avatar Jul 24 '12 14:07 lmorchard

That notification is actually something that I added to the plugin. Perhaps it isn't clear enough about the next steps to fix the problem.

WPBadger requires that your support supports post-thumbnails -- which is a WordPress-way of saying an image that is optionally connected to each individual post. Many themes including the WordPress default support this out of the box (especially themes that are very visual and use the thumbnails in their design), but some older themes ('old' as in 12 months or older) don't currently support this, or have chosen not to. The fix is simple. You just need to add this function code: add_theme_support( 'post-thumbnails' ); in the functions.php file in your theme. By adding this code, you're not modifying how the theme looks at all -- just allowing it to leverage a feature built into the WordPress core.

I tested this with P2, added the function to the bottom of the functions.php file in the theme, and it works fine. Let me know how it works out for you, and thanks for adding this ticket!

I'll go ahead and add a page about this to the plugin wiki, and update the message so it ditches the "fatal error" part of the message and links to instructions on the wiki.

davelester avatar Jul 24 '12 20:07 davelester

Hmm, that seems to have fixed it. Though, it'll unfix itself every time my theme gets updated. (Which, oddly enough P2 wants an update right now, but I've been putting it off because I tweaked the CSS ugh...)

lmorchard avatar Jul 24 '12 22:07 lmorchard