我需要了解一下以下问题?我创建了一个名为“test\\u child”的子主题,我正试图通过以下方式扩展它:
这是test\\u子/函数。php文件:
<?php
function load_flaticon() {
wp_enqueue_script(
\'flaticon\', get_stylesheet_directory_uri() . \'/js/flaticon.js\', array(\'jquery\')
);
}
add_action( \'wp_enqueue_script\', \'load_flaticon\' );
?>
然后,这是test\\u child/js/flaticon。js文件:jQuery(document).ready(function($) {
$("a[href$=\'.pdf\']").addClass(\'flaticon-pdf19\');
$("a[href$=\'.ppt\']").addClass(\'flaticon-ppt\');
$("a[href$=\'.pptx\']").addClass(\'flaticon-pptx2\');
$("a[href$=\'.doc\']").addClass(\'flaticon-doc2\');
$("a[href$=\'.docx\']").addClass(\'flaticon-docx\');
$("a[href$=\'.xls\']").addClass(\'flaticon-xls1\');
$("a[href$=\'.xlsx\']").addClass(\'flaticon-xlsx\');
});
// by the way have already tried the " .ready(function() { " version
在test\\u子级/头中。php我可以看到行的某个地方:<!-- wp_head() -->
<?php wp_head();?>
我相信我是在“照本宣科”(我还研究了其他类似的问题),但我还是错过了一些东西,因为脚本毕竟没有排队。。。请你换一双新眼睛好吗?