Possible solution for broken accordion
-
When I installed sp_faq, the accordions wouldn’t work because of the hard-coded insertion of your jquery on line 163-171 of faq.php. It’s loading this before jQuery is loaded, so I’m getting an uncaught reference error as my jquery is enqueued in the footer of the site, per best practice.
You’ve enqueued the css files and the jQuery accordion file itself, so can you not do something like:
function sp_faq_script() { ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.faq-accordion [data-accordion]').accordionfaq({ singleOpen: <?php echo $faqsingleOpen; ?>, transitionEasing: 'ease', transitionSpeed: <?php echo $faqtransitionSpeed; ?> }); }); </script> <?php } add_action( 'wp_footer', 'sp_faq_script',100 );
Please let me know whether this is viable, as I don’t want to overwrite core files (in case of updates) and certainly don’t want to spend any more time or money until I know it will work.
Thanks,
Emma
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Possible solution for broken accordion’ is closed to new replies.