Community Forums › Forums › Archived Forums › General Discussion › functions.php vs template files
Tagged: architecture, functions.php, Fundation, template
- This topic has 1 reply, 2 voices, and was last updated 9 years ago by DTHkelly.
-
AuthorPosts
-
March 29, 2015 at 7:06 am #145993DjonesisMember
Hi guys,
I'm working on my first Genesis project (a bit more info here : http://www.studiopress.community/topic/the-genesis-way-genesis-best-practices/ ).
Question : do you guys do most of your customization for single / page / archive pages with hooks and filter in functions.php, or do you prefer to mostly use template files ?
I haven't seen a lot of template files usage in SP's themes. And when there are some, they are usually few and very short, only re-ordering basic stuff through hooks and displaying widget content.
Being a Genesis noob and coming from a more vanilla WordPress background I find the good old single.php, single-CPT.php, etc.. approach more clear. And so far I feel it allows me more freedom coding my layout exactly as I want it.
On the other hand, I feel this hooks-heavy + light template files approach to be very elegant. I just can't wrap my head around making it as flexible as writing everything I need in that good ol' single.php file... (There's quite a bit of CPTs in this project, needing some specific single-post display, as well as more standard blog-type posts)
What's your approach ?
A bit more context :
On this project, I started from scratch (the child theme was totally empty at start).
I figured out it would be a better way to fully understand how Genesis work by climbing up from nothing. And as I'm using Zurb Foundation to layout the Homepage anyway, I thought I could as well start from scratch rather than try to tweak some existing child theme.But I now find myself with quite a large functions.php file, since besides initialization code (all those "init" actions), meta-cleaning goodness and scripts+css enqueuing, it now contains code to display the nav menus, some utilities functions, a couple specific loops code I use in several parts of the site and the HTML to display them properly (they are displayed on the Home but also as a sidebar widget on inside pages, thus I needed to factor them in).
Now I'm working on the inside pages (single / page / archives) and I struggle to decide if I should bloat even more functions.php with code that will only be called in specific circumstances (single post view, archive view...)
Thanks !
March 29, 2015 at 11:59 am #146015DTHkellyMembersingle-CPT.php - yes! Lots of independent genesis developer tutorials with custom CPT templates.
single.php - no.With (a premium plugin) Genesis Extender, I use custom hook boxes more than functions.php or template files.
http://cobaltapps.com/downloads/genesis-extender-plugin/ -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.