Since: 1.2.6 Last Updated: Version: 1.5.4
Back to Main Index

This filter allows you to add additional meta fields to the Layers meta box in standard posts. Each meta field references an input() type from the Layers framework. You can also create a custom meta box the standard way, and use Layers input() types.

Location: core/meta/config.php



Line 2: We define the post type here as ‘post’ to affect the existing meta box. If you are targeting a custom post type, this is where you would define it.

Line 3: The initial $custom_meta array defines the meta box Title, which you can change in the ‘title’  value. The next two keys, ‘description’  and ‘position’  should be left as-is.

‘custom-meta’  next defines the meta box content. Layers uses the ‘media’  key for this group of fields.

The first field, or ‘element’, is the ‘video_url’ field. This array should be carried over to preserve the oembed video field and featured video functionality of Layers.

When filtering $custom_meta to add fields to the existing Rich Media box in posts, it is important to preserve the video_url field so you don’t break feature video in posts on user’s existing setups.

Your ‘custom-meta’ arrays can be inserted after or before the ‘video_url’ array. In the example, we insert a new field 'client_name'   and 'client_url'   below the Video URL



The 'type'  of fields you can add correspond to types found in the input() reference.


The method is much the same, you just need to instance your filter and use a public function:

Displaying on the Frontend

Use get_post_meta() as normal from inside the loop. Using our example above, the following demonstrates output of the client name value only:

In this example, we retrieve all post meta from this post, then use the key