0

I was wondering if there is a way to make Wordpress redirect to a certain custom page template, according to some "routing" convention. For instance, I've added a template file called page-docs.php, in my theme folder. I would like this template to be used, if the user goes to this URL, for for example: mysite/page/docs

Then, if i add a template page-about.php, the corresponding URL would be mysite/page/about

I see in the docs that page-$slug.php is part of the template hierarchy, but i don't know how this can be actually used from the URL.

The idea is that i do not want to manually create "pages" in the wp-admin, and then associate them with a template. I would like this to work automatically, according to a convention. Is this possible?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.