#Installation

Before installing the extension, you need to install Meta Box plugin first.

  1. Go to Plugins → Add New and search for Meta Box
  2. Click Install Now button to install the plugin
  3. After installing, click Activate Plugin to activate the plugin

The extension is just a WordPress plugin, you can install it like a normal WordPress plugin.

  1. Go to Plugins, click Add new, then click Upload plugin.
  2. Choose the .zip file you downloaded and click Install now
  3. After finishing upload, click Activate to finish.

#Usage

Make sure you know how to register meta boxes and define fields before continuing!

To add show, hide conditions to your meta box, you need to add parameter show or hide accordingly to the meta box configuration.

Each parameter (show, hide) is an array and has the same following elements:

  • relation: The logical operator to combine conditions: AND or OR. The default value is OR. Case insensitive. Optional.

If one of the following conditions matched (relation = OR) or all of the following conditions matched (relation = AND), then the meta box is shown or hid.

ParameterDescription
templateList of page templates, match if the current page has a page template in the list. Array. Case insensitive. Optional.
post_formatList of post formats, match if the current post has a format in the list. Array. Case insensitive. Optional.
categoryList of categories IDs or names (NO slugs), match if the current post has a category in the list. Array. Case sensitive. Optional.
taxonomy_slugList of custom taxonomy terms’ IDs or names (NO slugs). Here taxonomy_slug is the slug of the taxonomy (like section, region, etc.). Match if the current post has a term in the list. Array. Case sensitive. Optional.
is_childBoolean. Match if the current page is a child page or not. Optional.
input_valueArray of pairs of CSS selectors and values. Match if the inputs (with specified CSS selector) has the defined value. Note: the relation is also applied to rules here. Added in version 0.2.

Here is the demo code with all explanation in comments: