About Wordpress theme architecture: one index.php vs. multiple template files -
just quick questions wordpress wizards out there regarding wordpress theme architecture: what’s better in terms of performance, syntax, maintenance, etc.?
version a:
one index.php
includes external parts (different loops , other structural) elements depending on if is_page
, is_archive
, is_single
, is_tax
, etc.
or
version b:
separate files index.php
, pages.php
, single.php
, archive.php
, etc.
version b going better performance, organizational standpoint.
take @ way template files called generate wordpress page based on wordpress template hierarchy. straight the codex on template hierarchy.
as can see, index.php last template looked during request.
also, , perhaps more subjective, breaking templates individual files makes things easier maintain, don't have 1 huge file conditional statements. each template single thing, , thing well.
edit: well, hoping you'd able see image...but here's original codex: http://codex.wordpress.org/images/9/96/wp-template-hierarchy.jpg
Comments
Post a Comment