Pl add options page

[edit] Please Note

These docs are now deprecated, we have a new Support area located here

(Difference between revisions)
(Examples)
 
Line 35: Line 35:
  
 
<syntaxhighlight>pl_add_options_page( array( 'name' => 'test', 'array' => $options, 'position' => 3 ) );</syntaxhighlight>
 
<syntaxhighlight>pl_add_options_page( array( 'name' => 'test', 'array' => $options, 'position' => 3 ) );</syntaxhighlight>
 
  
 
==== Add menu with raw HTML ====
 
==== Add menu with raw HTML ====

Latest revision as of 19:29, 26 March 2012

Function

pl_add_options_page adds a new tab to the main options area, with either HTML content or with an array of options.

Usage

Parameters

$args

  • name - string - Menu slug.
  • title - string - title of page ( if raw is used )
  • raw - string - Content for page ( html ) can be returned from a function
  • array - array - Array containing options
  • icon - "URL to icon"
  • position - "int - Position in menu"

Examples

All examples will use the following basic array option

$options = array(
	'foo_field'		=> array(
		'default'	=> '',
		'type'		=> 'text',
		'title'		=> __('Foo', 'pagelines'),
		'inputlabel'=> __('More Foo', 'pagelines'),
		'shortexp'	=> __('Foo foo foo foo.', 'pagelines'),
	),
);

Add menu with array

This example will add a new menu tab called 'test' and use the $options array to populate it.

pl_add_options_page( array( 'name' => 'test', 'array' => $options ) );

Add menu with array with a position

pl_add_options_page( array( 'name' => 'test', 'array' => $options, 'position' => 3 ) );

Add menu with raw HTML

pl_add_options_page( array( 'name' => 'test', 'raw' => '

hello

' ) );
pl_add_options_page( array( 'name' => 'test', 'raw' => $this->custom_html() ) );

Resources

Changelog

Since 2.2

Source File

pl_add_options_page() is located in includes/library.layout.php