Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This may sound like a stupid question, but...

What are the main parts of a Wordpress template, and which parts are mandatory and which parts are optional?

So far I am aware of:

  • Posts (mandatory)
  • Pages (mandatory)
  • Page Templates (optional)
  • Tags (optional)
  • Categories (optional)
  • Search / Search Results (mandatory)
  • Archives (mandatory)
  • Widgets (optional)

Is there anything else?

share|improve this question
    
You need just the index.php and style.css and maybe a comments.php. Everything else is optional. Why do you think the other parts are required? –  toscho Mar 8 '13 at 2:27
    
This is as small as a theme can be while still being able to present infomation. On the other side of the spectrum there are themes with hundreds of files. –  Wyck Mar 8 '13 at 3:30
    
@toscho Because most templates seem to have them. –  leeand00 Mar 8 '13 at 13:27

2 Answers 2

Indeed, it is as toscho has said. index.php and style.css are the bare minumum.

Developers like to separate things, though, so instead of having one index.php file to rule all, you'll find parts like:

header.php
footer.php
sidebar.php
index.php
style.css
functions.php

and additional templates like ones you mentioned in the question.

This page will show you how its done at the minimum level.

share|improve this answer

If you want to include your theme in the WordPress theme repository it should at least include:

  1. index.php
  2. comments.php
  3. style.css

This list and many other best practices can be found on the Theme Review page in the Codex.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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