Name: atception
Owner: Human Made
Description: Yo dawg I heard you like attachments so I made a plugin that lets you attach attachments to your attachments
Created: 2015-02-21 14:19:51.0
Updated: 2015-07-14 21:40:47.0
Pushed: 2015-02-21 15:36:43.0
Homepage: null
Size: 152
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Yo dawg I heard you like attachments so I made a plugin that lets you attach attachments to your attachments
In all seriousness sometimes it can be useful to have a method of connecting alternative media files to other media files. Take the following examples:
Note: this a developer tool - it only provides the admin UI and a function for retrieving the alternative media.
hm_register_alt_media( $key, $label, $mime_type [, $alt_mime_type = 'image' [, $multiple = false ] ] )
$key
: an identifier for the connection eg. 'video_thumb'$label
: a human readable name for the connection used in the UI$mime_type
: the file type to attach media to eg. 'video', 'image/gif'$alt_mime_type
: the file type to be attached, defaults to 'image'$multiple
: allow multiple files to be attachedp
dd thumbnails to videos
egister_alt_media( 'video_thumb', __( 'Video thumbnail' ), 'video' );
hm_unregister_alt_media( $key )
$key
: an identifier for the connection to remove eg. 'video_thumb'p
emove thumbnails from videos
nregister_alt_media( 'video_thumb' );
hm_get_alt_media( $attachment_id, $key, [, $fields = 'ids' ] )
$attachment_id
: the attachment to fetch alternative media for$key
: the identifier used to register the connection$fields
: the fields arguments passed to get_posts()
, can be 'ids' or 'all'p
et thumbnails to videos
mb = hm_get_alt_media( 123, 'video_thumb' );
wp_get_attachment_image( $thumb, 'medium' );
All suggestions and ideas are welcome, just add an issue!