WordPress: Necessary Reading

WordPress APIs

In brief, WordPress hooks enable you to change how WordPress behaves without editing any core files. Because you leave the WordPress files untouched, you can painlessly upgrade your blog with each new version of WordPress. It’s this hooks architecture that makes WordPress the best blogging solution.

- Adam Brown

Best Practices

Templating

When you edit theme content, you shouldn’t have to copy your structure; when you edit theme structure, you shouldn’t have to edit ten files.

- Daryl Kooper

Data Structures

Post types are your forms of content. Taxonomies are the glue that holds that content together, linking it in all kinds of neat ways.

- Justin Tadlock

Optimisation

So, what did I gain from these “optimizations”, apart from unreadable code? Nothing. Even now, when this site attracts approximately fourty million pageviews every month (at the time I wrote this code it was faaar less), even now this micro-optimization won’t make any difference. Simply because it is not the bottleneck of the application. The actual bottleneck is a tripple JOIN in the most-frequently accessed controller (the bottleneck of your application probably is similar).

Queries

Before we get to the theme, we have your posts. Got it?

Then why do we do this?

query_posts('author=5');
get_header();
while(have_posts()):
    the_post();
endwhile;
get_footer();

That’s running 2* queries!

One, the query WordPress thought we wanted.

Two, this new one you’re actually going to use

- Andrew Nacin

Security

timthumb.php is inherently insecure because it relies on being able to write files into a directory that is accessible by people visiting your website. That’s never a good idea.

- Mark Maunder

PHP

 Carousels & Sliders

Only one is ever on the screen at a time – at which point it has hierarchical dominance on the page. Meanwhile the rest of the slider items are hidden completely, and thus have zero prominence on the page. The items take turns being visible every few seconds, and their place in the information hierarchy shifts accordingly. So what our design is saying about slider content is:

  • When a slider item is active, it’s more important than everything else on the page.
  • When a slider item is inactive, it’s completely unimportant.

The problem is that I can’t think of a content scenario when this should be the case. The importance of these items is either all or none, depending on when someone looks at the screen, when they decide to scroll, etc. As an information designer, I find this unsettling.

- Matt Griffin