我以前在Wordpress中从未见过这个问题。
我构建自定义模板但是当我插入代码时
comments_template();
并提交任何评论,结果是一个空白页面。如果我在我的wp_config中激活WP_debug,就像这样
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
错误(是警告)仅为:
[18-Dec-2014 15:57:15] PHP Notice: wp_enqueue_script se llamó <strong>incorrectamente</strong>. Los scripts y estilos no se deberían registrar o enganchar hasta que se carguen los ganchos y Por favor, mira <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> para más información. (Este mensaje se añadió en la versión 3.3.) in /home/desarrollo/www/mywebsite/www/wp-includes/functions.php on line 3370
[18-Dec-2014 15:57:15] PHP Stack trace:
[18-Dec-2014 15:57:15] PHP 1. {main}() /home/desarrollo/www/mywebsite/www/index.php:0
[18-Dec-2014 15:57:15] PHP 2. require() /home/desarrollo/www/mywebsite/www/index.php:17
[18-Dec-2014 15:57:15] PHP 3. require_once() /home/desarrollo/www/mywebsite/www/wp-blog-header.php:12
[18-Dec-2014 15:57:15] PHP 4. require_once() /home/desarrollo/www/mywebsite/www/wp-load.php:29
[18-Dec-2014 15:57:15] PHP 5. require_once() /home/desarrollo/www/mywebsite/www/wp-config.php:82
[18-Dec-2014 15:57:15] PHP 6. include() /home/desarrollo/www/mywebsite/www/wp-settings.php:329
[18-Dec-2014 15:57:15] PHP 7. wp_enqueue_script() /home/desarrollo/www/mywebsite/www/wp-content/themes/mywebsite/functions.php:262
[18-Dec-2014 15:57:15] PHP 8. _doing_it_wrong() /home/desarrollo/www/mywebsite/www/wp-includes/functions.wp-scripts.php:200
[18-Dec-2014 15:57:15] PHP 9. trigger_error() /home/desarrollo/www/mywebsite/www/wp-includes/functions.php:3370
可能是什么问题?我构建我的functions.php就像其他已启用评论并且运行良好的网站一样。
编辑:
我把我的代码放到了enqueque脚本中,我这只是为了jQuery而已。我总是使用这种方法,并在其他网站上工作。
add_action('init', 'my_init_method');
/* Mi jQuery */
function my_init_method() {
if (!is_admin()){
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', '/wp-content/themes/myTheme/js/jquery-1.11.1.js');
wp_enqueue_script( 'jquery' );
}
}