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 Browns Hooks & Filters Database
- Query_posts
- Important Flow Charts
- WP_Query
- The correct way to use AJAX
- Loading Scripts Correctly in Admin
- Using the WordPress File System API
- A mostly complete guide to the WordPress rewrite API
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.
- Theme Wrappers
- get_template_part()
- WordPress theme function files
- How to load files in WordPress themes
- Modular Themes – Why ( Part 1 )
- Modular Themes – Theme Organisation ( Part 2 )
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.
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
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.
PHP
- PHP’s Source Code For PHP Developers – Part 1 – The Structure
- Understanding PHP’s internal function definitions (PHP’s Source Code for PHP Developers – Part 2)
- PHP’s Source Code for PHP Developers – Part 3 – Variables
- Understanding PHP’s internal array implementation (PHP’s Source Code for PHP Developers – Part 4)
- OOP vs Procedural Code
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.