0

I'm putting together a site that will be comprised, mostly, of static pages with some dynamic content as well as a blog page.

In terms of naming files, what would be the best way to achieve this? My first thought was to simply use about.php, services.php, etc., but I'm sure that doesn't work well with WP's system.

2 Answers 2

0

More information about your specific plans might help improve answers you'll get on this thread.

But in general RE: conflicting file names: if you install WordPress in a subdirectory (for example, "/blog/"), it doesn't matter what you name the rest of your files so long as they're not in the WP dir. This is what 'd recommend, based on the limited info in your question.

If you're expecting your "dynamic content" to be powered by WordPress, you might want to consider just powering the whole site with WP, instead of trying to mix static files with WP core files in the same directory. It's a lot cleaner, and puts the management of all your pages under one roof.

2
  • thank you for your help. I had planned to upload everything to WP by way of a theme. My question lies in naming the files. I know WP won't like having something like services.php(or would it?), so what would be my options for naming that file? Jun 18, 2012 at 23:28
  • If you're talking about putting "static" files in the theme directory, check out the "template hierarchy" for an idea of filenames that are reserved by WordPress in this context: codex.wordpress.org/Template_Hierarchy Any file name that doesn't fit into this hierarchy should be fine as a "custom" filename. I'm just confused as to why you'd want "static" files in there. They'd have to be accessed like: example.com/wp-content/themes/your-theme/services.php, which seems like an ugly URI for a static page. Or are you INCLUDING these "static" files from somewhere else?
    – MathSmath
    Jun 19, 2012 at 16:37
0

For custom page templates, I would use page_about.php or page_services.php.

Make sure you add the following after the opening PHP tag:

/*
Template Name: About Page 
*/

Custom page templates can be uploaded to your themes root directory or a sub folder named page-templates.

If creating a page template for a specific page, use the following:

page-{slug}.php
page-{ID}.php

Upload page templates to your themes root directory

As indicated, use hyphens for specific pages like page-007.php which is only used once and underscores for custom page templates like page_landing.php which can be re-used on multiple pages.

3
  • You should use hyphens, not underscores. :-) Feb 14, 2015 at 11:06
  • @goose Depends on what the page is for. Feb 14, 2015 at 11:12
  • I'd emphasise the fact that custom page templates can be applied to any/multiple pages via the Page Attributes meta box, while the specialized/specific page templates will only be applied to the page with the matching slug and don't show up in the Page Attributes box. Given the names of the OP's pages it suggests that they should go with the second option (i.e they needn't worry about the 'Template Name' bit)
    – Dre
    Feb 14, 2015 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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