我试图用这个有道理图库我发现[http://miromannino.github.io/Justified-Gallery/][1]麻烦与enqueue_scripts的画廊插件
[1]:http://miromannino.github.io/Justified-Gallery/本网站www.dangoodeofficial.co.uk
我设法得到它的工作通过添加这是页脚 -
<script src="http://dangoodeofficial.co.uk/wp-content/plugins/Justified-Gallery/libs/jquery/jquery.min.js"></script>
<link rel="stylesheet" href="http://dangoodeofficial.co.uk/wp-content/plugins/Justified-Gallery/dist/css/justifiedGallery.min.css" type="text/css" media="all">
<script src="http://dangoodeofficial.co.uk/wp-content/plugins/Justified-Gallery/dist/js/jquery.justifiedGallery.min.js"></script>
但jquery.min.js弄乱我的网站的其余部分。从以前的问题我问我相信这是因为Wordpress已经内置jQuery,但我只能让画廊显示,当我将jquery.min.js包含在页脚中时。
我一直在试图找出如何排队脚本,因为我相信这是解决我的问题的方式。我从来没有这样做过,所以我不知道从哪里开始。我做我的研究,我已将此添加到我的孩子主题的functions.php
// Additional Functions
// =============================================================================
function justifiedGallery() {
wp_enqueue_script('jQuery');
wp_register_script('JG_jQuery_js', get_template_directory_uri() . '/plugins/Justified-Gallery/libs/jquery/jquery.min.js', array('jQuery'),'', true);
wp_register_script('JG_js', get_template_directory_uri() . '/plugins/Justified-Gallery/dist/js/jquery.justifiedGallery.min.js', array('jQuery'),'', true);
wp_register_style('JG_css', get_template_directory_uri() . '/plugins/Justified-Gallery/dist/css/justifiedGallery.min.css', '','','screen');
wp_enqueue_script('JG_jQuery_js');
wp_enqueue_script('JG_js');
wp_enqueue_style('JG_css');
}
add_action ('wp_enqueue_scripts', 'justifiedGallery');
但我就是不能完全似乎得到它的工作。我甚至尝试将我想要调用的三个文件上传到我的子主题目录,以便文件路径为/wp-content/themes/x-child/js/jquery.justifiedGallery.min.js以及类似的两个文件并使用
get_stylesheet_directory_uri() . 'js/.justifiedGallery.min.js', array('jQuery'),'', true);
我知道有可能只是一个简单的错误的地方,但我的知识有限,我无言以对。非常感激任何的帮助。
谢谢
嗨,杰克,谢谢你的回应。我想我可能会问错误的问题。我想我真的需要知道的是,我如何使这个http://miromannino.github.io/Justified-Gallery(http://miromannino.github.io/Justified-Gallery)从gitHub的jQuery插件工作在我的WordPress的网站?谢谢,丹 –