Loading...
Knowledge Base

Code Snippets

Code Snippets

The following code snippets provide various different examples on how to customize and extend NS Basics. These code examples can be placed in your theme’s functions.php file, or a plugin file.

Creating a New Admin Field


function build_test_field($field) {
echo '';
}
function test($field_types) {
$field_types['test_field'] = 'build_test_field';
return $field_types;
}
add_filter('ns_basics_admin_field_types', 'test');


//output field
$admin_obj = new NS_Basics_Admin();
$test_field = array(
'title' => 'Test Field',
'name' => 'test_field',
'type' => 'test_field',
);
$admin_obj->build_admin_field($test_field);