The first problem you didn’t even mention is: you are putting shortcodes into a theme. Shortcodes are pure plugin territory, because they are changing post content and must survive a theme switch.
Once you fixed that and moved the shortcodes to a plugin named inferno_shortcodes
, the rest is easy:
In your plugin ask for theme support:
$default_templates = array(
'stacked' => 'stacked.php',
'one_half' => 'one_half.php',
'one_half_last' => 'one_half_last.php',
);
$theme_templates = (array) get_theme_support( 'inferno_shortcodes' );
$templates = array();
foreach ( $default_templates as $shortcode => $file )
{
if ( isset ( $theme_templates[ $shortcode ] ) )
$templates[ $shortcode ] = locate_template( $theme_templates[ $shortcode ] );
else
$templates[ $shortcode ] = plugin_dir_path( __FILE__ ) . "templates/$file";
}
Now any theme can provide templates for all or some shortcodes with …
add_theme_support(
'inferno_shortcodes',
array (
'stacked' => 'inferno-shortcodes/stacked.php',
'one_half' => 'inferno-shortcodes/one_half.php',
'one_half_last' => 'inferno-shortcodes/one_half_last.php',
)
);
… and in your plugin you just include the template to render the output.