I have a Custom Post Type and I am going to customize it to show a list of some products with images. I have all text fields working fine but I need also an image to be attached to each item. How can I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If each post is a single item, you can add post thumbnail support in your theme, which allows users to either browse for or upload an image and assign it to the post.
add_theme_support('post-thumbnails')You’ll also need to add
thumbnailto yoursupportsarray when you register your custom post type.You can then retrieve the thumbnail in your theme files using
get_post_thumbnail(). Check out the other post thumbnail functions inwp-includes/post-thumbnail-template.php.