I've done a bit of googling, searching on forums, etc, and can't find a good answer.
Here is what I'm doing:
I need to pass a variable in the url to the page and have a rewrite to make it pretty. So, "mysite.com/ninny/hello-world"
is really "mysite.com/ninny.php?c=hello-world"
. This is currently in action on a non-wordpress site using .htaccess
rewrites and php.
I'm trying to create a plugin to do this. Have a file with all the code that is in the "ninny.php"
file in the plugin and have it appear on the front-end, like a page, with get_header(),
and other functions working, to visitors when they visit mysite.com/ninny
or "mysite.com/ninny/hello-world"
. A plugin is ideal, although a page template could suffice.
The issue I'm having is that if you rewrite the url for a page that is in the plugin it doesn't load all the Wordpress functions - so you wind up with all kind of fun errors. I don't want to call wp-load within the site like that.
What can I do so that the plugin is creating a "page" (not a real entry-in-the-database page), that doesn't go around wordpress like mine currently does.
Is there any way to do a rewrite and have it loading the wordpress functions? Where should I be looking here?
Thank you in advance for anything that points me in the right direction. If this all doesn't make any sense, feel free to ask questions.