• PHP Strict warnings

    `call_user_func_array() expects parameter 1 to be a valid callback, non-static method dc_jqverticalmegamenu::header() should not be called statically 1 wp-includes/plugin.php:503 do_action(‘wp_head’)
    wp_head()
    load_template(‘~/wp-content/themes/mystile-child/header.php’)
    locate_template()
    get_header() Core
    Non-static method dc_jqverticalmegamenu::get_plugin_directory() should not be called statically 1 wp-content/plugins/jquery-vertical-mega-menu/dcwp_jquery_vertical_mega_menu.php:34 dc_jqverticalmegamenu::get_plugin_directory()
    dc_jqverticalmegamenu::header()
    do_action(‘wp_head’)
    wp_head()
    load_template(‘~/wp-content/themes/mystile-child/header.php’)
    locate_template()
    get_header() Plugin: jquery-vertical-mega-menu
    Non-static method dc_jqverticalmegamenu::get_plugin_directory() should not be called statically 1 wp-content/plugins/jquery-vertical-mega-menu/dcwp_jquery_vertical_mega_menu.php:35 dc_jqverticalmegamenu::get_plugin_directory()
    dc_jqverticalmegamenu::header()
    do_action(‘wp_head’)
    wp_head()
    load_template(‘~/wp-content/themes/mystile-child/header.php’)
    locate_template()
    get_header() Plugin: jquery-vertical-mega-menu
    call_user_func_array() expects parameter 1 to be a valid callback, non-static method dc_jqverticalmegamenu::footer() should not be called statically 1 wp-includes/plugin.php:503 do_action(‘wp_footer’)
    wp_footer()
    load_template(‘~/wp-content/themes/mystile-child/footer.php’)
    locate_template()
    get_footer() Core
    `

    https://wordpress.org/plugins/jquery-vertical-mega-menu/

Viewing 3 replies - 1 through 3 (of 3 total)
  • hh3

    (@hh3)

    To avoid the warning, need to fix the ‘header’ function in ‘dcwp_jquery_vertical_mega_menu.php’

    The problem stem from the author trying to call an internal function using static call, I am not sure this is the best fix, but it does fix the problem by simply avoiding the static call and get the plugin directory into a temp variable.

    Unfortunately, it seems this plugin is no longer supported, so I am not sure if it’ll ever be fixed…

    function header(){
            $temp_plugin_dir = WP_PLUGIN_URL . '/jquery-vertical-mega-menu';
            echo "\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$temp_plugin_dir."/css/dcverticalmegamenu.css\" media=\"screen\" />";
    
            // Scripts
                wp_enqueue_script( 'jquery' );
                wp_enqueue_script( 'jqueryhoverintent', $temp_plugin_dir . '/js/jquery.hoverIntent.minified.js', array('jquery') );
                wp_enqueue_script( 'dcjqverticalmegamenu', $temp_plugin_dir  . '/js/jquery.dcverticalmegamenu.1.3.js', array('jquery') );
    
        }
    hh3

    (@hh3)

    To fix the problem, need to modify the ‘header’ function in ‘dcwp_jquery_vertical_mega_menu.php’ file.

    This isn’t the most elegant fix, but it gets the job done:

    function header(){
            $temp_plugin_dir = WP_PLUGIN_URL . '/jquery-vertical-mega-menu';
            echo "\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$temp_plugin_dir."/css/dcverticalmegamenu.css\" media=\"screen\" />";
    
            // Scripts
                wp_enqueue_script( 'jquery' );
                wp_enqueue_script( 'jqueryhoverintent', $temp_plugin_dir . '/js/jquery.hoverIntent.minified.js', array('jquery') );
                wp_enqueue_script( 'dcjqverticalmegamenu', $temp_plugin_dir  . '/js/jquery.dcverticalmegamenu.1.3.js', array('jquery') );
    
        }
    hh3

    (@hh3)

    need to fix “header” function in “dcwp_jquery_vertical_mega_menu.php” file. Unfortunately, since this plugin doesn’t seem to be maintained anymore, you’ll have to make the fix in your plugin.

    It’s not the most elegant way to fix, but this gets the job done (replace your header function with this):

    function header(){
            $temp_plugin_dir = WP_PLUGIN_URL . '/jquery-vertical-mega-menu';
            echo "\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$temp_plugin_dir."/css/dcverticalmegamenu.css\" media=\"screen\" />";
    
            // Scripts
                wp_enqueue_script( 'jquery' );
                wp_enqueue_script( 'jqueryhoverintent', $temp_plugin_dir . '/js/jquery.hoverIntent.minified.js', array('jquery') );
                wp_enqueue_script( 'dcjqverticalmegamenu', $temp_plugin_dir  . '/js/jquery.dcverticalmegamenu.1.3.js', array('jquery') );
    
        }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Strict warnings’ is closed to new replies.