WordPress 3 Complete 1849514100, 9781849514101

Create your own complete website or blog from scratch with WordPress Learn everything you need for creating your own fea

400 21 33MB

English Pages 326 Year 2011

Report DMCA / Copyright


Polecaj historie

WordPress 3 Complete
 1849514100, 9781849514101

Citation preview

WordPress 3 Complete Copyright © 2011 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(s), nor Packt Publishing, and its dealers and 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 of 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: January 2010

Production Reference: 1180111

Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-849514-10-1 www.packtpub.com

Cover Image by Charwak A ([email protected])

Table of Contents Preface Chapter 1: Introduction to WordPress What is WordPress? Use it for a blog or a website Blog: Definition and common terms Common terms

1 7

7 8 8


Why choose WordPress? A long time in refining Active in development Large community of contributors Amazingly extendable Detailed feature list New feature list since 2.7

10 10 10 10 10 11 11

Online WordPress resources WordPress news The Codex Support from other users Theme and plugin directories WordPress.com Summary

13 13 14 15 15 15 16

Learning more

Chapter 2: Getting Started

Where to build your WordPress website Using WordPress.com Installing WordPress manually

Preparing the environment Downloading WordPress Upgrading from an earlier version of WordPress Uploading the files



17 19 22

22 23 24 25

Table of Contents Installing WordPress Learning more

27 32

The WP Admin panel Changing general blog information Your first post Your first comment Retrieving a lost password Summary

Chapter 3: Creating Blog Content WP Admin conventions Lists of items Posting on your blog Adding a simple post Common post options

Categories and tags Images in your posts Using the Visual editor versus the HTML editor Drafts, timestamps, and managing posts

32 35 36 39 41 41


43 43 45 45 48

49 51 57 58

Advanced post options


Additional writing options


Excerpt and the MORE tag Trackbacks Discussion Custom Fields Protecting content Pretty permalinks

60 61 62 63 64 65

Press This Posting via e-mail

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

66 67

68 68 70

70 72 73

Moderating comments How to eliminate comment spam

74 76

Adding and managing categories Summary

80 81

Getting a WordPress.com API key Activating Akismet

77 78

Chapter 4: Pages, Plugins, Image Galleries Menus, and More Pages Adding a page Managing pages

[ ii ]


83 84 88

Table of Contents

Menus Adding a Menu Displaying a Menu Widgets Links Adding a new link Displaying links Managing links and categories Media library Adding plugins Finding your plugin Installing and activating the plugin

88 89 92 93 94 96 97 99 100 102 103 103

Configuring and/or implementing—if necessary Adding an image gallery Choosing a post or page Uploading images Using a lightbox plugin Making your website mobile-friendly Summary

107 108 109 110 114 116 118

Auto-installation Download, (unzip?), upload

104 105

Chapter 5: Choosing and Installing Themes


Chapter 6: Developing Your Own Theme


Finding themes WordPress Theme Directory Finding more themes Some theme basics What makes a theme? Factors to consider when choosing a theme Installing and changing themes Adding a theme within the WP Admin Downloading, extracting, uploading Summary

Setting up your design Designing your theme to be WordPress-friendly Converting your design to code Examining the HTML structure Examining the CSS

Converting your build into a theme Creating the theme folder [ iii ]

120 120 123 123 124 124 125 125 129 131 134 134 136

137 140

146 146

Table of Contents

Adding WordPress content


The tag The header and footer The sidebar

151 152 155

Main column—the loop Creating templates within your theme Understanding the WordPress theme Breaking it up

157 162 162 163

