Download the PHP package cedaro/metamedia without Composer
On this page you can find all versions of the php package cedaro/metamedia. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cedaro/metamedia
More information about cedaro/metamedia
Files in cedaro/metamedia
Package metamedia
Short Description A WordPress plugin to register media selection meta boxes.
License
Homepage https://github.com/blazersix/metamedia
Informations about the package metamedia
Metamedia
A WordPress plugin to register media selection meta boxes.
Contributors: Brady Vercher
Requires: 3.5
Tested up to: 4.0
License: GPL-2.0+
With the release of WordPress 3.5, an effort was made to decouple attachments from the posts where they were uploaded, which was a shift from previous versions, and a greater emphasis was placed on the [gallery]
shortcode. Backward compatibility was maintained, but it became a little less intuitive to manage a gallery of images that were simply attached to a post. In any case it has always been a little difficult to select multiple featured images, or multiple galleries, for use in different areas in a template.
Metamedia allows for registering simple meta boxes like the "Featured Image" meta box for selecting a single image or gallery of images to be stored in a post meta field for easy retrieval and usage in templates. It can be used with any post type and uses the native media frame.
An example gallery meta box. The images can be sorted directly in the meta box.
An example meta box with custom labels for selecting a single image.
Usage
To add a meta box similar to the "Featured Post" meta box, simply register it using register_metamedia_metabox()
like this:
Now in a template, the image ID can be retrieved using get_post_meta( $post_id, 'hero', true )
.
Methods
The parameters for both methods are the same. Most labels and properties of registered meta boxes and the media modal can be customized using the optional $args
parameter.
__register_metamedia_meta_box( $meta_key, $post_type, $args = array() )
__
register_metamedia_gallery_meta_box( $meta_key, $post_type, $args = array() )
Key | Description | Example |
---|---|---|
meta_box_title |
The title of the meta box. | Hero Image |
meta_box_context |
Where the meta box should appear. | side |
choose_label |
Label of the button used to open the media frame. | Select Image |
remove_label |
Label of the link used to remove a selected image. | Remove image |
frame_title |
The title of the media frame. | 2-10 |
frame_button |
The label of the button used to select an image in the media frame. | Update Image |
Some arguments may not work with the gallery meta box. Additional arguments are available for more advanced usage.
Installation
Metamedia is available in the WordPress plugin repository, so it can be installed from within your admin panel like any other plugin. You may also download it directly from GitHub using one of the following methods:
Upload
- Download the latest release from GitHub.
- Go to the Plugins → Add New screen in your WordPress admin panel and click the Upload tab at the top.
- Upload the zipped archive.
- Click the Activate Plugin link after installation completes.
Manual
- Download the latest release from GitHub.
- Unzip the archive.
- Copy the folder to
/wp-content/plugins/
. - Go to the Plugins screen in your WordPress admin panel and click the Activate link under Metamedia.
Read the Codex for more information about installing plugins manually.
Git
Clone this repository in /wp-content/plugins/
:
git clone [email protected]:cedaro/metamedia.git
Then go to the Plugins screen in your WordPress admin panel and click the Activate link under Metamedia.