Smashing WordPress Themes
Making Wordpress Beautiful
Thord Daniel Hedengren
This edition first published 2011
2011 John Wiley & Sons, Ltd.
Registered office
John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom
Editorial office
John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom
For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com.
The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought.
Trademarks: Wiley and the Wiley Publishing logo are trademarks or registered trademarks of John Wiley and Sons, Inc. and/ or its affiliates in the United States and/or other countries, and may not be used without written permission. iPhone, iPad and iPod are trademarks of Apple Computer, Inc. All other trademarks are the property of their respective owners. Wiley Publishing, Inc. is not associated with any product or vendor mentioned in the book. This book is not endorsed by Apple Computer, Inc.
A catalogue record for this book is available from the British Library.
ISBN 978-0-470-66990-7
Set in Minion Pro 10/12 by Wiley Composition Services
Printed in U.S. by CJK
February 2011
Publishers Acknowledgments
Some of the people who helped bring this book to market include the following:
Editorial and Production
VP Consumer and Technology Publishing Director: Michelle Leete
Associate Director-Book Content Management: Martin Tribe
Associate Publisher: Chris Webb
Publishing Assistant: Ellie Scott
Project Editor: Susan B. Cohen
Copy Editor: Susan B. Cohen
Technical Editor: John ONolan
Editorial Manager: Jodi Jensen
Senior Project Editor: Sara Shlaer
Editorial Assistant: Leslie Saxman
Marketing
Senior Marketing Manager: Louise Breinholt
Marketing Executive: Kate Parrett
Composition Services
Compositor: Indianapolis Composition Services
Proofreader: Susan Hobbs
Indexer: Potomac Indexing, LLC
Smashing WordPress Themes is dedicated to the WordPress community.
Were all playing an important part by making free speech easier online. The more people can express their thoughts, dreams, and ideas, the better for everyone. Open source in general, and WordPress in particular, play an important role in the free speech movement.
Keep up the great work, dear community.
Thord Daniel Hedengren
About the Author
Thord Daniel Hedengren is addicted to words, which led him to launch his first online newsletter in 1996. It all went downhill from there, with dozens of Web sites, and a career as an editor and freelancer in both Sweden and abroad.
His international career began with a blog post, which led to a book deal for Smashing WordPress: Beyond the Blog, with Wiley Publishing, Inc., and an even stronger voice in the WordPress community. Youre now holding Thords second book.
When not obsessed with words, Thord and his friends build cool Web sites using WordPress at his Web design firm, Odd Alice. He also edits magazines and writes freelance articles for both print and Web publications (in Swedish and English). You can follow everything Thord on http://tdh.me
.
Thord lives in the land of kings, Sweden.
Introduction
Smashing WordPress Themes is all about making your WordPress site look beautiful. But, the beautiful part is a very personal thing, because we all have different preferences. So in essence, my book isnt on Web design, but rather about giving you, dear reader, the tools to build the kind of site that you want to create, using WordPress elements.
A theme is the skin of your WordPress content, your site template so to speak. A huge community of people design and use themes, offering many high-quality designs. With this book, you can now contribute to that community.
As with my previous book, Smashing WordPress: Beyond the Blog, this book mainly targets those of you who know a bit about Web development already. If you know some HTML, PHP, CSS, or have fiddled around a bit with WordPress, then this book is for you. If that sounds like Greek to you (or any other language you may not understand), then you should read up a bit before you tackle this. But because even more experienced Web developers need a quick recap at times, you all may find this book a welcome reminder of existing features.
As I write this book, WordPress has reached version 3.0.1, and is rocking the publishing world. Some of the code in this book is based on themes that are available online, but since the Web is an ever-changing entity, the online code may be somewhat different from the examples that you see in this book. Just keep that in mind if things suddenly dont seem to add up.
You can download the example code files from the companion Web site for this book at www.wiley.com/go/smashingwordpressthemes.
Before I wrap this up and let you get started with WordPress theming, here are a few links that you may find interesting.
Code snippets for this book are available at my Web site at http://tdh.me
. Go to Smashing WordPress Themes under Books. (The companion Web site for this book at www.wiley.com/go/smashingwordpressthemes
also contains all the code.)
Everything Notes related, including themes, plugins, code examples, and so on is available at http://notesblog.com
.
The official WordPress manual, The WordPress Codex, is at http://codex.wordpress.org
.
You can also become a fan on my Facebook business Page at http://facebook.com/tdhftw
and follow @tdhedengren on Twitter for the latest from yours truly.
Right! So lets build some cool themes! Welcome to Smashing WordPress Themes: Making WordPress Beautiful . I hope youll enjoy the ride. To properly convey this information, this book is divided into four parts.
Part 1: What Are WordPress Themes?
WordPress themes are what make your Web site look good and function well. They are the visual skin, the look and design of your site, what your visitors will see. On the outside, your WordPress site looks and behaves like any other Web site, basically just working better and looking more gorgeous, hopefully.