Archive template Single template Page template Generated classes for body and post Other WordPress templates Creating and using a custom template Making your theme widget-friendly Making sure your sidebar is one big

    tag Adding functions.php Adding conditional code to sidebar Adding some widgets Further widgetizing options

    166 168 171 172 173 174 178 178 179 179 180 181

    Enabling a menu in your theme Creating a child theme Creating the new theme directory Creating the stylesheet Using your child theme Sharing your theme Summary

    182 183 183 183 184 185 186

    header.php footer.php sidebar.php Your four template files

    Learning more

    Chapter 7: Feeds and Podcasting Feed basics Feed readers Learning more

    163 163 164 165



    188 188


    Your built-in WordPress feeds Adding feed links Feeds for the whole website Feeds for categories Feeds for post comments

    190 191 192 194 195 [ iv ]

    Table of Contents

    Tracking subscribers with FeedBurner Burn your feed on FeedBurner FeedBurner plugin


    196 197

    Podcasting Creating a podcast

    198 198

    Dedicated podcasting Podcasting plugins Using a service to host audio files for free Summary

    201 203 204 204

    Record yourself Make a post

    Chapter 8: Developing Plugins and Widgets Plugins Plugin code requirements Basic plugin—adding link icons

    Naming and organizing the plugin files Writing the plugin's core functions Adding hooks to the plugin Trying out the plugin

    198 199


    205 206 206

    207 208 209 211

    Adding an admin page


    Plugin with DB access—capturing searched words


    Adding management page functions Modifying the regex() function Adding hooks Trying out the plugin

    Getting the plugin to talk to the database Adding management page functions Adding hooks Trying out the plugin

    Learning more Widgets Recent posts from a Category Widget Naming the widget Widget structure Widget initiation function Widget form function Widget save function Widget print function Initiate and hook up the widget Final widget code Trying out the widget Learning more

    Bundling a widget with a plugin

    214 216 217 217 219 219 220 221

    222 223 223

    224 224 225 226 228 229 230 230 233 234



    Table of Contents

    Shortcodes How do shortcodes work? Creating a simple shortcode Adding options to the shortcode Enabling shortcodes in widgets Summary

    235 235 235 237 239 240

    Chapter 9: Community Blogging


    Chapter 10: Creating a Non-Blog Website


    Concerns for a multiuser blog Users roles and abilities Administrator Editor Author Contributor Subscriber Managing users Enabling users to self-register Learning more User management plugins Creating a multi-site website Summary

    Our client is a bookstore The Design New features covered in this chapter Introducing the initial theme What we are starting with Initial theme files and functionality functions.php header.php footer.php index.php

    Setting up the starter content Checking out the frontend Adding plugins Contact Form 7 April's Call Posts Smooth Slider

    241 242 242 242 244 245 245 246 249 250 251 252 253 255 256 261 261 262 262

    262 263 264 264

    265 268 270 271 273 275

    Installing the plugin Adding content to the plugin Adding the plugin to your theme

    275 276 277

    [ vi ]

    Table of Contents

    Creating a custom post type: book Registering a new post type

    279 279

    Registering and using a custom taxonomy Customizing the admin display Finalizing the bookstore website Summary

    288 290 292 293

    Adding labels Adding messages Creating book template files

    Chapter 11: Administrator's Reference

    System requirements Enabling permalinks The importance of backing up Easy, quick, frequent content backups Backing up everything Verifying your backups Upgrading WordPress What about the built-in upgrader? Do it gradually for a big jump Steps for upgrading Backing up your database Backing up your WordPress files Put WordPress in Maintenance Mode Deactivating all your plugins Downloading and extracting WordPress Deleting old files Uploading the new files Running the WordPress upgrade program Updating permalinks and .htaccess Installing updated plugins and themes Migrating or restoring a WordPress site Setting file permissions What are file permissions? Permissions for WordPress How to set permissions Troubleshooting Troubleshooting during installation Headers already sent Page comes with only PHP code Cannot connect to MySQL database

    [ vii ]

    280 281 284


    295 296 296 296 297 297 298 298 298 298 299 299 299 299 300 300 300 300 301 301 301 303 303 303 304 304 304

    304 305 305

    Table of Contents

    Basic troubleshooting


    Cannot see posts Making a site totally private I don't receive the e-mailed passwords

    Tips for theme development Template tags Class styles generated by WordPress Learning more Summary


    [ viii ]

    306 306 307

    307 307 310 310 311


    Preface WordPress 3 Complete begins from scratch, starting with how to install WordPress, all the way to the most advanced topics such as creating your own themes, writing plugins, and including custom post types in your website. Starting with downloading and installing the core WordPress software, you will take a detailed look at WordPress settings and also choose the settings that will work best for your website or blog. After that, the book will teach you all about content management functionality for your site from posts and pages to categories and tags, all the way to links, media, menus, images, galleries and more. Finally, you'll learn how to create your own themes and plugins to enhance the overall functionality of your website. Once you're done with WordPress 3 Complete, you'll be an expert in everything WordPress, from content management through technical steps such as backing up your site.

    What this book covers

    Chapter 1, Introduction to WordPress, explains how WordPress is an excellent software that can run your website (blog or not). It's packed with excellent features, and is so flexible that it can really do anything you want, and it has a wealth of online resources. Additionally, it's super easy-to-use, and you need no special skills or prior experience to use it. Last but not least, it is free! Chapter 2, Getting Started, explains how to install WordPress on a remote server, change the basic default settings of your blog, write posts, and comment on those posts. Chapter 3, Creating Blog Content, teaches everything you need to know to add content to your blog and manage that content, be it about posts, categories and comments, or tags, spam, and excerpts.


    Chapter 4, Pages, Plugins, Image Galleries Menus, and More, explores all of the content WordPress can manage that's not directly about blogging. You can also learn about static pages, menus, bookmark links, the media library, image galleries, plugins, and more. Chapter 5, Choosing and Installing Themes, describes how to manage the basic look of your WordPress website. You also learn where to find themes, why they are useful, and how to implement new themes on your WordPress website. Chapter 6, Developing Your Own Theme, explains how to make your own theme. With just the most basic HTML and CSS abilities, you can create a design and turn it into a fully functional WordPress theme. Chapter 7, Feeds and Podcasting, explains what an RSS feed is and how to make feeds available for our WordPress blog. It also explores how to syndicate a whole blog or just posts within a certain category, and how to create your own podcast with or without the help of plugins. Chapter 8, Developing Plugins and Widgets, teaches everything you need to know about creating basic plugins and widgets, how to structure the PHP file, where to put your functions, and how to use hooks. It also teaches about adding management pages and adding a widget that is related to a plugin. Chapter 9, Community Blogging, explains how to manage a group of users working with a single blog, which is a community of users. Community blogging can play an important role in a user group, or a news website. It also explains how to manage the different levels of privileges for users in a community. Chapter 10, Creating a Non-Blog Website, explores designing and building a basic theme that focuses primarily on non-blog content. It also creates multiple widget areas, multiple menu areas, and a smooth slider to the homepage. Chapter 11, Administrator's Reference, covers many of the common administrative tasks you may face when you're managing a WordPress-driven website. This includes backing up your database and files, moving your WordPress installation from one server or folder to another, and doing general problem-solving and troubleshooting.

    What you need for this book •

    A Computer

    A Web browser

    A text editor

    FTP software []


    Users may like a text editor that highlights code (such as Coda, TextMate, HTMLKit, and so on), but a simple text editor is all that's required. Users may like to run a local copy of WordPress on their computer, in which case they need a server like Apache and MySQL installed (though WAMP and MAMP would take care of all that for them), but it's also not necessary as they could do the entire thing remotely.

    Who this book is for

    This book is a guide to WordPress for both beginners and those who have slightly more advanced knowledge of WordPress. If you are new to blogging and want to create your own blog or website in a simple and straightforward manner, then this book is for you. It is also for people who want to learn to customize and expand the capabilities of a WordPress website. You do not require any detailed knowledge of programming or web development, and any IT-confident user will be able to use the book to produce an impressive website.


    In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning. Code words in text are shown as follows: "We can include other contexts through the use of the include directive." A block of code is set as follows:

    Blog title

    When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold: function ahs_doctypes_regex($text) { $types = get_option('ahs_supportedtypes'); $types = ereg_replace(',[ ]*','|',$types); $text =




    Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub. com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.


    Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at [email protected] with a link to the suspected pirated material. We appreciate your help in protecting our authors, and our ability to bring you valuable content.


    You can contact us at [email protected] if you are having a problem with any aspect of the book, and we will do our best to address it.


    Introduction to WordPress These days, everyone has a good reason to have a website. It's not just large companies anymore. Individuals, families, and small or independent businesses all need to have one. Some individuals and small businesses don't have the financial resources to hire a website development company or a freelance web developer to create a website for them. This is where WordPress comes in very handy. WordPress is an open source web software application that you can use to create and maintain an online website, even if you have a minimum of technical expertise. Since it is a web application, WordPress does not need to be installed on your home computer. It can live on the server (a kind of computer) that belongs to your website hosting company. It is also free, easy to use, and packed with excellent features. Originally, WordPress was an application meant to run a blog website, but it has now evolved into a fully-featured Content Management System (CMS). In this chapter, we'll explore: •

    The reasons that will make you choose WordPress to run your website

    The greatest advantages of WordPress

    Online resources for WordPress

    What is WordPress?

    WordPress is an open source blog engine. Open source means that nobody owns it, everybody works on it, and anyone can contribute to it. Blog engine means a software application that can run a blog. It's a piece of software that lives on the web server and makes it easy for you to add and edit posts, themes, comments, and all of your other content. More expansively, WordPress can be called a publishing platform because it is by no means restricted to blogging.

    Introduction to WordPress

    WordPress was originally a fork of an older piece of software named b2/cafelog. WordPress was developed by Matt Mullenweg and Mike Little, but is now maintained and developed by a team of developers that includes Mullenweg.

    Use it for a blog or a website

    There are generally two popular types of websites for which WordPress is meant to be used. •

    Normal website with relatively static content—pages, subpages, and so on.

    Blog website—chronologically organized, frequently updated, categorized, tagged, and archived.

    For those of you unfamiliar with blog websites and blogging terminology, let's take a look at the basics.

    Blog: Definition and common terms

    A blog, which is short for weblog, is a website that usually contains regular entries like any other kind of log. These entries can be of various types such as commentary, descriptions of events, photos, videos, personal remarks, or political ideas. They are usually displayed in reverse chronological order, with the most recent additions on the top. These entries can be organized in a variety of ways—by date, by topic, by subject, and so on. A blog is a special type of website that gets updated regularly. Unlike a site where the content is static, a blog behaves more like an online diary, wherein the blogger posts regular updates. Hence, blogs are dynamic with ever-changing content. A blog can be updated with new content and the old content can be changed or deleted at any time. Most blogs focus their content on a particular subject—for example current events, hobbies, technical expertise—or else they are more like personal online diaries. According to Wikipedia, the term weblog was first used in 1997, and people started using blogs globally in 1999. The terms weblog, weblogging, and weblogger were added to the Oxford Dictionary in 2003, though these days most people leave off the "we" part.

    Common terms

    If you are new to the world of blogging, you may want to familiarize yourself with the following common terms. []

    Chapter 1


    Each entry in the blog is called a post. Every post usually has a number of different parts. Of course, the two most obvious parts are title and content. The content is text, images, links, and so on. Posts can even contain multimedia. Every post also has a publication timestamp, and most also have one or more categories, tags, comments, and so on. It is these posts, or entries, that are displayed in reverse chronological order on the main page of the blog. The latest post is displayed first in order to give the viewer the latest news on the subject.

    Categories and tags

    Categories and tags are ways to organize and find posts within a blog and even across blogs. Categories are like topics, whereas tags are more like keywords. For example, for a blog about food and cooking, there might be a category called Recipes, but every post in that category would have different tags (for example, soup, baked, vegetarian, dairy-free, and so on).


    Most blogs allow visitors to post comments about the posts. This gives readers the opportunity to interact with the writer of the blog, thus making the whole enterprise interactive. Often, the writer of the blog will respond to comments by posting additional comments with the single click of a reply button, which makes for a continuous public online conversation or dialogue.


    The theme for a blog is the design and layout that you choose for your blog. In most blogs, the content (for example, posts) is separate from the visual layout. This means you can change the visual layout of your blog at any time without having to worry about the content being affected. One of the best things about themes is that it takes only seconds to install and start using a new one. Plus, there are thousands of free or low-cost themes available online so you can take your pick (or make your own!).


    RSS is an acronym for Really Simple Syndication, and Chapter 7 addresses the topic of feeds in detail. For now, understand that RSS and feeds are a way to syndicate the content of your blog so that people can subscribe to it. This means people do not actually have to visit your blog regularly to see what you've added. Instead, they can subscribe and have new content delivered to them via e-mail or through a feed reader such as Google Reader.


    Introduction to WordPress


    It's important to understand the difference between a page and a post. Unlike posts, pages do not depend on having timestamps and are not displayed in chronological order. They also do not have categories or tags. A page is a piece of content with only a title and content (an example would be About Me or Contact Us). It is likely that the number of pages on your site remains relatively static, whereas new posts are added every day or so. Thus pages have static content, while posts have dynamic content.

    Why choose WordPress?

    WordPress is not the only publishing platform out there, but it has an awful lot to recommend it. In the following sections, I've called attention to WordPress's most outstanding features.

    A long time in refining

    In web years, WordPress has been around for quite a while and was in development the whole time, getting better constantly. WordPress's very first release, Version 0.70, was released in May, 2003. Since then, it has had ten major releases, with a number of minor ones in between. Each release came with more features and better security.

    Active in development

    WordPress is a constantly evolving application. It's never left alone to stagnate. The developers are working continually to keep it ahead of spammers and hackers, and also to evolve the application based on the evolving needs of its users.

    Large community of contributors

    WordPress is not being developed by a lonely programmer in a dark basement room. On the contrary, there is a large community of people working on it collaboratively by developing, troubleshooting, making suggestions, and testing the application. With such a large group of people involved, the application is likely to continue to evolve and improve without pause.

    Amazingly extendable

    In addition to having an extremely strong core, WordPress is also quite extendable. This means that once you get started with it, the possibilities are nearly limitless. Any additional functionality that you can dream of can be added by means of a plugin that you or your programmer friends can write. [ 10 ]

    Chapter 1

    Detailed feature list

    Here is a detailed list of many features of WordPress: •

    Compliant with W3C standards

    Unlimited categories and subcategories

    Automatic syndication (RSS and Atom)

    Uses XML RPC interface for trackbacks and remote posting

    Allows posting via e-mail and mobile devices

    Supports plugins and themes

    Imports data from other blogs (Moveable Type, Textpattern, Greymatter, b2evolution, and blogger)

    Easy to administer and blog without any previous experience

    Convenient, fully functional, built-in search

    Instant and fast publishing of content—no re-building of pages required

    Multilanguage capable

    Link manager, also known as a blogroll or link list

    Allows password-protected content

    Comments manager and spam protection

    Built-in workflow (write, draft, review, and publish)

    Intelligent text formatting via a WYSIWYG editor

    New feature list since 2.7

    Since the last edition of this book was published, quite a staggering number of new features have been added to the WordPress software. If you're new to WordPress, this list may not mean a whole lot to you, but if you're familiar with WordPress and have been using it for a long time, you'll find this list quite enlightening. •

    Scrolling back to the same location after saving a file in the Plugin and Theme editors

    Adding support for "include" and "exclude" to [gallery]

    Showing "Draft updated" instead of "Post updated" when saving draft

    Renaming various menu items, for example Posts | Edit becomes Posts | Posts, and Links | Edit becomes Links | Links, and so on

    [ 11 ]

    Introduction to WordPress

    Moving Tools | Upgrade menu option to Dashboard | Updates and overhauling of user interface so themes, plugins, and core upgrade under one panel

    Improved revision comparison user interface

    Lots of new template files for custom taxonomies and custom post types, among others

    Not asking for confirmation when marking a comment as spam

    Not notifying post to author of his/her own comments

    Showing absolute date instead of relative date for scheduled posts

    Addition toggle all button to the Gallery tab in the uploader

    Browsing the theme directory and installing themes from the admin

    Allowing the dashboard widgets to be arranged in up to four columns

    Allowing "No role for this blog" to be chosen in Users | Add New panel

    Choosing username and password during installation rather than using "admin"

    Multisite now built in

    Supporting time zones and automatic daylight savings time adjustment

    Supporting IIS 7.0 URL Rewrite Module

    Faster loading of admin pages via script compression and concatenation

    Lots of arguments added to template functions

    Addition of password strength meter to Add User and Edit User

    New default theme "Twenty Ten" takes full advantage of the current features of WordPress

    Custom header and background APIs

    Support for shortlinks (though you need a plugin to realize this fully)

    A lighter admin color scheme to increase accessibility and put the focus more squarely on your content.

    Contextual help text accessed under the Help tab of every screen in the WordPress administration

    Changes Remove link on widgets to Delete because it doesn't just remove it, it deletes the settings for that widget instance

    Syntax highlighting and function lookup built into plugin and theme editors

    [ 12 ]

    Chapter 1

    Learning more

    If you'd like to see detailed complete lists of all new features added since WordPress version 2.7, take a look at these links: •




    Also, you can read a fully explained feature list at http://wordpress.org/about/ features/.

    Online WordPress resources

    One very useful characteristic of WordPress is that it has a large, active online community. Everything you will ever need for your WordPress website can likely be found online, and probably for free.

    WordPress news

    As WordPress is always actively developed, it's important to keep yourself up-to-date with the software community about their latest activities. If you visit the Dashboard of your own WordPress site regularly, you'll be able to stay up-to-date with WordPress news and software releases. There are widgets on the dashboard that display latest news and announcements, and an alert always appears when there is a new version of WordPress available for download and installation. If you prefer to visit the website, then the most important spot to visit or subscribe to is WordPress Releases. Whenever there is a new release—be it a major release, or an interim bug fix, or an upgrade—it will be here: http://wordpress.org/ development/category/releases/. Also, be sure to stay tuned to the main WordPress blog at http://wordpress.org/


    [ 13 ]

    Introduction to WordPress

    The Codex

    The WordPress Codex is the central repository of all the information the official WordPress team has published to help people work with WordPress.

    The Codex has some basic tutorials for getting started with WordPress, such as a detailed step-by-step discussion of installation, lists of every template tag and hook, and a lot more. Throughout this book, I'll be providing links to specific pages within the Codex, which will provide more or advanced information on the topics in this book. [ 14 ]

    Chapter 1

    Support from other users

    The online WordPress community asks questions and responds with solutions on the WordPress forum: http://support.wordpress.org. That's an excellent place to go if you can't find the answer to a problem in the codex. If you have the question, then probably someone else has had it as well, and WordPress experts spend time in the forum answering questions and giving solutions. There's also an IRC channel where you can get additional support.

    Theme and plugin directories

    There are official directories for themes and for plugins on wordpress.org. Though not every theme and plugin is available here, the ones that are here have been vetted by the community to some extent. Anything you download from these directories is likely to be relatively bug-free. Plugins and themes that you get from other sources can have malicious code, so be careful. You can also see what the community thinks of these downloads by looking at ratings, comments, and popularity. Additionally, plugins in the Plugin Directory are automatically upgradable from within your WordPress Administration Panel, whereas other plugins have to be upgraded manually. We'll cover this in more detail in a later chapter. You can find the Theme Directory at http://wordpress.org/extend/themes/ and the Plugin Directory at http://wordpress.org/extend/plugins/.


    You'll notice that all of the URLs above belong to wordpress.org. There is another website, Wordpress.com, which is actually a free blog-hosting service. Anyone can open an account on WordPress.com and instantly have his or her own WordPress-driven website. According to WordPress.com, there were over 16 million blogs on WordPress.com and over 25 million active installations of the WordPress.org software as of December 2010. In Chapter 2, we will discuss all of the differences between having your blog on

    WordPress.com versus downloading the software from WordPress.org and

    hosting it yourself, but the basic difference is the level of control. If your blog is on WordPress.com, you have less control over plugins, themes, and other details of the blog because everything is managed and made worry-free by the WordPress.com service.

    [ 15 ]

    Introduction to WordPress


    Having a website of your own is essential these days, whether you are an individual, a small business, or some other group. It is whether you are blogging regularly, or just want some accurate static content up on the Internet. In this chapter, we reviewed basic information about blogging and common blog terms for those of you who are new to the concept. WordPress is excellent software application that can run your website (blog or not). It's packed with excellent features, is so flexible that it can really do anything you want, and it has a wealth of online resources. Additionally, it's super easy-to-use, and you need no special skills or prior experience to use it. Last, but not least, it is free! In the next chapter, we will explore the choices and steps involved in installing WordPress and getting started.

    [ 16 ]

    Getting Started This chapter will guide you through the process of setting up WordPress and customizing its basic features. You can choose between a couple of options regarding where your WordPress installation will live. Keep in mind that WordPress is relatively small (under 10 MB), easy to install, and easy to administer. WordPress is available in easily downloadable formats from its website, http://wordpress.org/download/. WordPress is a free, open source application, and is released under GNU General Public License (GPL). This means that anyone who produces a modified version of software released under the GPL is required to keep those same freedoms, that people buying or using the software may also modify and redistribute, attached to his or her modified version. This way, WordPress and other software released under GPL are kept open source. In this chapter, you will learn how to: •

    Create a free blog on WordPress.com

    Install WordPress manually on your web host

    Perform basic setup tasks in the WordPress Admin panel

    Where to build your WordPress website

    The first decision you have to make is where your blog is going to live. You have two basic options for the location where you will create your site. You can: •

    Use WordPress.com

    Install on a server (hosted or your own)

    Let's look at some of the advantages and disadvantages of each of these two choices.

    Getting Started

    The advantage of using WordPress.com is that they take care of all of the technical details for you. The software is already installed; they'll upgrade it for you whenever there's an upgrade; and you're not responsible for anything else. Just manage your content! The big disadvantage is that you lose almost all of the theme and plugin control you'd have otherwise. WordPress.com will not let you upload or edit your own theme, though it will let you (for a fee) edit the CSS of any theme you use. WordPress.com will not let you upload or manage plugins at all. Some plugins are installed by default (most notably Akismet, for spam blocking, and a fancy statistics plugin), but you can neither uninstall them nor install others. Additional features are available for a fee as well. This chapter will cover creating a blog on WordPress. com, and you can learn about navigating around the WP Admin in the next chapter. However, much of what this book covers will be impossible on WordPress.com. The huge advantage of installing WordPress on another server (which means either a server that belongs to the web host with which you signed up, or a server you set up on your own computer) is that you have control over everything. You can add and edit themes, add and remove plugins, and even edit the WordPress application files yourself if you want. You'll have to keep your own WordPress software up-to-date, but that's relatively simple, and we'll cover it in this chapter. The only disadvantage is that you have to do the installation and maintenance yourself, which, as you'll see, shouldn't be too intimidating. Plus, some web hosts provide a one-click or easy-to-use installer, which lets you skip over some of the nitty-gritty steps involved in manual installation. As I said, we'll discuss using WordPress.com in this chapter. However, you will have to install WordPress on your own server if you want to accomplish any of the more advanced topics from this book. The following table is a brief overview of the essential differences between using WordPress.com versus installing WordPress on your own server: WordPress.com

    Your own server


    You don't have to install anything, just sign up

    Install WordPress yourself, either manually or via your host's control panel (if offered)


    Use any theme made available by WordPress.com

    Use any theme available anywhere, written by anyone (including yourself)


    No ability to choose or add plugins

    Use any plugin available anywhere, written by anyone (including yourself)


    WordPress.com provides automatic upgrades

    You have to upgrade it yourself when upgrades are available


    Widget availability depends on You can widgetize any theme yourself available themes

    [ 18 ]

    Chapter 2


    Your own server

    Maintenance You don't have to do any maintenance Advertising

    You're responsible for the maintenance of your site

    No advertising allowed

    Advertise anything and in any amount you like

    Using WordPress.com

    WordPress.com (http://wordpress.com) is a free service provided by the WordPress developers, where you can register a blog or non-blog website easily and quickly with no hassle. However, because it is a hosted service, your control over some things will be more limited than it would be if you hosted your own WordPress website. As mentioned before, WordPress.com will not let you edit or upload your own themes or plugins. Aside from this, WordPress.com is a great place to maintain your personal site if you don't need to do anything fancy with a theme. To get started, go to http://wordpress.com, which will look something like the following:

    [ 19 ]

    Getting Started

    To register your free website, click on the loud orange-and-white Sign up now button. You will be taken to the signup page. In the following screenshot, I've entered my username (what I'll sign in with) and a password (note that the password measurement tool will tell you if your password is strong or weak), as well as my e-mail address. Be sure to check the Legal flotsam box and leave the Gimme a blog! radio button checked. Without it, you won't get a website.

    [ 20 ]

    Chapter 2

    After providing this information and clicking on the Next button, WordPress will ask for other choices (Blog Domain, Blog Title, Language, and Privacy), as shown in following screenshot. You can also check if it's a private blog or not. Note that you cannot change the blog domain later! So be sure it's right.

    After providing this information and clicking on Signup, you will be sent to a page where you can enter some basic profile information. This page will also tell you that your account is set up, but your e-mail ID needs to be verified. Be sure to check your inbox for the e-mail with the link, and click on it. Then, you'll be truly done with the installation. Now, you can skip the next section of this chapter, which is about installing WordPress manually. You can go directly to the section on the WP Admin panel to start learning about it.

    [ 21 ]

    Getting Started

    After you download the WordPress .zip file, extract the files, and you'll get a folder called wordpress. It will look like the following screenshot:

    Upgrading from an earlier version of WordPress

    If you are upgrading an existing installation of WordPress, you should probably leave this chapter and instead read the section on Upgrading WordPress in Chapter 11 of this book.

    [ 24 ]

    Getting Started

    On the left side, you will see the files from your local folder, and on the right side you will see your remote folder. (Note: the FTP client you are using may have a slightly different layout, but this is the general idea):

    Now select all of the WordPress files on your local machine from the left pane, and drag all of them to the right pane. You can watch as your FTP client uploads the files one at a time and they appear in the right panel. This could take a few minutes, so be patient! If you're installing WordPress on your local server, just be sure to place the WordPress files in the correct webroot directory on your computer. Once all of the files are done uploading, you're ready to do the installation.

    [ 26 ]

    Chapter 2

    Installing WordPress

    Now it's time to install WordPress. For example, I will be working on my local server and just put brand-new WordPress files at http://wpbook:8888/. So, this is going to be the URL of my WordPress website. If you access your WordPress URL via your browser, it will look like the following:

    It says that you need to create a file named wp-config.php before proceeding further. WordPress (and I) recommend that you do this manually, rather than using the Create a Configuration File link. If you do choose to use the config creator, you'll need the information below as well (though there will be no opportunity for the security phrases). Open the wordpress folder and find the file named wp-config-sample.php. Make a copy of this file and name it wp-config.php. We'll modify this file together. Don't worry; you need not be a PHP programmer. Just open this file with a simple editor such as Notepad. The following is the copied text from the original wp-config.php file. Note that I've removed most of the comments, so that we can focus on the items we need to change.