[wp-hackers] Mille viae ducunt homines per saecula index.php

Micky Hulse mickyhulse.lists at gmail.com
Wed Apr 17 01:00:43 UTC 2013


Based on this visual overview of the WP template hierarchy:

<http://codex.wordpress.org/Template_Hierarchy#Visual_Overview>

... all roads appear to lead to index.php.

Just curious, but has anyone built a theme, or knows of a free theme
in the wild, that has just one index.php file?

Based on this info:

<http://codex.wordpress.org/Theme_Development#Basic_Templates>

... at a bare minimum, I'd need:

* style.css
* index.php

This got me thinking, couldn't I build a theme, one that accounted for
all of the various pages/views, using one index.php and several
template part includes?

I can envision an index.php template that utilizes a PHP switch
statement to load the needed template parts.

Seems plausible, though, I'd probably need the ability to say things like:

if (is_search_result_page) { ... }
if (is_archive_page) { ... }
if (is_XXXXXXX_page) { ... }

Now, I've definitely been in situations where I've tried to cram too
much into a single template, so I can see why this would not be a good
idea. Just mostly curious to know if others have tried this, and
whether or not they'd recommend giving it a try.

Thanks for listening!

Cheers,
Micky


More information about the wp-hackers mailing list