class IBLikeable {
function __construct() {
// ... initialize class properties
add_action( 'admin_print_scripts', array( $this, 'enqueue_admin' ) );
}
function register_admin_menus() {
$hook = add_options_page('ibLikeable Settings', 'ibLikeable', 'manage_options', $this->prefix, array( $this, 'render_settings_page' ) );
$this->settings_hook = $hook;
add_action( 'admin_print_scripts-' . $hook, array( $this, 'enqueue_admin') );
}
// ... more code ...
function enqueue_admin() {
$screen = get_current_screen();
if( $screen->id == $this->settings_hook ) {
wp_register_style($this->prefix . '-settings', $this->url . 'css/settings_page.css' );
wp_enqueue_style( $this->prefix . '-settings');
wp_register_script( $this->prefix . '-settings-js', $this->url . 'js/settings_page.js', array('jQuery') );
wp_enqueue_script($this->prefix . '-settings-js');
}
}
}