NLCW88
Forum Replies Created
-
Hi Javier,
Thanks for the fast response. I’ll let you know if we require anything further down the road.
Best
Forum: Fixing WordPress
In reply to: JQuery AccordionHi Andrew,
Thanks for the advice. I removed the spaces and it worked. Thanks a lot!
Hi Ravi,
Sorry, I’m new to this so don’t have the depth of understanding that you have. From what you said, if the JQuery UI is already enqueued automatically by WordPress I assume that all you have to do is call the Accordion function in the HTML. Therefore, I deleted
function add_accordion() { wp_enqueue_script( 'add-accordion', get_stylesheet_directory_uri() . '/js/accordion.js', array('jquery-ui-core', 'jquery-ui-accordion') ); } add_action( 'wp_enqueue_scripts', 'add_accordion' );in functions.php. However, the accordion stopped working.
I reinserted the code and it worked again. Do you have a more elegant method that I am missing?
Thanks all.
Forum: Fixing WordPress
In reply to: JQuery AccordionHi potentdevelopment,
Thanks for the feedback.
You were right, I looked at the console which led me to discover that I was usingget_template_directory_uri().to call the accordion.js file. This was wrong as it was searching the parent theme folder, which didn’t have the above file. Instead, I should have been usingget_stylesheet_directory_uri().as this is a child theme. I now don’t have any errors in the JavaScript Console.However, the accordion function still isn’t working!
Cheers.