Check for Twitter Bootstrap Loaded

There is no good way of doing this. One way is to enumerate the already registered scripts, like this: function yourplugin_add_my_stylesheet() { global $wp_styles; if ( $wp_styles instanceof WP_Styles ) { // enumerate all current styles foreach( $wp_styles->queue as $handle ) { // use the $handle to see if it’s called ‘bootstrap’ $obj = $wp_styles->registered[$handle]; … Read more

Understanding wp_enqueue_style

Scripts and styles get output with wp_head and wp_footer functions. If you enqueue a style after wp_head, it will be output in wp_footer, which, while in practice will often work, means the theme’s html will not validate. It’s up to you (or whomever is building a theme/plugin) to enqueue styles early enough to be output … Read more

FullCalendar in WordPress is not working

You page is generating two errors: Uncaught TypeError: undefined is not a function. This is likely due to the fact that WordPress sets jQuery to NoConflict mode. Your script is using the $ shortcut and is failing. Modify your script accordingly, either replacing the shortcut or wrapping the jQuery. https://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers

Deregister scripts from plugin

There’s a much better and more reliable way than naming your plugin “ZZ” – use a delayed hook on plugins_loaded, which fires after all plugins are loaded: function wpse_191178_plugins_loaded() { // Do your stuff } add_action( ‘plugins_loaded’, ‘wpse_191178_plugins_loaded’, 100 );

Including Styles and JS files to work ON my plugin interface

Well after a bit of better searching i found the answer, function my_enqueue($hook) { if ( ‘settings_page_data-layer-management’ != $hook ) { return; } wp_enqueue_script( ‘my_custom_script’, plugins_url( ‘js/dlm-window.js’, __FILE__ )); } add_action( ‘admin_enqueue_scripts’, ‘my_enqueue’ ); to explain just incase anyone has this issue. what i had earlier was a ‘front-end’ hook which is just wp_enqueue_scripts for … Read more

How to get rid off default css styles

there are two ways, first: if you want to remove default style, just dequeue them using wp_dequeue_style( ‘style_file_name_here’ ). second: you can rename the existing file and create a new one with the same name, just place style hook info into new style file, like: /* Theme Name: Theme name Author: Author name */ remember, … Read more

Load stylesheet on custom admin submenu page

Ok, I figured it out: If it’s a submenu page, the $hook looks like this: appearance_page_page-name instead of going by URL. So the complete code would be this: function my_function($hook) { if ( ‘appearance_page_page-name’ != $hook ) { return; } wp_enqueue_style( ‘custom-style’, get_template_directory_uri() . ‘custom-page/style.css’ ); } add_action( ‘admin_enqueue_scripts’, ‘my_function’ );

using wp enqueue style to create a CSS file specifically for a page template

If “/styledtwentyfifteen” is your child directory then that’s included by get_stylesheet_directory_uri() (of which bloginfo(‘stylesheet_directory’) is an alias) so you should leave it out on registering: function register_more_stylesheets() { wp_register_style( ‘stylesheet_name’, get_stylesheet_directory_uri() . ‘/background-slider-template.css’ ); } Similarly with is_page_template() you only need the file name (relative to the template directory), and if you register a style … Read more