The question is asked too many times and there are too many different questions and for some reason it seems that i can’t get it to work with none of the answers i have found. The very strange thing is that i had developed themes earlier and it was working.
I need to make some options to my theme, so i made separated menu in wordpress admin area and it works, i added some options to that page and it’s shown, also saving options works.
Now i wanted to make a bit more options and make them tabbed with jquery ui tabs. I know that wordpress natively supports jquery ui now but it needs to be called additionally to load.
So after messing too many with code i at the end ended pulling a code from generatewp.com site which should work, but it don’t, why i can’t understand that.
The current code now is:
function custom_styles() {
wp_register_style( 'jquery-ui-style', 'http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css', false, false );
}
// Hook into the 'admin_enqueue_scripts' action
add_action( 'admin_enqueue_scripts', 'custom_styles' );
// Register Script
function custom_scripts() {
wp_register_script( 'jquery-ui-core', '', array( 'jquery' ), false, false );
wp_register_script( 'jquery-ui-tabs', '', array( 'jquery' ), false, false );
}
// Hook into the 'admin_enqueue_scripts' action
add_action( 'admin_enqueue_scripts', 'custom_scripts' );
According to wordpress records this should register jquery ui tabs and style but it doesn’t.
I tried many other combinations and it simply doesn’t work. Why i can’t understand that.
Straight from the codex @admin_enqueue_scripts There are specific hooks to do what you’re trying to do.