Skip to content

Instantly share code, notes, and snippets.

@litonarefin
Created April 6, 2021 14:24
Show Gist options
  • Save litonarefin/e846369091e7be8a99c8d2f104bbc253 to your computer and use it in GitHub Desktop.
Save litonarefin/e846369091e7be8a99c8d2f104bbc253 to your computer and use it in GitHub Desktop.
<?php
if (!class_exists('CSF_Callback_Testing')) {
class CSF_Callback_Testing
{
public $prefix = '_testing_callback';
public $options;
public $post_types = '';
public function __construct()
{
$this->columns_settings();
$this->options = get_option($this->prefix);
}
public function columns_settings()
{
if (!class_exists('CSF')) {
return;
}
// CSF Options
\CSF::createOptions($this->prefix, array(
// Framework Title
'framework_title' => 'Testing Callback <small>by Jewel Theme</small>',
'framework_class' => 'testing-callback',
// menu settings
'menu_title' => 'Testing Callback',
'menu_slug' => 'testing-callback',
'menu_type' => 'submenu', // menu, submenu, options, theme, etc.
'menu_capability' => 'manage_options',
'menu_icon' => '',
'menu_position' => 44,
'menu_hidden' => false,
'menu_parent' => 'csf-settings',
// menu extras
'show_bar_menu' => true,
'show_sub_menu' => true,
'show_in_network' => true,
'show_in_customizer' => false,
'show_search' => false,
'show_reset_all' => false,
'show_reset_section' => false,
'show_footer' => true,
'show_all_options' => true,
'show_form_warning' => true,
'sticky_header' => false,
'save_defaults' => true,
'ajax_save' => true,
// admin bar menu settings
'admin_bar_menu_icon' => '',
'admin_bar_menu_priority' => 45,
// footer
'footer_text' => '',
'footer_after' => '',
'footer_credit' => '',
// database model
'database' => 'network', // options, transient, theme_mod, network(multisite support)
'transient_time' => 0,
// contextual help
'contextual_help' => array(),
'contextual_help_sidebar' => '',
// typography options
'enqueue_webfont' => true,
'async_webfont' => false,
// others
'output_css' => true,
// theme and wrapper classname
'nav' => 'normal',
'theme' => 'dark',
));
// Testing Callback Settings
\CSF::createSection($this->prefix, array(
'title' => 'Others',
'icon' => 'fas fa-bolt',
'fields' => array(
array(
'id' => 'post_types',
'type' => 'select',
'title' => 'Select Post Types',
'placeholder' => 'Select a post type',
'options' => 'post_types',
),
array(
'type' => 'callback',
'function' => 'CSF_Callback_Testing::my_callback_functiossn',
),
)
));
}
public static function my_callback_functiossn()
{
echo 'ljasdhlfjks';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment