0

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?

3
  • 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?
    – fuxia
    Commented Mar 8, 2013 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
    Commented Mar 8, 2013 at 3:30
  • @toscho Because most templates seem to have them.
    – leeand00
    Commented Mar 8, 2013 at 13:27

2 Answers 2

3

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.

1

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.

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.