• 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

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter Matt25

    (@matt25)

    I have contacted my host but then I went and checked my local version of the site and it happens on that aswell, so it can’t be the host can it?
    Thanks, I really appreciate the help,
    Matt

    Unless anyone else has better ideas, it’s going to have to be a process of elimination then. (Welcome to the world of web development :-))

    First, it looks to me like it might be a rewrite problem, and that might be because (from the url you gave) you appear to have a subdomain. I’d Google for any know difficulties or gotchas with WP on subdomains. Also, check that .htaccess has correct rewrite permissions for permalinks.

    Then I’d see if the default theme worked on the hosted site. If it didn’t, then something’s wrong on the hosted site. I’d probably try disabling plugins etc. and overwriting (FTP) existing files. If that didn’t work, I’d probably delete and start again from scratch, just to save time going round in circles.

    If the default does work on the hosted site, I’d download that default and see if I could get it to work on my local computer. If I couldn’t, something’s wrong with the local computer.

    I personally don’t like developing locally. Too many ifs and buts. I have an ‘addon’ domain on my host, password protected so that Google can’t get to it, and that’s my test site.

    Afraid you’re on your own now – but let us know what the problem was!
    Best of luck with it!

    Thread Starter Matt25

    (@matt25)

    Thanks very much for the help, it seemed to have permanently slipped my mind about having to use https:// to get to an external site which was obviously stopping it. I have now put it into my code so you can’t not have it,

    Cheers for the help,
    Matt

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘How to upload image on publishing of a custom post’ is closed to new replies.