cedaro/metamedia 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cedaro/metamedia

Composer 安装命令:

composer require cedaro/metamedia

包简介

A WordPress plugin to register media selection meta boxes.

README 文档

README

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.

Gallery Meta Box
An example gallery meta box. The images can be sorted directly in the meta box.

Featured Image 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:

function themename_register_metamedia() {
	if ( ! is_admin() || ! function_exists( 'register_metamedia_meta_box' ) ) {
		return;
	}

	// Register a meta box for assigning a 'hero' image to posts.
	register_metamedia_meta_box( 'hero', 'post' );
}
add_action( 'init', 'themename_register_metamedia' );

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() )

Arguments

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

  1. Download the latest release from GitHub.
  2. Go to the Plugins → Add New screen in your WordPress admin panel and click the Upload tab at the top.
  3. Upload the zipped archive.
  4. Click the Activate Plugin link after installation completes.

Manual

  1. Download the latest release from GitHub.
  2. Unzip the archive.
  3. Copy the folder to /wp-content/plugins/.
  4. 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 git@github.com:cedaro/metamedia.git

Then go to the Plugins screen in your WordPress admin panel and click the Activate link under Metamedia.

cedaro/metamedia 适用场景与选型建议

cedaro/metamedia 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68 次下载、GitHub Stars 达 8, 最近一次更新时间为 2014 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 cedaro/metamedia 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cedaro/metamedia 我们能提供哪些服务?
定制开发 / 二次开发

基于 cedaro/metamedia 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 68
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-11-13