0

I am creating a theme and was thinking if it would be possible to create pages within my theme folder that would reflect the wordpress url + path.

So for example I could when accessing: http://mydomain.com/about

it would looks for about.php or about.html inside my theme folder?

I have obtained success doing this but handling the is_404 method and then rendering the page with get_template_part($pathname), however, every page will output the 404 response status which is not viable?

Is there any other way to accomplish that? I wish there was some kind of url aliases I could grant for my theme and could use it.

Thanks in advance

1

WordPress would allow this (sort of). You would still need to create an About page in the back end, but you can tailor your display for such a page 2 different ways:

  1. Page Templates

  2. Page template hierarchy - What this means is there is a certain order of what WordPress is looking for when displaying any page/post. Check out the image here for a more direct understanding.

For pages specifically, the default is page.php, but page-$slug.php has higher priority. So in this case, you could make page-about.php, and alter what is displayed on that page. I would strongly suggest keeping the main content within that page, but this is how you add additional items to a page structure, such as sidebars, "Related Items" links, etc.

  • 1
    Good point Eric,it is a shame the user still has to create this page which is a manual process. But I guess this is way more sophisticated than handling 404 pages. Thanks for your help. – zanona Jun 13 '13 at 14:03
  • There is only so much customization that any framework can account for, without a little development knowledge on the user side. :) – Eric Holmes Jun 13 '13 at 14:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.