Wednesday, February 15, 2012

Skellie after a sprint


The last 2 weeks I got to use Skellie in action, in order to build a new wordpress project from scratch.

The results are encouraging.
The code seems cleaner and readable and partials are easily reusable.
The main layout file is just so clear:


During development I came accross two dark corners of wordpress, namely the search and comment forms.

Search form
By default wordpress prints the same id in the search form which ends up in invalid html if you need 2 instances of it (e.g. repeating the search form within the search results page). The solution was to ignore the search form and come up with a new partial in partials/search-form.php


Comment form
The comment form was less of a hassle. Hiding the tips and title was enough to get going.
Using 2 partials to loop through the comments and print them finishes up the story.

Future development:
Some things that could be changed also became apparent during the building process.
I was thinking about the possibility of having the partial methods return the render result as a string instead of directly printing it like wordpress used to.
It makes sense. It allows for more flexibility and adjustment of output. You can cache it, alter it (if you have to), decorate it or just print it.
Also with the 5.4 short tag re-entering the game the overhead of manually printing will be minimal.
Get_template_part of wordpress used to directly print but get_template_part sucked anyway.

No comments:

Post a Comment