Page templates: best practice and approach
-
I couldnt find much debate on this on Google, but meanwhile building a new theme for a project, I suddenly became unsure of best approach to build specific page templates.
Say I need specific templates for certain pages, I see 3 main approaches:- Create a template by comment name and choose the template in the page dashboard
- Create a specific template by filename: slug or id, example ‘page-mypage.php’
- Have page.php as main template for all sites and then use specific get_template_part by looking at what page is currently in loop
Or a third way I was thinking of:
The third way would give some consistency by making sure that get header, footer, sidebar etc is done the same. Any thoughts?
- The topic ‘Page templates: best practice and approach’ is closed to new replies.