311 95 8MB
English Pages 295 Year 2009
WordPress 2.7 Complete
Create your own complete blog or website from scratch with WordPress
April Hodge Silver Hasin Hayder
BIRMINGHAM - MUMBAI
WordPress 2.7 Complete
Copyright © 2009 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2009
Production Reference: 2040609
Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847196-56-9 www.packtpub.com
Cover Image by Parag Kadam ([email protected])
Credits Authors April Hodge Silver
Editorial Team Leader Abhijeet Deobhakta
Hasin Hayder Project Team Leader Reviewers
Lata Basantani
Lee Jordan Narayan Bhat Paul Thewlis
Project Coordinator Leena Purkait Indexer
Acquisition Editor
Rekha Nair
David Barnes Proofreader Development Editor
Sandra Hopper
Ved Prakash Jha Production Coordinator Technical Editor
Shantanu Zagade
Reshma Sundaresan Cover Work Copy Editor Sneha Kulkarni
Shantanu Zagade
About the authors April Hodge Silver has been designing and developing new websites from scratch since 1999, just before her graduation from Columbia University. Early in her career, she worked for several web companies and startups, including DoubleClick and About.com. Since 2004, she has been self-employed through her company Springthistle Design and has worked with a staggering variety of companies, non-proits, and individuals to realize their website dreams. In her professional work, April's focus is always on usability, eficiency, lexibility, clean design, and client happiness. WordPress is the best solution for many of Springthistle's clients, though April also develops custom web applications using PHP and MySQL. You can ind out more about April's professional work at http://springthistle.com. In her free time, April enjoys developing recipes in the kitchen, bicycling, and relaxing with her daughter, dog, and darlin' wife. Of course, I am so grateful to everyone at Packt who worked with me to make this book possible. Also, a huge bunch of thanks to my wife Tessa, who made the connection in the irst place and helped me get started in this medium. Finally, thanks go to Ruth and Hazel, who provided guidance on commas.
Hasin Hayder graduated in Civil Engineering from the Rajshahi University of
Engineering and Technology (RUET) in Bangladesh. He is a Zend-certiied Engineer and expert in developing localized applications. He is currently working as a Technical Director in Trippert Labs and managing the local branch in Bangladesh. Beside his full time job, Hasin writes his blog at http://hasin.wordpress.com, writes article in different websites and maintains his open source framework Orchid at http://orchid.phpxperts.net. Hasin lives in Bangladesh with his wife Ayesha and his son, Aif. First of all, I would like to thank David Barnes, Patricia Weir, Abhijeet Deobhakta, and Nikhil Bangera, without whom the book would have never seen the daylight. After writing for so many sleepless nights, the book is inally over; but I want to thank all those who supported me at that time. My wife Ayesha for storytelling, Little Aif for missing his Papa, the staff of Somewhere In for receiving a sleepy developer in the morning, the staff of Pagelakes for their inspiration, and all the members of my PHP group, phpexperts. I would also like to thank all my family members for their great support during this period. Finally, I dedicate this book to the person who would have been the happiest person to see it; my father, Ali Akbar Mohammad Mohiuddin Hayder (1934-2006).
About the reviewers Lee Jordan is a web developer with a large collection of web technology acronyms on her resume that sound like the names of laundry detergents and cause glazed expressions in school children. She designs and maintains internal and external enterprise-level websites and web-based applications as part of a project team for a privately held technical services company. Her work includes proposing, writing, and editing web content and user guides people actually read. She began her career in 1997 as a web designer after graduating from Florida State University with a Bachelor of Fine Arts, where she swears that she missed at least one home football game while in the computer lab. Lee later convinced Seminole Community College to give her a Web Programming degree in 2003 even though her inal project was a Java-based application that actually contained a usable help ile. Web development topics or whatever she can think of at the time are posted on her blog at http://leejordan.net.
Narayan Bhat's current passion is blogging. You can meet him at his site: The Blog Doctor (http://www.blogdoctor.me). He has reviewed Blogger Beyond the Basics and WordPress for Business Bloggers, both by Packt Publishing.
Paul Thewlis has worked as a web communications professional in the public and private sectors. He is currently E-Communications Manager for a multinational transport company headquartered in the UK. He began his web career as a Technical Editor, working on web design books for a well-known publisher. He has extensive experience of many content management systems and blogging platforms. He is an expert in the use of social media within corporate communications and blogs about that subject, as well as WordPress and the Web in general at http://blog.paulthewlis.com. Paul is the author of WordPress For Business Bloggers, also by Packt Publishing
Table of Contents Preface Chapter 1: Introduction to WordPress What is a blog? Common terms Post Categories and tags Comments Permalinks Theme RSS Page What is WordPress? Why choose WordPress? A long time in refining Active in development Large community of contributors Amazingly extendable Detailed feature list Online WordPress resources WordPress news The Codex Theme and plugin directories WordPress.com Summary
1 7 7 8 8 8 8 9 9 9 10 10 10 10 10 11 11 11 12 12 12 13 14 14
Table of Contents
Chapter 2: Getting Started
15
Where to build your WordPress website Building on WordPress.com Installing WordPress manually Preparing the environment Downloading WordPress Uploading the files Installing WordPress
16 17 20 20 21 22 24
Upgrading WordPress from older installations The WP Admin panel Changing the password Changing general blog information Your first post Your first comment Retrieving a lost password Summary
Chapter 3: Blogging Your Heart Out Posting on your blog Adding a simple post Common post options
29 30 34 35 36 38 39 39
41 41 41 45
Categories and tags Adding an image to a post Using the Visual editor versus the HTML editor Drafts, timestamps, and managing posts
Advanced post options
45 48 51 52
54
Excerpt Trackbacks Discussion Custom Fields Password and private protection Post slug
54 55 56 57 58 59
Additional writing options
59
Press This Posting via email
59 61
Discussion on your blog—comments Adding a comment Discussion settings Submission, notification, and moderation settings When to moderate or blacklist a comment Avatar display settings
Moderating comments How to eliminate comment spam
61 62 62 63 64 66
67 69
Getting a WordPress.com API key Activating Akismet
70 70 [ ii ]
Table of Contents
Adding and managing categories Summary
72 73
Chapter 4: Pages, Images, Plugins, and More
75
Pages Adding a page Managing pages Links Adding a new link Managing links and categories Media library Adding an image gallery Choosing a post or page Uploading images Tweaking your gallery Adding plugins Finding your plugin Downloading the plugin Uploading and activating the plugin Configuring and/or implementing—if necessary Auto-installation Summary
75 76 78 79 79 82 83 85 86 86 89 92 92 92 93 95 97 97
Chapter 5: Choosing and Installing Themes
99
Finding themes WordPress Theme Directory Top WP themes Template Monster Finding more themes Factors to consider when choosing a theme Installing and changing themes What makes a theme? Downloading and extracting Uploading the theme Previewing and activating Using widgets Enabling basic widgets Multiple sidebars Adding new widgets Summary
100 100 103 104 105 105 105 106 106 107 109 111 111 115 116 116
[ iii ]
Table of Contents
Chapter 6: Developing Your Own Theme Setting up your design Designing your theme to be WordPress-friendly Converting your design to code Examining the HTML structure Examining the CSS
117 117 118 120 120 123
Converting your build into a theme Creating the theme folder Adding WordPress content The tag The header and footer The sidebar
128 128 133 133 134 136
Main column—the loop Creating templates within your theme Understanding the WordPress theme Breaking it up header.php footer.php sidebar.php Your four template files
138 142 143 143 143 144 145 145
Archive template Single template Page template Other WordPress templates Creating and using a custom template Making your theme widget-friendly Making sure your sidebar is one big