Title: Using a plugin for new shortcodes
Last modified: August 22, 2016

---

# Using a plugin for new shortcodes

 *  Resolved [RiseOfLex88](https://wordpress.org/support/users/riseoflex88/)
 * (@riseoflex88)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/)
 * Looking in the changelog you mentioned that it’s now possible to have extensions
   loaded anywhere, including a plugin… however, I’m struggling to get this right.
 * Your example…
    $locations[‘/path/to/plugin/extensions’] = ‘[https://uri.to/plugin/extensions&#8217](https://uri.to/plugin/extensions&#8217);;
 * My code…
    $locations[plugin_dir_path(__FILE__) . ‘framework-customizations/extensions/’]
   = plugins_url( ‘extensions’, __FILE__ ) . ‘/framework-customizations/extensions/’;
 * Do you have a basic working example ( i.e. using the wp function for a dynamic
   domain ) of how this can be used inside a plugin?
 * [https://wordpress.org/plugins/unyson/](https://wordpress.org/plugins/unyson/)

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

 *  Plugin Author [Unyson](https://wordpress.org/support/users/unyson/)
 * (@unyson)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5912748)
 * Remove trailing slashes
 * `$locations[plugin_dir_path(__FILE__) . 'framework-customizations/extensions']
   = plugins_url( 'extensions', __FILE__ ) . '/framework-customizations/extensions';`
 *  Thread Starter [RiseOfLex88](https://wordpress.org/support/users/riseoflex88/)
 * (@riseoflex88)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5912892)
 * Thanks for getting back to me, I guess I missed that as a basic point.
    Unfortunately
   that’s not the fix. The full filter code is like so…
 *     ```
       function filter_miracx_extensions($locations) { 
   
       $locations[plugin_dir_path(__FILE__) . 'extensions'] = plugins_url( 'extensions', __FILE__ );	
   
       return $locations;
       }
       add_filter('fw_extensions_locations', 'filter_miracx_extensions', 12);
       ```
   
 * I’m really not sure which bit is broken now. An example of where one of the actual
   shortcodes reside in the plugin…
    `plugins/unyson-integration/extensions/framework-
   customizations/extensions/shortcodes/shortcodes/icon-box/config.php`
 * I’ve tried pretty much every variation of targeting of the paths e.g.
 *     ```
       'extensions'
       'extensions/framework-customizations'
       'extensions/framework-customizations/extensions'
       'extensions/framework-customizations/extensions/shortcodes' etc etc
       ```
   
 * I’ve also tried pulling shortcodes into some of the higher level folders or targeting
   a specific shortcode folder directly and still have had no luck.
 *  Plugin Author [Unyson](https://wordpress.org/support/users/unyson/)
 * (@unyson)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5912894)
 * Sorry, at the moment it will not work. I created an issue [https://github.com/ThemeFuse/Unyson/issues/382](https://github.com/ThemeFuse/Unyson/issues/382)
   
   The fix will be available in the next version.
 *  Plugin Author [Unyson](https://wordpress.org/support/users/unyson/)
 * (@unyson)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5912903)
 * Please [download](https://github.com/ThemeFuse/Unyson/archive/master.zip) and
   install the latest dev version of Unyson, it should work now.
 *  Thread Starter [RiseOfLex88](https://wordpress.org/support/users/riseoflex88/)
 * (@riseoflex88)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5912960)
 * Ok great, that’s working for me now. Thanks so much …
 * For anyone else, this is the code I’ve used…
 *     ```
       function filter_miracx_extensions($locations) {
       	$locations[plugin_dir_path(__FILE__) . 'extensions/framework-customizations/extensions'] = plugins_url( 'extensions/framework-customizations/extensions', __FILE__ );
       	return $locations;
       }
       add_filter('fw_extensions_locations', 'filter_miracx_extensions', 12);
       ```
   
 * I’m not really sure if the folder structure is correct but this has evolved from
   a pretty early setup. The second ‘extensions’ folder contains the shortcodes.
 * Cheers guys
 *  Plugin Author [Unyson](https://wordpress.org/support/users/unyson/)
 * (@unyson)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5912961)
 * `extensions/framework-customizations/extensions` has no sense, just `extensions`
   will work, or any other directory name, it doesn’t matter.
 *  [saddamrajif](https://wordpress.org/support/users/saddamrajif/)
 * (@saddamrajif)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5913060)
 * I have the same issue with this topic,
    but i have some trouble with add_filter(‘
   fw_extensions_locations’, … code
 * if i add this into my main plugin file, wordpress just show empty white screen,
   what should i do for resolve this ?, thanks before.
 *  Plugin Author [Unyson](https://wordpress.org/support/users/unyson/)
 * (@unyson)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5913061)
 * [@saddamrajif](https://wordpress.org/support/users/saddamrajif/) Check apache`
   error.log`

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

The topic ‘Using a plugin for new shortcodes’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/unyson_4e6064.svg)
 * [Unyson](https://wordpress.org/plugins/unyson/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/unyson/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/unyson/)
 * [Active Topics](https://wordpress.org/support/plugin/unyson/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/unyson/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/unyson/reviews/)

## Tags

 * [plugin-development](https://wordpress.org/support/topic-tag/plugin-development/)

 * 8 replies
 * 3 participants
 * Last reply from: [Unyson](https://wordpress.org/support/users/unyson/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/using-a-plugin-for-new-shortcodes/#post-5913061)
 * Status: resolved