Jump to content
Sign in to follow this  
sanderpinkse

Featured image for custom post type

Recommended Posts

sanderpinkse

I just discovered featured images are not working for custom post types in PlatformPro. That is because support for featured images needs to be declared explicitly for every post type in functions.php. Adding support for my custom post type in functions.php in PlatformBase didn't work. The only solution I could find was editing core.init.php directly. That does work, but surely there has to be a better way to handle this? Cheers, Sander

Share this post


Link to post
Share on other sites
evert100

Hey Sander, Kan je niet emailen daarom even zo. Wat is je website, ben benieuwd! De mijne vind je hier: www.edugram.nl <just a small dutch talk> Cheers

Share this post


Link to post
Share on other sites
sanderpinkse

To clarify my previous message: when I'm talking about featured images, I mean post thumbnails, not the images in a feature slider.

Share this post


Link to post
Share on other sites
Simon

Sander can you post your 'add support' code please.

Share this post


Link to post
Share on other sites
sanderpinkse

Hi Simon, I'd like to, but I'm afraid I haven't got a clue what an "add support code" is. Sorry...

Share this post


Link to post
Share on other sites
Simon

I mean what code are you using to declare your custom post type?

Share this post


Link to post
Share on other sites
sanderpinkse

Ah! Sorry for being a bit dense. I don't declare them myself, but have been using the "Custom Post Type UI" plugin. If I change add_theme_support( 'post-thumbnails', array('post') ); in core.init.php to add_theme_support( 'post-thumbnails', array('post', 'my_custom_post_name') ); the featured image field shows up in the backend on my CPT pages. Cheers, Sander

Share this post


Link to post
Share on other sites
cmunns

So then this is resolved?

Share this post


Link to post
Share on other sites
sanderpinkse

Well, in the sense that I can get the post thumbnails to behave properly, yes. But the only solution I could find was editing core.init.php. Not an ideal solution, to put it mildly. I could do a lot of damage there. And my edits will be wiped out the next time you guys do an update... Cheers, Sander

Share this post


Link to post
Share on other sites
cmunns

You can add the add_theme_support function directly to the functions.php file in -Base

Share this post


Link to post
Share on other sites
sanderpinkse

Thanks! That was the first thing I tried, but it didn't work for me at the time. I probably made a typo, because now it works like a charm. Thanks for the help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×