Skip to content
raoabid edited this page Sep 4, 2018 · 9 revisions

Welcome to the Exopite-Simple-Options-Framework wiki!

Documentation is still in progress, we will be putting in the guide here. Not necessarily be arranged yet

Types of items this framework helps in creating

Menu | Metabox

Menu

  1. How to Create Menu
  1. Default options while create menu

How to Create Menu

Main Menu

$config_main_menu = array(
	// Required, menu or metabox
	'type'            => 'menu',
	// Required, meta box id, unique per page, to save: get_option( id )
	'id'              => 'plugin_name_options',
	// //The Menu Title in Wp Admin
	'menu_title'      => __( 'Plugin', 'text-domain' ),
	// Required for submenu
	'submenu'         => false,
	//The name of this page
	'title'           => __( 'Plugin Settings', 'text-domain' ),
	// The capability needed to view the page
	'capability'      => 'manage_options',
	// plugin_basename required to add plugin action links
	'plugin_basename' => plugin_basename( plugin_dir_path( __DIR__ ) . 'plugin-name.php' ),
	// Settings Link in Plugin Action Links  allowed options: TRUE | FALSE | ARRAY 
	'settings_link'   => array(
		array(
			'text' => __( 'My 1st Link', 'text-domain' ),
			'url'  => 'https://google.com/',
			'type' => 'external',
		),
		array(
			'text' => __( 'Settings', 'text-domain' ),
			'type' => 'default',
		),
		array(
			'text' => __( 'My File Link', 'text-domain' ),
			'url'  => 'plugin_base_name.php',
			'type' => 'file',
		),

	),
	// dashicons id or url to icon
	// https://developer.wordpress.org/resource/dashicons/
	'icon'            => 'dashicons-performance',
);

Sub Menu

/**
 * Create a submenu page under Plugins.
 * Framework also add "Settings" to your plugin in plugins list.
 * @link https://github.com/JoeSz/Exopite-Simple-Options-Framework
 */
$config_submenu = array(
	'type'              => 'menu',                          // Required, menu or metabox
	'id'                => $this->plugin_name . '-test',    // Required, meta box id, unique per page, to save: get_option( id )
	'menu'              => 'plugins.php',                   // Required, sub page to your options page
	'submenu'           => true,                            // Required for submenu
	'title'             => 'Demo Admin Page',               //The name of this page
	'capability'        => 'manage_options',                // The capability needed to view the page
	'plugin_basename'   =>  plugin_basename( plugin_dir_path( __DIR__ ) . $this->plugin_name . '.php' ),
	// 'tabbed'            => false,
);

Default options for menu creation:

$default = array(
	'menu'          => 'plugins.php',
	// Required for submenu
	'submenu'       => false,
	//The name of this page
	'title'         => __( 'Exopite Options Framework', 'exopite-options-framework' ),
	// The capability needed to view the page
	'capability'    => 'manage_options',
	'settings_link' => true
);

available filter to override: 'exopite_sof_filter_config_default_menu_array'

Metabox