Yes, you can do it programmatically and it probably can be built with some of the Related Questions listed here on the right of the page.
But, IMO, this is faster and easier to do with a plugin.
Advanced Custom Fields
Create an image field and associate it with your Custom Post Type.
That results in:
Another good plugin capable of doing the same
Custom Content Type Manager
A nice feature is the “Repeatable Field”, which is a premium add-on in ACF.
Reference Q&A: Creating Photo Gallery System with Custom Post Type
Related Posts:
- How to disable generation of default image sizes for some custom post types?
- Add metabox with media uploader in a custom post type [duplicate]
- Remove tabs from media uploader for a CPT
- Removing Image Sizes for Custom Post Type
- Image size filtering in Media uploader according to custom post type
- wp is not defined error using wp.media to create a custom image uploader
- How to rename image at uploading on specific plugin or post-type in WordPress
- window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes
- Duplicate Custom Header Functionality into the post edit screen
- Get image post ID in media upload
- WordPress 3.5 Media Uploader – Only allow 1 upload and certain file types
- frontend image post uploader
- Checking if $_FILE isset for an array of file upload metaboxes
- How to add multiple images to a custom post type without plugin [closed]
- Create a custom post type for a photo post
- link featured image to external link
- Invalid file type when using wp_upload_bits to upload PDF to a custom post type
- Multi Photo Upload with Caption on Front End for Custom Post Type
- Allow authors to create article image
- Custom Taxonomy as checkbox or dropdown
- Why won’t my metabox data save?
- Upload multiple images in a custom metabox
- echo value from ‘select’ field type into page template using cmb2?
- WP_List_Table Inside Metabox Not Working on Submit
- Adding upload button in metabox
- Custom post type Admin Page
- How to hide CPT files from media library programmatically
- wp_generate_attachment_metadata gives me an empty array
- Best way to arrange custom post types by Attributes -> Order metabox value?
- Removing Edit Permalink/View “Custom Post Type” areas
- Unable to save custom taxonomy terms in a custom-built metabox
- How to sort CPT by custom meta value (date), and return posts month by month
- Rename the insert button in media upload window
- Possible to add meta box to edit.php pages?
- How can I include meta box content when searching?
- How to customize the Categories meta box to allow only one category?
- I need a Simple image uploader with a simple screen. WP default has too many options.
- Upload Image from Front End and Resize
- How can I display my custom metaboxes on a custom post template?
- How to insert multiple images into a single post within a CPT
- Custom Post Type with metaboxes (no content) only?
- Unable to show meta box data in frontend
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- how to get URL of media uploaded to WordPress via media_handle_sideload()
- Multiple featured sizes / images / excerpts
- What is the best way to correlate one-to-many content-type relationships?
- Visual editor issue by having multiple tiny mce editors in a CPT
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- Grouping metadatas into one
- Anon function and add_meta_box
- Can custom fields be added without a meta box?
- Meta Box on Custom Post Type not saving
- Redirect to another page using contact form 7? [closed]
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- custom post type metaboxes not saving
- Custom post type, have only my meta boxes
- Display Repeatable Meta Box Content
- Saving Meta Data within Custom Post Type
- Using custom post type as taxonomy
- Upload attachment from external site
- Values from meta-box not on $_POST
- Get id from metabox dropdown
- Custom posttype content metabox
- Reusable metabox backend and frontend
- Filter posts of custom post type by meta key in (List All Section)
- How can I output WPAlchemy repeating fields meta values in my page template?
- How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?
- Meta box data not saving
- saving dropdown menu data on custom post type
- Questions regarding add_meta_box()
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Cannot Save MetaBox Data in Custom Post Type
- Custom post type meta box empty after save
- Cannot upload featured image to a custom post type
- Should i use custom post type for a custom footer?
- Metaboxes inside Tab
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Show a custom post title in another custom post type in Meta box
- How to avoid duplicate posts queried from custom meta?
- Modify Publish Metabox location on CPT
- PHP Warning with Custom Fields
- Custom taxonomy with custom post type archive page
- Simple Data picker meta box
- Wrong post ID in meta box callback
- How to shows CPT which has specific meta key?
- wp_dropdown_pages doesn’t allow me to select more than one custom post type
- Delete custom post type metadata without deleting the post in admin area
- Metabox is not saving
- Trying to get custom post type attachment images to function in indexed array
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Select custom post by meta value
- Adapting plugin for custom post type?
- Custom post type – permalink
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- How to query custom post then display sections by meta value
- Post AND page parameter for WP function
- img src not working correctly in custom post type
- Display div based on Group metabox selection [closed]
- Add a background image into a post [closed]
- Multiple posts selection [closed]