Documentation – Admin Class

Screenwriter instances can be created manually using the Screenwriter_admin() class. This allows for multiple instances to be configured individually (with different options) per post type.

Usage

new Screenwriter_admin( $params, $key );

Parameters

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

  • post_types – an array of post types to be displayed on. Defaults to array(“post”).
  • title – a string to display as the metabox title. Defaults to “Page Content”.
  • priority – priority level of the metabox (default, core, high, low). Defaults to “default”.
  • context – position of the metabox (normal, side, advanced). Defaults to “side”.
  • show_on – an array of post ids to be displayed on. Defaults to array().
  • sections – an array of configuration arrays (key and label), outlining section structure. Defaults to array(“post”).

Default: array()

$key (string) (optional)
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 different Screenwriter instances, preventing possible conflicts.

Default: ‘sc_screenwriter’

Examples

Customise the default Screenwriter instance to display two content sections.

<?php
	$args = array(
		'editors' => array(
			array(
				'key' => 'top_section',
				'label' => 'Top Section'
			),
			array(
				'key' => 'bottom_section',
				'label' => 'Bottom Section'
			)
		)
		);

	new Screenwriter_admin( $args );
?>

Notes

  • If a unique $key is not supplied the Screenwriter admin class will override the initial plugin instance with any new configuration set in the $params array.
  • Due to some conflicts with the TinyMCE plugin it is not possible to display the default WordPress editor on pages where Screenwriter is in use.