Review: Smashing WordPress 2nd Edition

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.

Localization

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'); ?>

Anatomy of a WordPress Plugin

  • You can remove actions and filters with remove_action() and remove_filter(). These can be used for third-party hooks ore core hooks.
  • You can use pluggable functions to overwrite core functionality, but do so with caution.
  • Store small amounts of plugin data and theme options data in wp_options. Don't store too much data there; put larger amounts in its own table.
  • Plugins should include an uninstall.php that uses delete_option() to clean up the database.

Plugins or functions.php?

For minor changes, use template files. For functionality unique to the theme, use functions.php. For all else, use plugins.

WordPress security

  • Remove add_action('wp_head', 'wp_generator'); from header.php.
  • Use an editor account to post.
  • Force SSL encryption on the WordPress admin login page.

Plugins

Content

Yet Another Related Posts Plugin

Media

Administrative

Comment management

Social networking

Subscription

Align RSS Images

Code and output

Filed Under: 

Want tips to rocket-boost your website?

Simply sign up.

Leave a Reply

Your email address will not be published. Required fields are marked *

Ready to Blast Off?

Let's talk.

Contact OptimWise
crossmenuarrow-right