How to upload image on publishing of a custom post
-
Hi, I have set up a custom post type in wordpress called ‘Bike’ and I am trying to basically make it so that when I create a ‘new bike’ in wordpress it uploads a picture of it as a thumbnail when I list the bikes on the site.
I tried using the ‘add_theme_support( ‘post-thumbnails’, array(‘bike’ );’ but I cant seem to get it to work with the custom post type?
My other thought was to create a function to upload the image specified in the meta box upon publishing the bike but I can’t work out what I would put in the add_action call because this would call when you published a post but not my custom post would it?
add_action(‘publish_post’, ‘image_upload’);Could anyone point me in the right direction on how to do this? or how to make these things work?
Cheers,
Matt
- The topic ‘How to upload image on publishing of a custom post’ is closed to new replies.