How to load a new template page according to a particular URL?

I want to load some of the pages(not wordpress page, a template file other than wordpress’s default template file) according to the url came on the address bar.

for instance, I have page in my template file ie my_account.php to show my profile pic and other informations from to my wordpress pofile. and it is placed in my defaut theme folder

Read More
/themes/mytheme/my_account.php

When the url is http://mysite/MyAccount/ then I need to load the above page.
Something like if http://mysite/register/ then load the register.php from my theme folder.

I’m using custome permalinks option. http://mysite/hello_world_post/

So How can I configure and load the template according to the url, how to controll this by using a plugin.

Related posts

Leave a Reply

2 comments

  1. You should be able to use template_redirect. I haven’t tested it though, should be something like this.

    function page_redirect() {
        if ($_SERVER['REQUEST_URI'] == 'your_url')  {
    
            require(TEMPLATEPATH . '/mY-account.php');
    
        }
    }
    add_action('template_redirect', 'page_redirect');