我正在尝试加载砖石结构,但我运气不好,我设法手动加载,但后来我意识到它包含在wordpress核心中,所以我想这很方便。
我把它排成这样(我真的很讨厌这个词):
function lart_front_end_scripts() {
if (is_admin()) return;
wp_enqueue_script(\'jquery\', \'1.10.2\' );
wp_enqueue_script(\'jquery-masonry\', array(\'jquery\'));
}//End add_scripts
add_action(\'wp_print_scripts\', array(&$this,\'lart_front_end_scripts\'));
其他jquery像正常情况一样加载,但我在控制台中不断得到“masonry没有方法”,显然没有加载它,因为它在网络脚本控制台下不存在。非常感谢您的帮助。
Edit: I\'ve updated my code to use enqueue_script instead of print_script.
function masonry() {
wp_enqueue_script(\'jquery-masonry\');
}//End add_scripts
add_action(\'wp_enqueue_scripts\', array(&$this, \'masonry\'));
还是没有骰子。