Documentation – Admin Class

Multiple Mockingbird instances can be created manually using the Mockingbird_admin() class. This allows for more than one Mockingbird to be installed per post type (with different configuration options).

Usage

new Mockingbird_admin( $unique_key, $params );

Parameters

$unique_key (string) (required)
A string value specifying the unique key used to save data to the WordPress post_meta table. A unique key is required to separate data from other Mockingbird instances, preventing any possible conflicts.

Default: none

$params (array) (optional)
An array of specified configuration values for the Mockingbird instance. This provides a framework outlining how the instance should behave. The configuration options are:

  • display_on – an array of post types to be displayed on. Defaults to array(“post”).
  • types_to_display – an array of post types to select items from. Defaults to array(“post”).
  • show_on – an array of post ids to be displayed on. Defaults to array().
  • title – a string to display as the metabox title. Defaults to “Related Content”.
  • description – a string to display as the metabox instruction text. Defaults to “”.
  • priority – priority level of the metabox (default, core, high, low). Defaults to “default”.
  • context – position of the metabox (normal, side, advanced). Defaults to “side”.

Default: array()

Examples

Create an additional Mockingbird instance, with different configuration settings.

<?php
	$args = array(
		'display_on' => array('page'),
		'types_to_display' => array('testimonials'),
                'title' => 'Testimonials'
		);

	new Mockingbird_admin( "testimonials", $args );
?>

Notes

  • If a unique key is not supplied the Mockingbird_admin class will override the initial plugin instance with any new configuration set in the $params array.
  • As this function creates a new instance, any saved Mockingbird settings will not be applied to the new instance. Any intended deviation from the default settings has to be configured manually using the $params array.