0

I have number of legal documents of different formats / layout that I need to display on a Wordpress site, however I don't want to have them as individual page-pagename.php files in the root of the project folder. I know I can use get_template_part() and load in different template files, but this won't really help me because the files are all of differing styles.

Is there any way of storing pages in a subfolder called, say, legal, and then pulling in files from this folder as fully complete pages when people click on the appropriate links on the site, otherwise the root folder for the site is just going to be cluttered mess with endless individual page-pagename.php files.

Many thanks

0

You can certainly use Page Templates for that. They're a specific type of template file that can be applied to a specific page or groups of pages. Plus, they can be stored in sub folders.

All you need is to put something like this at the top of the template files:

/**
 * Template Name: Legal Page
 */

After that, you can choose the "Legal Page" template when editing a page in the admin.

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.