";
}
}
function admin_assets($page){
wp_register_style( $this->artesans_plugin_slug, plugins_url("css/ns-custom.css",__FILE__), false, '1.0.0' );
wp_register_script( $this->artesans_plugin_slug, plugins_url("js/ns-custom.js",__FILE__), false, '1.0.0' );
if( strpos($page, $this->artesans_plugin_ref) !== false ){
wp_enqueue_style( $this->artesans_plugin_slug );
wp_enqueue_script( $this->artesans_plugin_slug );
}
}
/**********************************
* SETTINGS PAGE
*/
function register_settings_fields() {
add_settings_section(
$this->artesans_plugin_ref.'_set_section', // ID used to identify this section and with which to register options
$this->artesans_plugin_name, // Title to be displayed on the administration page
false, // Callback used to render the description of the section
$this->artesans_plugin_ref // Page on which to add this section of options
);
add_settings_field(
$this->artesans_plugin_ref.'_field1', // ID used to identify the field
'Setting Name', // The label to the left of the option interface element
array($this,'show_settings_field'), // The name of the function responsible for rendering the option interface
$this->artesans_plugin_ref, // The page on which this option will be displayed
$this->artesans_plugin_ref.'_set_section',// The name of the section to which this field belongs
array( // args to pass to the callback function rendering the option interface
'field_name' => $this->artesans_plugin_ref.'_field1'
)
);
register_setting( $this->artesans_plugin_ref, $this->artesans_plugin_ref.'_field1');
}
function show_settings_field($args){
$saved_value = get_option( $args['field_name'] );
// initialize in case there are no existing options
if ( empty($saved_value) ) {
echo ' ';
} else {
echo ' ';
}
}
function register_settings_page(){
add_submenu_page(
'options-general.php', // Parent menu item slug
__($this->artesans_plugin_name, $this->artesans_plugin_name), // Page Title
__($this->artesans_plugin_menu, $this->artesans_plugin_name), // Menu Title
'manage_options', // Capability
$this->artesans_plugin_ref, // Menu Slug
array( $this, 'show_settings_page' ) // Callback function
);
}
function show_settings_page() { ?>