Before installing the extension, you need to install Meta Box plugin first.
- Go to Plugins → Add New and search for Meta Box
- Click Install Now button to install the plugin
- 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.
- Go to Plugins, click Add new, then click Upload plugin.
- Choose the
.zipfile you downloaded and click Install now
- After finishing upload, click Activate to finish.
To add show, hide conditions to your meta box, you need to add parameter
hide accordingly to the meta box configuration.
Each parameter (
hide) is an array and has the same following elements:
relation: The logical operator to combine conditions:
OR. The default value is
OR. Case insensitive. Optional.
If one of the following conditions matched (
OR) or all of the following conditions matched (
AND), then the meta box is shown or hid.
|List of page templates, match if the current page has a page template in the list. Array. Case insensitive. Optional.|
|List of post formats, match if the current post has a format in the list. Array. Case insensitive. Optional.|
|List of categories IDs or names (NO slugs), match if the current post has a category in the list. Array. Case sensitive. Optional.|
|List of custom taxonomy terms’ IDs or names (NO slugs). Here |
|Boolean. Match if the current page is a child page or not. Optional.|
|Array of pairs of CSS selectors and values. Match if the inputs (with specified CSS selector) has the defined value. Note: the |
Here is the demo code with all explanation in comments: