Smashing WordPress: Beyond the Blog by Thord Daniel Hedengren
My rating: 3 of 5 stars
This book is mostly a how-to guide for creating WordPress themes and plugins, and generally bending WordPress to your will.
The book is laid out well, with colored blocks of code interspersed with the text describing it. It could have used more screenshots and diagrams to demonstrate what the code snippets were doing.
I read the first edition in 2010, then read the second (2011) edition in 2013. By that time the second edition was somewhat dated, but still contained some good info. Below are my notes.
Wrap code in __()
within PHP code, and in _e()
pretty much anywhere. __()
is a return statement, and _e()
is an echo statement. To use these, pass the text/code first, then the textdomain. For example, where notesblog
is the textdomain, use
<?php _e('This text can be localized, mate!', 'notesblog'); ?>
remove_action()
and remove_filter()
. These can be used for third-party hooks ore core hooks.wp_options
. Don't store too much data there; put larger amounts in its own table.delete_option()
to clean up the database.For minor changes, use template files. For functionality unique to the theme, use functions.php. For all else, use plugins.
add_action('wp_head', 'wp_generator');
from header.php.Yet Another Related Posts Plugin