Plugins such as CMB2, ACF, Easy Digital downloads and WooCommerce have post meta fields which record values for attached media such as images or files.
On the bigram.co.uk website the bigram Custom Post Type uses the featured image field ( _thumbnail_id ) to record the ID of the image which should be displayed for the bigram.
We want to make it easy to use the WordPress front-end to upload an image and associate it with a bigram. A media field type would allow the [bw_new] shortcode to automatically accept a file upload.
This solution may also be used for oik-plugins and oik-themes.
Currently the .zip file is attached to the plugin or theme version and the code works out the rest.
Allowing the ID to be specified directly may save us some effort.
Requirements
[x] A media field type
[x] If an image it should be displayed ( a la Featured image)
[x] Displayable as a field using [bw_field], [bw_fields] and other shortcodes that can display individual fields
[x] On the front-end extend the [bw_new] form to allow media upload
[x] On the front-end extend the [bw_new] form to allow selection of a media file
[x] On meta boxes allow selection of an uploaded file
[x] Enough action and filter hooks to make it easy to do things such as renaming the file after upload.
Proposed solution
Add "Media" field as part of this plugin
Display as an image when required
Change oik-fields [bw_new] shortcode
Change oik's bw_form() function to support enctype=multipart/form-data
A further requirement - On meta boxes add logic to allow media upload -
does not seem necessary at this time. We assume that this can be satisfied using the following process
the media file can be uploaded using Add media
and then associated to the field using the selection list.
Plugins such as CMB2, ACF, Easy Digital downloads and WooCommerce have post meta fields which record values for attached media such as images or files.
On the bigram.co.uk website the
bigram
Custom Post Type uses the featured image field (_thumbnail_id
) to record the ID of the image which should be displayed for the bigram.We want to make it easy to use the WordPress front-end to upload an image and associate it with a bigram. A
media
field type would allow the[bw_new]
shortcode to automatically accept a file upload.This solution may also be used for oik-plugins and oik-themes. Currently the .zip file is attached to the plugin or theme version and the code works out the rest. Allowing the ID to be specified directly may save us some effort.
Requirements
media
field typeProposed solution
A further requirement - On meta boxes add logic to allow media upload - does not seem necessary at this time. We assume that this can be satisfied using the following process
Note: This may require a refresh.