I need a little bit of insight here with the following problem? I've created a child theme called 'test_child' which I am trying to extend in the following way:
This is the test_child/functions.php file:
<?php
function load_flaticon() {
wp_enqueue_script(
'flaticon', get_stylesheet_directory_uri() . '/js/flaticon.js', array('jquery')
);
}
add_action( 'wp_enqueue_script', 'load_flaticon' );
?>
Then, this is the test_child/js/flaticon.js file:
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
Inside the test_child/header.php I can see somewhere the line:
<!-- wp_head() -->
<?php wp_head();?>
I believe I'm doing it 'by the book' (and I have studied other similar questions), but then again, there must be something I miss, because the script is not enqueued after all...
Could you please lend a fresh pair of eyes?
wp_enqueue_scripts
.wp_enqueue_scripts
instead ofwp_enqueue_script
and it worked like a charm! Thank you for your suggestion @toscho. (P.S. Sorry for my bad grammar)