Title: Load plugin files only when needed
Last modified: September 3, 2016

---

# Load plugin files only when needed

 *  [wekhter](https://wordpress.org/support/users/wekhter/)
 * (@wekhter)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/load-plugin-files-only-when-needed/)
 * I have been looking for an accordion menu solution for a custom post type archive
   with a lot of terms, and really like the way your plugin functions, esp since
   I can choose to use a pre-existing menu OR generate one from a taxonomy/category
 * But, when testing out the plugin I saw that the menu’s css/javascript are loaded
   on every page of the site. Can the plugin be updated such that the included scripts
   are only loaded when the shortcode is present?
 * Also, although I like the included style, it would be nice if there was a minimal
   style option available that more respected the active theme… something like:
 *     ```
       .wpb_category_n_menu_accordion ul li > a > span.wpb-submenu-indicator {
         float: right;
         font-weight: bolder;
         -o-transition: transform .3s linear;
         -moz-transition: transform .3s linear;
         -webkit-transition: transform .3s linear;
         -ms-transition: transform .3s linear;
       }
       .wpb_category_n_menu_accordion li.wpb-submenu-indicator-minus > a > span.wpb-submenu-indicator {
         -ms-transform: rotate(45deg);
         -moz-transform: rotate(45deg);
         -webkit-transform: rotate(45deg);
         transform: rotate(45deg);
       }
   
       /* Cat Count */
   
       .wpb_category_n_menu_accordion ul li .wpb-wmca-cat-count:before {
         content:" (";
       }
       .wpb_category_n_menu_accordion ul li .wpb-wmca-cat-count:after {
         content:")";
       }
       ```
   

The topic ‘Load plugin files only when needed’ is closed to new replies.

 * ![](https://ps.w.org/wpb-accordion-menu-or-category/assets/icon-256x256.gif?rev
   =2899475)
 * [WPB Accordion Menu - Collapsible Vertical Sidebar Menu - WooCommerce Category Accordion](https://wordpress.org/plugins/wpb-accordion-menu-or-category/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpb-accordion-menu-or-category/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpb-accordion-menu-or-category/)
 * [Active Topics](https://wordpress.org/support/plugin/wpb-accordion-menu-or-category/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpb-accordion-menu-or-category/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpb-accordion-menu-or-category/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [wekhter](https://wordpress.org/support/users/wekhter/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/load-plugin-files-only-when-needed/)
 * Status: not resolved