Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #479540

    Hi,

    A bug in the file config-templatebuilder/config.php line 11 add_shortcode_folder($paths) makes it impossible to add a custom folder.

    function add_shortcode_folder($paths)
    {
    	$paths = array(dirname(__FILE__) ."/avia-shortcodes/");
    	return $paths;
    }

    should be

    function add_shortcode_folder($paths)
    {
    	$paths[] = dirname(__FILE__) ."/avia-shortcodes/";
    	return $paths;
    }

    Otherwise every custom added folder added by “add_filter(‘avia_load_shortcodes’,’add_shortcode_folder’);” to the $paths variable is overridden instantly.

    Best,
    Markus

    • This topic was modified 9 years, 4 months ago by markusperl.
    #479549

    Hi!

    Can you paste the complete avia_load_shortcodes code you’re trying to use? it should be something like this (child theme environment):

    add_filter('avia_load_shortcodes', function($paths) {
    	$template_url = get_stylesheet_directory();
        array_unshift($paths, $template_url.'/shortcodes/');
    	return $paths;
    }, 15, 1);

    Cheers!
    Josue

    #479556

    My first try was:

    //set the folder that contains the shortcodes
    function myplugin_add_shortcode_folder($paths)
    {
       $paths = array(dirname(__FILE__) ."/avia-shortcodes/");
        return $paths;
    }
    
    add_filter('avia_load_shortcodes', 'myplugin_add_shortcode_folder');

    I ended up with:

    //set the folder that contains the shortcodes
    function myplugin_add_shortcode_folder($paths)
    {
        $paths[] = dirname(__FILE__) . "/avia-shortcodes/";
        return $paths;
    }
    
    add_filter('avia_load_shortcodes', 'myplugin_add_shortcode_folder');

    But thx for the workaround with a lower prio, that should also do the trick.

    • This reply was modified 9 years, 4 months ago by markusperl.
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Bug in config.php makes it impossible to add a custom shortcode folder’ is closed to new replies.