Div Starter: Shortcodes

Shortcodes are great, until they get overused and bloat your code with pointless vulnerabilities. “The Div Blend Way” is about finding the right balance to great tools like these. Often shortcodes provide helpful functionality for custom solutions, but very quickly they overstep their bounds. Meaning from within the theme or theme framework you have many develops adding what we refer to as “business logic” but the “WordPress Way” or philosophy is to keep this logic within the plugin’s scope, and instead keep only “visual logic” within the theme structure. For this reason Div Starter is a plugin framework for creating shortcodes within a site plugin.

Create a class that extends DS_Shortcodes

class My_Shortcodes extend DS_Shortcodes {

    public function __construct {
        //filter $shortcodes array
        //or filter existing ds shortcodes
    }

    public static function my_shortcode ($atts) {
        return self::shortcode_wrapper ( array( 'Custom_Class','method'), $atts);
    }

} //end of site app shortcodes

Add an action for your class

add_action('init', array('My_Shortcodes','__construct') );

Include your shortcode class

more details coming soon….