Sharing my thoughts on naming actions and filters, I make a (probably futile) attempt to get developers to create better, more extensible WordPress products. One the one hand hooks should be descriptive, and on the other hand they should be structured and consistent. Can these properties go hand in hand? It’s time for a standardised way of naming actions and filters in WordPress.
The WordPress Twenty Twelve and Twenty Thirteen themes use identical ways to display entries inside the loop. Instead of calling
the_content directly from among others index.php and single.php, they include a file for displaying the entry based on the post format using get_template_part combined with get_post_format.
Using this method, the themes handle the displaying of post entries via a single file (in this case, one file per post format), allowing the developer to easily change the outputted content for entries: instead of changing index.php, single.php, archive.php and all other files where a post entry is outputted, the developer can just change the appropriate template part file for the post format and alter the output on all pages where the template part is used.
So that’s one type of recurring content, and one way to handle it…
Reading the blog of WordPress developer Tom McFarlin, I came across a rather interesting post about the proper way of instantiating WordPress plugins. Though interesting, the article itself is quite short and covers only one or two methods of instantiating a plugin — it’s there comments section where things get really interesting. Continue reading
Much has been written already about the WordPress template hierarchy. It’s an important part of WordPress, and understanding it is of vital importance to build proper themes. There’s a Codex entry devoted to it, Wptuts+ has created a cheat sheet for it and many, many articles have been written about its basics.
But, as is the case with many other WordPress topics, an at first sight promising list of results for a search query on the subject turns out to be a list of articles and tutorials that pretty much contain exactly what’s already in the Codex, but in a more readable format. What should be a list of interesting topics about the WordPress template hierarchy, its roots and why it is as it is, is actually the same article over and over again. Continue reading