I’ve been using the jQuery Vertical Accordion Menu plugin for quite some time now but when I updated to WordPress 4.1
the plugin throws an error message that looks like the screenshot provided here.
I think I’ve located it to the dcwp_jquery_accordion.php
since it doesn’t display the error when those lines are commented out.
What is the correct way to use the add_action?
Thanks!
Best regards,
Marcus
function dc_jqaccordion(){
global $registered_skins;
if(!is_admin()){
// Header styles
// add_action( 'init', array('dc_jqaccordion', 'header') );
// Shortcodes
add_shortcode( 'dcwp-jquery-accordion', 'dcwp_dc_jqaccordion_shortcode' );
}
// add_action( 'wp_footer', array('dc_jqaccordion', 'footer') );
$registered_skins = array();
The issue in my case was that the functions needed to be
public static function
instead of justfunction
The plugin works now.
Thanks @mmk
The correct way to use
add_action()
is like so:if you want to enqueue scripts you can do it in using another
add_action()
like so:The
true
part means the script will get enqueued in the footer.false
renders the script in the header.