I am creating a plugin for wordpress themes that loads the templates in its own directory rather than placing templates in the theme that makes me independent to include templates in themes, for that I have created shortcodes to load the different templates on conditions. below is the code:
add_shortcode('template', 'add_template');
function add_template( $atts) {
extract( shortcode_atts( array( 'template' => ''
), $atts ) );switch ($template) {
case 'template1': include 'templates/template1.php'; break; case 'template2': include 'templates/template2.php'; break; default: include 'templates/template1.php'; break; } }
My problem is in some themes my plugin start to display the page within the admin panel is there anything I am doing wrong? please help....