I've been reading up a bit on this subject, but the more I read - the more confused I get.
Can someone explain to me in short what's the exact difference between
wp_enqueue_scripts,wp_register_scriptsandwp_print_scripts?For example, I have the following code in my functions.php - and it's working, but I do not understand why I can not use
wp_print_scriptsfor the stylesheets, whereas the code still works if I usewp_enqueue_scriptsfor the javascript files:add_action('wp_print_scripts', 'add_my_js'); function add_my_js(){ if(!is_admin()){ wp_enqueue_script('default', get_bloginfo('stylesheet_directory').'/js/default.js', array('jquery')); } } add_action('wp_enqueue_scripts', 'add_my_stylesheet'); function add_my_stylesheet() { wp_register_style('default', get_bloginfo( 'stylesheet_url')); wp_enqueue_style( 'default'); }
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
|
|||
|
|
|
you can't register or enqueue styles in the refer to the action reference to see the order things are executed in in a request:
|
|||||||
|