Title: [Plugin: jQuery Collapse-O-Matic] Enqueue error
Last modified: August 20, 2016

---

# [Plugin: jQuery Collapse-O-Matic] Enqueue error

 *  Resolved [pborg](https://wordpress.org/support/users/pborg/)
 * (@pborg)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-jquery-collapse-o-matic-enqueue-error/)
 * Plugin does what it says but causes “wp_enqueue_script was called incorrectly”
   and “wp_register_style was called incorrectly” errors when debug is turned on.
 * [http://wordpress.org/extend/plugins/jquery-collapse-o-matic/](http://wordpress.org/extend/plugins/jquery-collapse-o-matic/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [lancehudson](https://wordpress.org/support/users/lancehudson/)
 * (@lancehudson)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-jquery-collapse-o-matic-enqueue-error/#post-2490504)
 * I patched my version of the script.
 *     ```
       <?php
       /*
       Plugin Name: jQuery Collapse-O-Matic
       Plugin URI: http://www.twinpictures.de/jquery-collapse-o-matic-1-3/
       Description: Collapse-O-Matic adds an <code>[expand]</code> shortcode that wraps content into a lovely, jQuery collapsible div.
       Version: 1.3.13
       Author: Twinpictures
       Author URI: http://www.twinpictures.de
       License: GPL2
       */
   
       /*  Copyright 2012 Twinpictures (www.twinpictures.de)
   
           This program is free software; you can redistribute it and/or modify
           it under the terms of the GNU General Public License, version 2, as
           published by the Free Software Foundation.
   
           This program is distributed in the hope that it will be useful,
           but WITHOUT ANY WARRANTY; without even the implied warranty of
           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
           GNU General Public License for more details.
   
           You should have received a copy of the GNU General Public License
           along with this program; if not, write to the Free Software
           Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       */
   
       function collapsTronicInit() {
               wp_enqueue_script('jquery');
   
               $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
               if (!is_admin()){
                   //collapse script
                   wp_register_script('collapseomatic-js', $plugin_url.'/collapse.js', array ('jquery'), '1.2.7' );
                   wp_enqueue_script('collapseomatic-js');
   
                       //css
                   wp_register_style( 'collapseomatic-css', $plugin_url.'/style.css', array (), '1.4' );
                   wp_enqueue_style( 'collapseomatic-css' );
               }
   
               add_shortcode('expand', 'collapsTronic');
               add_shortcode('expandsub1', 'collapsTronic');
               add_shortcode('expandsub2', 'collapsTronic');
               add_shortcode('expandsub3', 'collapsTronic');
   
               //add the filter to the sidebar widgets
               add_filter('widget_text', 'do_shortcode');
   
       }
   
       add_action('init', 'collapsTronicInit');
   
       function collapsTronic($atts, $content = null){
           //find a random number, incase there is no id assigned
               $ran = rand(1, 10000);
               extract(shortcode_atts(array(
                       'title' => '',
                       'swaptitle' => '',
                       'alt' => '',
                       'id' => 'id'.$ran,
                       'tag' => 'span',
                       'trigclass' => '',
                       'targclass' => '',
                       'rel' => '',
                       'expanded' => '',
                       'excerpt' => '',
                       'excerptpos' => 'below-trigger',
                       'excerpttag' => 'div',
                       'excerptclass' => '',
               ), $atts));
   
               if($excerpt){
                       if($excerptpos == 'above-trigger'){
                               $nibble = '<'.$excerpttag.' class="'.$excerptclass.'">'.$excerpt.'</'.$excerpttag.'>';
                       }
                       else{
                               $nibble = '<'.$excerpttag.' class="collapseomatic_excerpt '.$excerptclass.'">'.$excerpt.'</'.$excerpttag.'>';
                       }
   
               }
               $altatt = '';
               if($alt){
                       $altatt = 'alt="'.$alt.'" title="'.$alt.'"';
               }
               else{
                       $altatt = 'title="'.$title.'"';
               }
               $relatt = '';
               if($rel){
                       $relatt = 'rel="'.$rel.'"';
               }
               if($expanded){
                       $trigclass .= ' colomat-close';
               }
               $link = '<'.$tag.' class="collapseomatic '.$trigclass.'" id="'.$id.'" '.$relatt.' '.$altatt.'>'.$title.'</'.$tag.'>';
               if($swaptitle){
                       $link .= '<'.$tag.' id="swap-'.$id.'" style="display:none;">'.$swaptitle.'</'.$tag.'>';
               }
               $eDiv = '';
               if($content != ' '){
                       $eDiv = '<div id="target-'.$id.'" class="collapseomatic_content '.$targclass.'">'.do_shortcode($content).'</div>';
               }
               if($excerpt){
                       if($excerptpos == 'above-trigger'){
                               return $nibble . $link . $eDiv;
                       }
                       else if($excerptpos == 'below-trigger'){
                               return $link . $nibble . $eDiv;
                       }
                       else{
                               return $link . $eDiv . $nibble;
                       }
               }
               else{
                       return $link . $eDiv;
               }
       }
       ```
   
 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-jquery-collapse-o-matic-enqueue-error/#post-2490536)
 * Gentlemen: version 3.1.14 addressed this issue. Thank you both for the feedback
   _and_ solution! Credit was given in the change log. Please test and report back
   with your results.
 * Again, thank you–the WordPress community rocks hard!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: jQuery Collapse-O-Matic] Enqueue error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/jquery-collapse-o-matic_fffeff.svg)
 * [Collapse-O-Matic](https://wordpress.org/plugins/jquery-collapse-o-matic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jquery-collapse-o-matic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jquery-collapse-o-matic/)
 * [Active Topics](https://wordpress.org/support/plugin/jquery-collapse-o-matic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jquery-collapse-o-matic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jquery-collapse-o-matic/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [Baden](https://wordpress.org/support/users/baden03/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-jquery-collapse-o-matic-enqueue-error/#post-2490536)
 * Status: resolved