• Resolved RiseOfLex88

    (@riseoflex88)


    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’;

    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://www.ads-software.com/plugins/unyson/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Unyson

    (@unyson)

    Remove trailing slashes

    $locations[plugin_dir_path(__FILE__) . 'framework-customizations/extensions'] = plugins_url( 'extensions', __FILE__ ) . '/framework-customizations/extensions';

    Thread Starter RiseOfLex88

    (@riseoflex88)

    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

    (@unyson)

    Sorry, at the moment it will not work. I created an issue https://github.com/ThemeFuse/Unyson/issues/382
    The fix will be available in the next version.

    Plugin Author Unyson

    (@unyson)

    Please download and install the latest dev version of Unyson, it should work now.

    Thread Starter RiseOfLex88

    (@riseoflex88)

    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

    (@unyson)

    extensions/framework-customizations/extensions has no sense, just extensions will work, or any other directory name, it doesn’t matter.

    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

    (@unyson)

    @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.