0

Im trying to create a Theme from scratch, its quite challenging, cause im new to WP. I follow this developing process at Teamtreehouse. All is very good, its just, im puzzled with the template file creation.

Its all fine with front-page.php and home.php files, but eventually I want to have as well the: partnership.php, gallery.php, contact_us.php, prices.php files too.

Anyhow, when I created the partnership.php file and linked it to display the Partnership webpage title with testimonials and link to the webpage, I got default index.php to display. I understand that WP will display the index.php if it does not find any other file in the structure, but the files are all in the example.com/wp-content/themes directory. Im working on localhost.

It seems that WP did not recognize the custom template files.

Share your thoughts on this please.

Many Thanks

2
  • have you read the Template Hierarchy codex page?
    – Milo
    Commented Jun 20, 2013 at 7:07
  • Yes Milo thanks, it is a bit confusing though. I thought I should ask the question here for that, that someone could explain the process in Capital letters :) sorry, as I mentioned im very new to this. Cheers Commented Jun 20, 2013 at 7:14

1 Answer 1

1

If you want to use custom page templates, yo have to:

  1. Create file for your template.
  2. On beginning of your file add comment defining that this file is custom template file (/* Template Name: One column, no sidebar */).
  3. Manually set that chosen page should use this custom template.

Of course you can also create custom templates for taxonomies, categories, and so on.

Here you can find great image showing how exactly the template to display is chosen by WordPress: http://codex.wordpress.org/Template_Hierarchy

2
  • Thank you Krzysiek Dróżdż, I will have a look at your approach later tonight after work. Cheers Commented Jun 20, 2013 at 7:17
  • Hi Krzysiek Dróżdż, i did set up the page manually to use the that template, still nothing, will try to sort out. Thanks. Commented Jun 21, 2013 at 10:46

Your Answer

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

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