Knowing that wordpress doesn’t follow MVC pattern.
What is the best way in worpress to output plugin’s result in a certain url.
lets say I would like to show “hello world” in main area under “www.example.com/show-hello-world” url.
thanks. hope question is clear!
more details:
Let’s say url “example.com/show-hello-world”
- how could I specify template name, let’s say “page” ?
There are two steps:
That takes care of rewriting. Remember to flush the rewrite rules.
Now, your plugin can check for
get_query_var( 'show_hello_world' );
and load a certain file:In your header.php, page.php, or index.php, add: