How to redirect template in wp plugin ?
I've developed a plugin, in which from home page user should redirect to upsell page once submit an optin form.
I'm using following function to load home page template:
add_action('template_redirect', 'pluginInit', 5);
function pluginInit()
{
global $post_type;
$post_type = get_query_var('post_type'); //getting the value of post_type(variable key) from global wp_query class
if($post_type == 'sqplugin')
{
if (file_exists(TEMPLATEPATH . '/single-' . $post_type . '.php')) return; //file_exists checks whether a file or dir exists.
load_template(WP_PLUGIN_DIR . '/sqplugin' .'/home-page.php'); //This function is a wp ver. of require()
exit;
}
}
http://localhost/Keithy2/sqplugin/testing/
http://localhost/Keithy2/sqplugin/testing/aff-page.php
Kindly advice, how do i change the template from home page to aff page without changing url.
Url should remain:
http://localhost/Keithy2/sqplugin/testing/
Best Regards
Nuke
Wordpress Theme & Plugin Customization, Php Development & Bug Fixing