Hey Guys, I've developed a plugin, in which from home page user should redirect to upsell page once submit an optin form.
How to redirect template in wp plugin ?
3
Hey Guys,
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:
This is url for home page:
On Placing aff-page.php in action of optin form, url changes to:
aff-page.php appearing in url, and template doesn't load with backend plugin values.
Kindly advice, how do i change the template from home page to aff page without changing url.
Url should remain: Thanks in Advance
Best Regards
Nuke
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:
PHP Code:
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;
}
}
PHP Code:
http://localhost/Keithy2/sqplugin/testing/
PHP Code:
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:
PHP Code:
http://localhost/Keithy2/sqplugin/testing/
Best Regards
Nuke
- driveyourtech
- [1] reply
- Nuke07
Next Topics on Trending Feed
-
3