I’d like to make a landing page. If plugin detects some GET or POST requests it should override wordpress theme and show its own.
It would work somehow like that:
if (isset($_GET['action']) && $_GET['action'] == 'myPluginAction'){
/* do something to maintain action */
/* forbid template to display and show plugin's landing page*/
}
I’m familiar with WP Codex, but I don’t remember if there is any function to do that. Of course, I googled it with no results.
Thanks for any ideas in advance.
You need the hook
template_include
. It doesn’t seem documented in the Codex, but you can find more examples here in SO or in WordPress StackExchangePlugin file
Custom Template in Plugin folder
Result
Visiting any url of the site with
?mod=yes
will render the plugin template file, e.g.:http://example.com/hello-world/?mod=yes
.for reference template override using plugin