Support » Plugin: Admin Collapse Subpages » Fix for wp_enqueue_script notices

  • Resolved dotkev

    (@dotkev)


    inside admin_collapse_subpages.php, replace content at

    if ( is_admin() ) { .. }

    with

    if ( is_admin() ) {
            function acs_scripts() {
              //make sure jquery is loaded
              wp_enqueue_script('jquery');
    
              //cookie script for saving collapse states
              wp_enqueue_script('jquery-cookie', COLLAPSE_SUBPAGES_PATH .'js/jquery.cookie.js', 'jquery', '1.0');
    
              //main collapse pages script
              wp_enqueue_script('admin_collapse_subpages', COLLAPSE_SUBPAGES_PATH .'js/admin_collapse_subpages.js', FALSE, '2.1');
    
              //Load Styles
              wp_enqueue_style('admin_collapse_subpages_styles', COLLAPSE_SUBPAGES_PATH .'css/style.css', false, '1.0', 'screen');
            }
            add_action( 'wp_enqueue_script', 'acs_scripts');
          }

    http://wordpress.org/plugins/admin-collapse-subpages/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hm, that didn’t work for me but this did.
    First, nix the if (is_admin()) {} then replace with:

    add_action( 'admin_init', 'acs_scripts' );
    function acs_scripts() {
    	//make sure jquery is loaded
    	wp_enqueue_script('jquery');
    
    	//cookie script for saving collapse states
    	wp_enqueue_script('jquery-cookie', COLLAPSE_SUBPAGES_PATH .'js/jquery.cookie.js', 'jquery', '1.0');
    
    	//main collapse pages script
    	wp_enqueue_script('admin_collapse_subpages', COLLAPSE_SUBPAGES_PATH .'js/admin_collapse_subpages.js', FALSE, '2.1');
    
    	//Load Styles
    	wp_enqueue_style('admin_collapse_subpages_styles', COLLAPSE_SUBPAGES_PATH .'css/style.css', false, '1.0', 'screen');
    }
    Plugin Author bravokeyl

    (@bravokeyl)

    Fixed in version 2.0

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fix for wp_enqueue_script notices’ is closed to new replies.