Autor | Zpráva | ||
---|---|---|---|
sjiamnocna Profil |
#1 · Zasláno: 20. 7. 2014, 12:15:25
Zdravím, chtěl jsem vyzkoušet, co dělá můj Wordpress v pozadí, a zapnul jsem WP_DEBUG a později i WP_DEBUG_LOG, čímž mi vyvstaly dvě upomínky
[20-Jul-2014 09:36:13 UTC] PHP Notice: wp_register_script was called <strong>incorrectly</strong>. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /data/web/virtuals/72282/virtual/www/wp-includes/functions.php on line 3245 tyto dvě jsou identické, pouze se liší tím, že jedna je pro wp_register_style. Zjistil jsem, že za to může můj plugin WP Songbook, ale narážka na wp_register_style/wp_register_script je jen v jednom souboru: wp_register_script('songbook_jquery_dragsort',plugins_url().'/wp-songbook/js/jquery.dragsort-0.5.1.min.js',array('jquery')); wp_register_script('songbook_files_functions',plugins_url().'/wp-songbook/js/files_fcs.js',array('jquery')); wp_register_script('songbook_filebox_script',plugins_url().'/wp-songbook/js/filescript.js',array('jquery','songbook_files_functions')); // wp_register_script('songbook_tooltips_script',plugins_url().'/wp-songbook/js/tooltips.js',array('jquery','songbook_jquery_custom')); wp_register_style('songbook_jqueryuistyle',plugins_url().'/wp-songbook/css/jqueryui_customstyle.css'); wp_register_style('songbook_filebox_style',plugins_url().'/wp-songbook/css/filestyle.css'); wp_register_style('songbook_filetypes_css',plugins_url().'/wp-songbook/css/filetypes.css'); wp_register_style('songbook_settings_style',plugins_url().'/wp-songbook/css/settstyle.css'); wp_register_style('songbook_songlist_style',plugins_url().'/wp-songbook/css/songlist.css'); wp_register_style('songbook_songbase_style',plugins_url().'/wp-songbook/css/songbasics.css'); jsou součástí fce songbook_plugin_init(), spouštěné při akci 'plugins_loaded': add_action('plugins_loaded','songbook_plugin_init'); Máte někdo nějaký nápad? Moc děkuji :) |
||
alala Profil |
#2 · Zasláno: 20. 7. 2014, 13:56:36
add_action('plugins_loaded','songbook_plugin_init');
vyměň za add_action( 'wp_enqueue_scripts', 'songbook_plugin_init' ); |
||
sjiamnocna Profil |
#3 · Zasláno: 20. 7. 2014, 17:30:02
Funguje :)
Děkuji za pomoc :) |
||
Časová prodleva: 11 let
|
0