Professional WordPress - Brad Williams - E-Book

Professional WordPress E-Book

Brad Williams

3,9
32,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

The highest rated WordPress development and design book on the market is back with an all new third edition. Professional WordPress is the only WordPress book targeted to developers, with advanced content that exploits the full functionality of the most popular CMS in the world. Fully updated to align with WordPress 4.1, this edition has updated examples with all new screenshots, and full exploration of additional tasks made possible by the latest tools and features. You will gain insight into real projects that currently use WordPress as an application framework, as well as the basic usage and functionality of the system from a developer's perspective. The book's key features include detailed information and real-world examples that illustrate the concepts and techniques at work, plus code downloads and examples accessible through the companion website. Written by practicing WordPress developers, the content of this edition focuses on real world application of WordPress concepts that extend beyond the current WordPress version. WordPress started in 2003 with a single bit of code to enhance the typography of everyday writing, and has grown to be the largest self-hosted website platform in the world. This book helps you use WordPress efficiently, effectively, and professionally, with new ideas and expert perspectives on full system exploitation. * Get up to speed on the new features in WordPress 4.1 * Learn cutting edge uses of WordPress, including real-world projects * Discover how to migrate existing websites to WordPress * Understand current best practices and tools in WordPress development WordPress was born out of a desire for an elegant, well-architected personal publishing system built on PHP and MySQL, and has evolved to be used as a full content management system through thousands of plugins, widgets, and themes. Professional WordPress is the essential developer's guide to this multifunctional system.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 842

Bewertungen
3,9 (16 Bewertungen)
4
8
2
2
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



CONTENTS

INTRODUCTION

WHO IS THIS BOOK FOR?

HOW THIS BOOK IS STRUCTURED

WHAT YOU NEED TO USE THIS BOOK

CONVENTIONS

SOURCE CODE

ERRATA

P2P.WROX.COM

CHAPTER 1 FIRST POST

WHAT IS WORDPRESS?

POPULARITY OF WORDPRESS

CONTENT AND CONVERSATION

GETTING STARTED

FINISHING UP

SUMMARY

CHAPTER 2 CODE OVERVIEW

DOWNLOADING

DIRECTORY AND FILE STRUCTURE

WORDPRESS CONFIGURATION

WP-CONTENT USER PLAYGROUND

SUMMARY

CHAPTER 3 WORKING WITH WORDPRESS LOCALLY

BENEFITS OF WORKING LOCALLY

TOOLS FOR COMPONENT ADMINISTRATION

CONFIGURATION DETAILS

VIRTUAL MACHINES

DEPLOYING LOCAL CHANGES

SUMMARY

CHAPTER 4 TOUR OF THE CORE

WHAT’S IN THE CORE?

USING THE CORE AS A REFERENCE

WORDPRESS CODEX AND CODE REFERENCE

DON’T HACK THE CORE!

SUMMARY

CHAPTER 5 THE LOOP

UNDERSTANDING THE LOOP

TEMPLATE TAGS

CUSTOMIZING THE LOOP

GLOBAL VARIABLES

WORKING OUTSIDE THE LOOP

SUMMARY

CHAPTER 6 DATA MANAGEMENT

DATABASE SCHEMA

TABLE DETAILS

WORDPRESS DATABASE CLASS

DIRECT DATABASE MANIPULATION

SUMMARY

CHAPTER 7 CUSTOM POST TYPES, CUSTOM TAXONOMIES, AND METADATA

UNDERSTANDING DATA IN WORDPRESS

WORDPRESS TAXONOMY

BUILDING YOUR OWN TAXONOMIES

METADATA

COMMUNITY PROJECTS

SUMMARY

CHAPTER 8 PLUGIN DEVELOPMENT

PLUGIN PACKAGING

PLUGIN SECURITY

KNOW YOUR HOOKS: ACTIONS AND FILTERS

PLUGIN SETTINGS

WORDPRESS INTEGRATION

CREATING A PLUGIN EXAMPLE

PUBLISHING TO THE PLUGIN DIRECTORY

SUMMARY

CHAPTER 9 THEME DEVELOPMENT

WHY USE A THEME?

INSTALLING A THEME

WHAT IS A THEME?

CREATING YOUR OWN THEME

CREATING YOUR OWN THEME: GETTING STARTED

CREATING YOUR OWN THEME: DRY

CREATING YOUR OWN THEME: CONTENT DISPLAY

CREATING YOUR OWN THEME: ADDITIONAL FILES

CUSTOM PAGE TEMPLATES

OTHER THEME ENHANCEMENTS

THEME HIERARCHY AND CHILD THEMES

PREMIUM THEMES AND OTHER THEME FRAMEWORKS

SUMMARY

CHAPTER 10 MULTISITE

WHAT IS MULTISITE?

WORKING IN A NETWORK

CODING FOR MULTISITE

MULTISITE DATABASE SCHEMA

SUMMARY

CHAPTER 11 MIGRATING TO WORDPRESS

UNDERSTANDING THE PROCESS

CONTENT IDENTIFICATION

MEDIA MIGRATION

MOVING METADATA

MOVING AUTHORS AND USERS

THEME AND PRESENTATION

UNIQUE FUNCTIONALITY

CLEANING UP

LAUNCHING

WP-CLI

MIGRATION EXAMPLE

SUMMARY

CHAPTER 12 CRAFTING A USER EXPERIENCE

USER EXPERIENCE PRINCIPLES

USABILITY AND USABILITY TESTING

STRUCTURING YOUR INFORMATION

GETTING YOUR SITE FOUND

HOW WEB STANDARDS GET YOUR DATA DISCOVERED

SEARCHING YOUR OWN SITE

MOBILE ACCESS AND RESPONSIVE WEB DESIGN

SUMMARY

CHAPTER 13 SECURING WORDPRESS

SECURING YOUR WORDPRESS SITE

USING WORDPRESS ROLES

RECOMMENDED SECURITY PLUGINS

SUMMARY

CHAPTER 14 APPLICATION FRAMEWORK

WHAT IS AN APPLICATION FRAMEWORK?

SUMMARY

CHAPTER 15 WORDPRESS IN THE REAL WORLD

IS WORDPRESS THE RIGHT TOOL?

WHEN WORDPRESS IS NOT THE RIGHT TOOL

DEFINING CONTENT MANAGEMENT

WORKFLOW AND DELEGATION

CONTENT ORGANIZATION

INTERACTIVITY FEATURES

SCALABILITY

STATISTICS COUNTERS

CACHE MANAGEMENT

LOAD BALANCING YOUR WORDPRESS SITE

DEALING WITH SPAM

OTHER CONTENT MANAGEMENT SYSTEMS

SUMMARY

CHAPTER 16 WORDPRESS DEVELOPER COMMUNITY

CONTRIBUTING TO WORDPRESS

SISTER PROJECTS

RESOURCES

SUMMARY

TITLEPAGE

COPYRIGHT

DEDICATION

ABOUT THE AUTHORS

ABOUT THE TECHNICAL EDITOR

CREDITS

ACKNOWLEDGMENTS

ADVERT

END USER LICENSE AGREEMENT

List of Tables

Chapter 13

Table 13.1

List of Illustrations

Chapter 1

Figure 1.1

A clean but unconfigured WordPress installation

Figure 1.2

WordPress will create a new wp-config file if one does not exist.

Figure 1.3

Database configuration dialog box

Figure 1.4

Complete website details and set up admin user.

Figure 1.5

Administrative information at the conclusion of a clean install

Figure 1.6

mysql_error( ) reporting a socket problem

Figure 1.7

MySQL database selection error

Figure 1.8

Dashboard view upon a first-time login

Figure 1.9

Publishing from the QuickDraft panel

Chapter 2

Figure 2.1

Default WordPress file and folder structure

Figure 2.2

Randomly generated secret keys

Figure 2.3

Enabling permalinks in WordPress

Figure 2.4

Manual info for creating the .htaccess file

Chapter 3

Figure 3.1

WordPress installation

Figure 3.2

Apache document root

Figure 3.3

Apache Directory directive

Figure 3.4

Apache block .svn files

Figure 3.5

PHP error level

Figure 3.6

WordPress debug

Figure 3.7

mirmillo.local virtual host

Figure 3.8

Apache includes virtual host config

Figure 3.9

Hosts file mapping for virtual host

Figure 3.10

SQL queries to remove domain names

Chapter 4

Figure 4.1

WordPress.org search

Figure 4.2

Function reference for get_userdata()

Figure 4.3

WordPress Code Reference for absint()

Chapter 5

Figure 5.1

The WordPress Loop

Figure 5.2

Using multiple Loops

Chapter 6

Figure 6.1

WordPress database diagram

Figure 6.2

Taxonomy tables relationship

Figure 6.3

phpMyAdmin viewing a WordPress database

Chapter 7

Figure 7.1

Products custom post type

Figure 7.2

WordPress taxonomy table structure

Figure 7.3

Custom taxonomy menu option

Figure 7.4

Custom taxonomy admin panel

Figure 7.5

Custom taxonomy meta box

Figure 7.6

Custom Field meta box

Chapter 8

Figure 8.1

Example plugin listing

Figure 8.2

Escaping API breakdown

Figure 8.3

Custom top-level menu

Figure 8.4

Custom settings section

Figure 8.5

Custom meta box

Figure 8.6

Example dashboard widget

Figure 8.7

Post product meta box

Figure 8.8

Products widget

Figure 8.9

SVN Checkout dialog box

Figure 8.10

Plugin header image

Figure 8.11

Plugin icon example

Chapter 9

Figure 9.1

An index page slider can make your front page look unique.

Figure 9.2

An index page slider using the front-page.php template

Figure 9.3

Hover over the category name in the Category Screen to see the category ID in the status bar.

Figure 9.4

The WordPress template hierarchy

Figure 9.5

Selecting the page template

Figure 9.6

Child themes make it easy to apply styles and content to specific pages.

Chapter 10

Figure 10.1

Network Setup submenu

Figure 10.2

Multisite Network menu

Figure 10.3

Edit Site section

Figure 10.4

Network Admin top-level menu

Chapter 12

Figure 12.1

Active navigation

Figure 12.2

Mockup being created in Photoshop

Figure 12.3

Setting the permalink structure in the Dashboard

Figure 12.4

Google Webmaster Tools

Figure 12.5

Editing the XFN of a link

Chapter 15

Figure 15.1

Using WP-CMS Post Control to set the Dashboard options

Figure 15.2

Editing a rich text widget

Figure 15.3

Using the TinyMCE Advanced configuration panel

Figure 15.4

Creating a page that links to a third party with the Page Links To plugin

Figure 15.5

WordPress on one server

Figure 15.6

WordPress on two servers

Figure 15.7

WordPress with load-balanced web servers

Figure 15.8

WordPress with a hot spare database server

Figure 15.9

WordPress with load-balanced web and database servers

Figure 15.10

WebGrind visualization of WordPress complexity

Figure 15.11

Number of queries on initial page load of TwentyFourteen

Chapter 16

Figure 16.1

Custom Query in Trac

Figure 16.2

See what others are saying

Guide

Cover

Table of Contents

Chapter

Pages

xxxi

xxxii

xxxiii

xxxiv

xxxv

xxxvi

xxxvii

1

2

3

4

5

6

7

8

9

10

11

13

14

15

16

17

18

19

20

21

23

24

25

26

27

28

29

30

31

32

33

34

35

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

53

54

56

57

58

59

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

111

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

182

183

184

186

187

188

189

191

192

193

194

195

197

198

199

200

201

202

203

204

205

207

208

209

210

212

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

300

301

302

303

304

305

306

308

309

310

311

312

313

314

315

316

317

318

319

320

321

324

325

326

327

328

329

330

331

332

333

334

335

336

337

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

369

370

371

372

373

374

375

376

377

378

379

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

445

446

447

448

449

450

451

452

INTRODUCTION

DEAR READER, thank you for picking up this book. WordPress is the most popular self-hosted website software in use today. It is available as an open source project, licensed under the GPL, and is built largely on top of the MySQL database and PHP programming language. Any server environment that supports that simple combination can run WordPress, making it remarkably portable as well as simple to install and operate. You don’t need to be a systems administrator, developer, HTML expert, or design aesthete to use WordPress. On the other hand, because WordPress has been developed using a powerful set of Internet standard platforms, it can be extended and tailored for a wide variety of applications. WordPress is the publishing mechanism underneath millions of individual blog voices and the engine that powers high-volume, high-profile sites such as CNN’s websites and blogs. It was designed for anyone comfortable navigating a browser, but is accessible to web designers and developers as well.

Given that range of applications and capabilities, it can prove hard to know where to start if you want to make use of the power of WordPress for your specific purposes. Should you first study the database models and relationships of content and metadata, or the presentation mechanics that generate the HTML output? This book was designed for readers to develop a knowledge of WordPress from the inside out, focusing on the internal structure and flow of the core code as well as the data model on which that code operates. Knowing how something works often makes you more adept at working with it, extending it, or fixing it when it breaks. Just as a race car driver benefits from a fundamental knowledge of combustion engines, aerodynamics, and the mechanics of automobile suspension, someone driving WordPress through its full dynamic range will be significantly more adept once acquainted with the underlying software physics.

WHO IS THIS BOOK FOR?

It was the dichotomy between the almost trivial effort required to create a WordPress-based website and publish a first post to the world and the much more detailed, broad understanding required to effect mass customization that led us to write this book. Many books on the market provide guidance to beginning bloggers by walking you through the typical functions of creating, configuring, and caring for your WordPress site. Our goal was to bridge the gap between an expert PHP developer who is comfortable reading the WordPress Codex in lieu of a manual and the casual WordPress user creating a public persona integrated with social networking sites and advertising services, with a tailored look and feel.

In short, we hope to appeal to a range of developers, from the person looking to fine-tune a WordPress theme to a more advanced developer with a plugin concept or who is using WordPress in a large enterprise integrated into a content management system. We do this by exploring WordPress from the inside out. Our goal for this book is to describe the basic operation of a function and then offer guidance and examples that highlight how to take it apart and reassemble that function to fit a number of needs. WordPress users who are not hardened PHP developers may want to skim through the developer-centric section, whereas coders looking for specific patterns to implement new WordPress functionality can start in the middle and work toward the end.

HOW THIS BOOK IS STRUCTURED

This book is divided into three major sections: Chapters 1 through 4 are an overview of the WordPress system, its major functional elements, and a top-level description of what happens when a WordPress-generated web page is displayed. Chapters 5 through 9 build on this foundation and dive into the core of WordPress, describing internal code flow and data structures. This middle section is strongly developer-oriented, and describes how to extend WordPress through plugins and customize it via themes. The last section, Chapters 10 through 15, combines a developer view of user experience and optimization with the deployer requirements for performance, security, and enterprise integration.

The following is a detailed chapter-by-chapter overview of what you can expect to find in this book.

Chapter 1, “First Post,” contains a brief summary of the history of the WordPress software core, explores some popular hosting options and why community matters in a content-centric world, and concludes with the basics of do-it-yourself WordPress installation and debugging.

Chapter 2, “Code Overview,” starts with the mechanics of downloading the WordPress distribution and describes its basic contents and file system layout. A top-to-bottom code flow walks you from an index or specific post URL, through the process of selecting posts, assembling content, and generating the displayed HTML. This chapter is a map for the more detailed code tours in the developer-focused section.

Chapter 3, “Working with WordPress Locally,” covers the many benefits to working with WordPress on your local computer. This chapter also reviews the various setups for local development on a Microsoft Windows or Apple computer. Finally, you’ll cover how to deploy your local changes to a remote server using various deployment methods.

Chapter 4, “Tour of the Core,” examines the essential PHP functions within the basic WordPress engine. It serves as an introduction to the developer-focused middle section of the book and also lays the foundation for the deployment-, integration-, and experience-focused chapters in the last section. This chapter also covers using the core as a reference guide, and why it is best not to hack the core code to achieve desired customizations.

Chapter 5, “The Loop,” is the basis for the developer-centric core of this book. The WordPress main loop drives the functions of creating and storing content in the MySQL database, as well as extracting appropriate chunks of it to be sorted, decorated, and nested under banners or next to sidebars, in both cases generating something a web browser consumes. This chapter disassembles those processes of creating, saving, and publishing a new post as well as displaying content that has been stored in the WordPress MySQL databases. The underlying database functions and the management of content metadata are covered in more detail to complete a thorough view of WordPress’s internal operation.

Chapter 6, “Data Management,” is the MySQL-based counterpart to Chapter 5. The core functions create, update, and manipulate entries in multiple MySQL database tables, and this chapter covers the database schema, data and metadata taxonomies used, and the basic relations that exist between WordPress elements. It also includes an overview of the basic query functions used to select and extract content from MySQL, forming a basis for extensions and custom code that needs to be able to examine the individual data underlying a blog.

Chapter 7, “Custom Post Types, Custom Taxonomies, and Metadata,” explores the different types of content and associated data in WordPress. You’ll cover how to register and work with custom post types for creating custom content in WordPress. Custom taxonomies are also dissected, and we’ll dive into the various setups with examples. Finally you’ll cover post metadata and the proper ways to store arbitrary data against posts in WordPress.

Chapter 8, “Plugin Development,” starts with the basic plugin architecture and then explores the hook, action, and filter interfaces that integrate new functionality around the WordPress core. This chapter demonstrates the interposition of functions into the page composition or content management streams and how to save plugin data. Examples of building a plugin using a simple framework outline the necessary functionality of any plugin. This chapter also covers creation of widgets, simpler-to-use plugins that typically add decoration, additional images, or content to a blog sidebar; many plugins also have a widget for easier management. Publishing a plugin to the WordPress repository and pitfalls of plugin conflict round out the discussion of WordPress’s functional extensions.

Chapter 9, “Theme Development,” is the display and rendering counterpart to Chapter 8. Plugins add new features and functions to the core, whereas themes and CSS page templates change the way that content is displayed to readers. Starting with a basic theme, this chapter covers writing a theme, building custom page templates, menu management, widget areas, post formats, theme installation, and how thematic elements are used by the functions described in previous chapters. This chapter ends the deep developer-focused middle section of the book.

Chapter 10, “Multisite,” explores the popular Multisite feature of WordPress. You’ll learn the advantages of running your own Multisite network and how to properly install Multisite, work in a network, create sites and users, manage themes and plugins, and even conduct domain mapping. The last part of the chapter explores coding for Multisite and the various functions and methods available for use.

Chapter 11, “Migrating to WordPress,” looks at the migration process when migrating existing data to a WordPress website. You’ll learn about the migration process and data mapping guides, and how to work with a newer tool, WP-CLI, for larger migrations.

Chapter 12, “Crafting a User Experience,” looks at a WordPress installation from the perspective of a regular or potential reader. Usability, testing, and the ease of finding information within a WordPress website form the basics, with added emphasis on web standards for metadata and search engine optimization so a page, or a specific post, can be found through an appropriate Google search. This chapter focuses on how to get your content to show up elsewhere on the web. Alternatives for adding search functionality, one of WordPress’s weaknesses, are discussed, along with content accessibility and delivery to mobile devices.

Chapter 13, “Securing WordPress,” deals with good and bad popularity. Keeping a WordPress installation safe from malicious attackers is a key part of configuration and management, and this chapter covers the general best practices and addresses them with some of the more popular security and anti-spam plugins and features.

Chapter 14, “Application Framework,” goes beyond blogging to examples of WordPress as an application framework to be used as a base when creating web applications. You’ll explore popular application framework features and how they relate in WordPress.

Chapter 15, “WordPress in the Real World,” tackles issues of scale and integration. WordPress addresses deficiencies in “enterprise scale” content management tools, and building on the mechanisms covered in Chapter 12, this chapter shows how to use WordPress in real-world situations with confidence.

Chapter 16, “WordPress Developer Community,” is an introduction to contributing to the WordPress ecosystem by working on the core, submitting plugins or themes, adding to the documentation canon, and assisting other developers. An overview of WordPress sister projects such as bbPress for forums is provided along with a brief summary of other developer resources and a glossary of WordPress context-sensitive terms.

WHAT YOU NEED TO USE THIS BOOK

You’ll need at least a rudimentary understanding of HTML and some knowledge of cascading style sheets (CSS) to make use of the theme and user experience sections of the book. Experience in writing and debugging PHP code is a prerequisite for more advanced developer sections, although if you’re just going to make changes based on the samples in this book, you can use the code as a template and learn on the fly. A basic knowledge of databases, especially the syntax and semantics of MySQL, is in order to make the most out of the chapter on data management as well as develop plugins that need to save data.

It’s helpful to have an interactive development environment in which to view PHP code, or PHP code sprinkled through HTML pages. Choosing a set of developer tools often borders on religion and deep personal preference (and we know plenty of coders who believe that vi constitutes a development environment). Some of the more user-friendly tools will make walking through the WordPress code easier if you want to see how functions used in the examples appear in the core.

Most important, if you want to use the code samples and examples in this book, you’ll need a WordPress website in which to install them. Chapter 1 covers some basic WordPress hosting options as well as the simple mechanics of downloading the components and installing WordPress on a desktop or test machine for debugging and closer inspection. Chapter 3 covers how to install and configure WordPress locally on your computer.

Finally, some people might argue that to really take advantage of WordPress you need to be able to write, but that ignores the basic beauty of the WordPress platform: It takes the power of the printing press to an individual level. This book isn’t about what you say (or might say); it’s about how you’re going to get those ideas onto the web and how the world will see them and interact with your blog.

CONVENTIONS

To help you get the most from the text and keep track of what’s happening, we’ve used a number of conventions throughout the book.

WARNING  Warnings hold important, not-to-be forgotten information that is directly relevant to the surrounding text.

NOTE  Notes indicate tips, hints, tricks, or asides to the current discussion.

As for styles in the text:

We

italicize

new terms and important words when we introduce them.

We show file names, URLs, and code within the text like so:

persistence.properties

.

We present code in two different ways:

We use a monofont type with no highlighting for most code examples.

SOURCE CODE

As you work through the examples in this book, you may choose either to type in all the code manually, or to use the source code files that accompany the book. All of the source code used in this book is available for download at www.wrox.com. Specifically for this book, the code download is on the Download Code tab at:

www.wrox.com/go/wordpress3e

For this edition of the book, Chapters 8, 10, and 11 have companion code files that you can download. The code is in the specific chapter’s download file and individually named according to the code filenames noted throughout the chapter.

Most of the code on www.wrox.com is compressed in a .ZIP, .RAR, or similar archive format appropriate to the platform. Once you download the code, just decompress it with an appropriate decompression tool.

NOTE  Because many books have similar titles, you may find it easiest to search by ISBN; this book’s ISBN is 978-1-118-98724-7.

Once you download the code, just decompress it with your favorite compression tool. Alternately, you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books.

ERRATA

We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and at the same time, you will be helping us provide even higher quality information.

To find the errata page for this book, go to

www.wrox.com/go/wordpress3e

and click the Errata link. On this page you can view all errata that has been submitted for this book and posted by Wrox editors.

If you don’t spot “your” error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We’ll check the information and, if appropriate, post a message to the book’s errata page and fix the problem in subsequent editions of the book.

P2P.WROX.COM

For author and peer discussion, join the P2P forums at http://p2p.wrox.com. The forums are a web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

At http://p2p.wrox.com, you will find a number of different forums that will help you, not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:

Go to

http://p2p.wrox.com

and click the Register link.

Read the terms of use and click Agree.

Complete the required information to join, as well as any optional information you wish to provide, and click Submit.

You will receive an e-mail with information describing how to verify your account and complete the joining process.

NOTE  You can read messages in the forums without joining P2P, but in order to post your own messages, you must join.

Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.

For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works, as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

1First Post

WHAT’S IN THIS CHAPTER?            

Appreciating the provenance of the WordPress platform

Choosing a suitable platform for your WordPress installation

Downloading, installing, and performing basic configuration of WordPress

Diagnosing and resolving common installation problems

If displaying “Hello World” on an appropriate device defines minimum competence in a programming language, generating your first post is the equivalent in the online publishing world. This chapter provides a brief history of WordPress and then explores several options for hosting a WordPress installation. Common miscues and misperceptions along with their resolutions round out the chapter and put you on the edge of publishing your wit and wisdom.

Once you’ve installed, configured, and completed the barebones administration, you’re ready to take advantage of the code walk-throughs and detailed component descriptions in later chapters. Of course, if you already have a functional WordPress website, you can skip this chapter, and dive in headfirst to explore the core code in Chapter 2, “Code Overview.”

WHAT IS WORDPRESS?

WordPress is one of the most popular open source content management systems available, with global and vibrant user, developer, and support communities. While it can be compared to Drupal and Joomla as a user-generated content workhorse, WordPress distinguishes itself with a broad array of hosting options, functional extensions (plugins), and aesthetic designs and elements (themes).

With the rise of self-publishing, low-cost web hosting, and freely available core components such as the MySQL database, blogging software followed the same trend as most other digital technologies, moving from high-end, high-cost products to widely available, low-cost consumer or “hobbyist” systems. WordPress isn’t simply about creating a blog so that you can have a digital diary attached to your vanity URL; it has evolved into a full-fledged content management system and burgeoning application development framework used by individuals and enterprises alike. This section takes a brief tour through the early history of WordPress and brings you up to speed on the current release and user community.

WordPress started similarly to many other popular open source software packages: Some talented developers saw a need to create a powerful, simple tool based on an existing project licensed under the GPL. Michel Valdrighi’s b2/cafelog system provided the starting point, and WordPress was built as a fork of that code base by developers Matt Mullenweg and Mike Little. WordPress first appeared in 2003 and was also built on the MySQL open source database for persisting content with PHP as the development platform. Valdrighi remains a contributor to the project, which is thriving as it has a growing and interested community of users and developers.

As with other systems written in PHP, it is self-contained in the sense that installation, configuration, operation, and administration tasks are all contained in PHP modules. WordPress’s popularity has been driven in part by its simplicity, with the phrase “five-minute installation” making appearances in nearly every description or book about WordPress. Beyond getting to a first post, WordPress was designed to be extended and adaptable to the different needs of different people.

WordPress today is supported by a handful of core developers and many key contributors. Mike Little runs the WordPress specialty shop zed1.com and he contributes the occasional patch to the code. Matt Mullenweg’s company, Automattic, continues to operate the wordpress.com hosting service as well as fund development of related content and site management tools, including Akismet, multi-site WordPress, Gravatar, and most recently plugins such as JetPack. Akismet is a robust, Automattic-hosted spam detection and protection service with a statistically (and incredibly) low failure-to-detect rate. Previously known as WordPress MU, multi-site WordPress functions are at the heart of the wordpress.com hosting system and are now merged into the main WordPress source tree. Gravatar dynamically serves images tied to e-mail addresses, providing a hosted icon with a variety of display options. Think of it as a service to make hot-linking your profile picture technically and socially acceptable. JetPack is a multifunction plugin offering a vast array of common needs for the website owner. The JetPack plugin is covered further in Chapter 16.

As a content management system, the WordPress system definition does not stop at time-serialized posts with comments. BuddyPress is a set of themes and plugins that extends WordPress into a functional social networking platform, allowing registered users to message and interact with each other, again with all content managed within the WordPress framework. Similarly, bbPress is a PHP- and MySQL-based system designed for forums (bulletin boards) that is distinct from WordPress but is commonly integrated with it.

Chapter 16 covers some of the WordPress adjunct systems in more detail, but they are included here to provide a sense of how WordPress has expanded beyond a basic single-user–oriented tool. At the same time, we are not endorsing or making a commercial for Automattic, but delving into the guts of WordPress without a spin of the propeller hat toward Mullenweg and Little is somewhere between incorrigible and bad community behavior.

POPULARITY OF WORDPRESS

This book is based on the WordPress 4.1 major release, but really focuses on foundational WordPress tactics. Each successive release of WordPress has included improvements in the administration and control functions (Dashboard); backup, export, and import functions; and installation and upgrade features. Even if you start with a slightly down-rev version of WordPress, you will be able to bring it up to the current release and maintain the freshness of your install. Install and upgrade paths are touched on later in this chapter. But just how popular is WordPress?

Current State

Interest in WordPress and WordPress usage is booming. You’re holding in your hands a testament to that. Just four years ago, very few WordPress books were available. Now this third edition has been published. “Popular” is always a subjective metric, but statistics add some weight to those perceptions. According to Automattic, as of 2014, tens of thousands of new WordPress sites are created every day (http://en.wordpress.com/stats/) not including standalone self-hosted WordPress sites. That includes sites using WordPress for content management, blogging, and personal rants, and has to be discounted by those of you who have multiple WordPress installations to their names, but even with that estimate of the order of magnitude, WordPress is immensely popular. Automattic no longer discloses how many sites they host on WordPress.com, but in 2012 they reported nearly 74 million WordPress websites globally with about half of them hosted at WordPress.com, and in 2010 that number was at only 5 million sites. In 2008, the official WordPress plugin repository hosted over 6,300 plugins, double the number from 2007. In 2012, the second edition of this book cited 19,000 plugins in the repository, and at the time of this writing, the number of plugins is nearing 32,000 (http://wordpress.org/plugins/). Since the last publication of this book, the community has contributed over 1,000 unique themes to the official WordPress theme repository, which now has more than 2,500 listed. This does not include all the commercial theme vendors and independent developers creating their own custom themes.

The combinations of plugins and themes require scientific notation to represent in complexity, but at the same time, they are all equally simple to locate, integrate, and use. That’s the result of a solid architecture and an equally solid community using it. In short, the ecosystem surrounding WordPress is alive and thriving—even booming.

Today, WordPress powers many large media companies’ websites or portions thereof, including CNN’s blogs, the Wall Street Journal’s All Things D, Reuters, and Forbes. Fortune 500 companies such as GM, UPS, and Sony use WordPress. WordPress is a viable choice for a range of users, from international conglomerates to major recording artists to huge media publishing companies. Some need reassurance before choosing WordPress and focus on which big boys are using it; you can find a list online at the WordPress Notable Users showcase (http://en.wordpress.com/notable-users/).

But the simplicity, ease of use, and ultimately the power of the plugins and themes also makes WordPress suitable for your mom’s family information website, your local elementary school teacher’s classroom newsletter, and the hobbyist. These are truly some of the WordPress success stories of today and these widely accessible, more narrowly popular websites are what makes WordPress popular. WordPress is adaptable and will be as simple or complex as you need it to be. Empowering “lower tech” users to be web publishers and then spreading the word (pun intended) to their families and friends about how easy WordPress is to use have fueled this explosive growth and adoption.

Where do you get started? Wordpress.org is the home for the current released and in-development versions of the code. Click through to wordpress.org for a starting point in finding plugins, themes, and wish lists of ideas and features to be implemented.

Wordpress.com has both free and paid hosting services. Over at www.wordpress.org/hosting you will find a list of hosting providers that support WordPress and often include some additional first-time installation and configuration support in their packaging of the code for delivery as part of their hosting services. You will also find concentrated WordPress hosting providers that strictly host WordPress sites and offer additional specialization features and options.

Intersecting the Community

WordPress thrives and grows based on community contributions in addition to sheer usage. Like high school gym class, participation is the name of the game, and several semi-formal avenues along which to channel your efforts and energies are available.

WordCamp events are community-hosted and locally operated, and now happen in dozens of cities around the world. Official WordCamps are listed on wordcamp.org, but you will do just as well to search for a WordCamp event in a major city close to you. WordCamps occur nearly every weekend with bloggers, photographers, writers, editors, developers, and designers of all experience and skill levels counted among their attendees. WordCamps are a low-cost introduction to the local community and often a good opportunity to meet WordPress celebrities. Visit www.wordcamp.org to find the next WordCamp.

Less structured but more frequently convened than WordCamps are WordPress Meetups, comprising local users and developers in nearly 400 (up from the 200 mentioned in the second edition of this book, and 40 in the first) cities. You’ll need a meetup.com account, but once you’re registered, you can check on locations and timetables at www.wordpress.meetup.com to see when and where people are talking about content management.

A rich, multi-language documentation repository is hosted at www.codex.wordpress.org. The WordPress Codex, with all due respect to the term reserved for ancient handwritten manuscripts, represents the community-contributed tips and tricks for every facet of WordPress, from installation to debugging. If you feel the urge to contribute to the WordPress documentation, register and then write to your heart’s content in the WordPress Codex. We hope that you will find this book a cross between a companion and a travel guide to the Codex.

Finally, mailing lists (and their archives) exist for various WordPress contributors and communities. A current roster is available online at www.codex.wordpress.org/Mailing_Lists; of particular interest may be the wp-docs list for Codex contributors and the wp-hackers list for those who work on the WordPress core and steer its future directions.

WordPress and the GPL

WordPress is licensed under the Gnu Public License (GPL) version 2, contained in the license.txt file that you’ll find in the top-level code distribution. Most people do not read the license and simply understand that WordPress is an open source project; however, pockets of corporate legal departments still worry about the viral component of a GPL license and its implications for additional code or content that gets added to, used with, or layered on top of the original distribution. Much of this confusion stems from liberal use of the words “free” and “copyright” in contexts where they are inappropriately applied.

The authors of this book are not lawyers—nor do they play them on the Internet or on television—and if you really want to understand the nuances of copyright law and what constitutes a “conveyance” of code, pick up some of Lawrence Lessig’s or Cory Doctorow’s work in those areas. This section is included to minimize the concerns of IT departments who may be dissuaded from using WordPress as an enterprise content management system by overly zealous legal teams. Do not let this happen to you; again, if WordPress is acceptable to CNN and the Wall Street Journal, two companies that survive on the copyrights granted to their content, it probably fits within the legal strictures of most corporate users as well.

The core tenet of the GPL ensures that you can always get the source code for any distribution of GPL-licensed software. If a company modifies a GPL-licensed software package and then redistributes that newer version, it has to make the source code available as well. This is the “viral” nature of GPL at work; its goal is to make sure that access to the software and its derivatives is never reduced in scope. If you plan on modifying the WordPress core and then distributing that code, you will need to make sure your changes are covered by the GPL and that the code is available in source code form. Given that WordPress is written in PHP, an interpreted language, distributing the software and distributing the source code are effectively the same action.

Following are some common misperceptions and associated explanations about using WordPress in commercial situations.

“Free software” means you cannot commercialize its use.

You can charge people to use your installation of WordPress, or make money from advertisements running in your website, or use a WordPress content management platform as the foundation of an online store. That is how

wordpress.com

works; it also enables Google to charge advertisers for using their Linux-based services. You can find professional quality WordPress themes with non-trivial price tags, or you can pay a hosting provider hundreds or even thousands of dollars a year to run your MySQL, PHP, Apache, and WordPress software stack; both involve commercialization of WordPress.

If you customize the code to handle your own {content types, security policies, or obscure navigational requirements} you will have to publish those changes.

You are only required to make the source code available for software that you distribute. If you choose to make those changes inside your company, you do not have to redistribute them. On the other hand, if you’ve made some improvements to the WordPress core, the entire community would benefit from them. Getting more staid employers to understand the value of community contribution and relax copyright and employee contribution rules is sometimes a bit challenging, but the fact that you had a solid starting point is proof that other employers made precisely that set of choices on behalf of the greater WordPress community.

The GPL will “infect” content that you put into WordPress.

Content—including graphic elements of themes, posts, and pages managed by WordPress—is separated out from the WordPress core. It is managed by the software, but not a derivative of or part of the software. Themes, however, are a derivative of the WordPress code and therefore also fall under the GPL, requiring you to make the source code for the theme available. Note that you can still charge for the theme if you want to make it commercially available. Again, the key point here is that you make the source code available to anyone who uses the software. If you are going to charge for the use of a theme, you need to make the source code available under the GPL as well, but as pointed out previously, users installing the theme effectively get the source code.

More important than a WordPress history lesson and licensing examination are the issues of what you can do with WordPress and why you would want to enjoy its robustness. The next section looks at WordPress as a full-fledged content management system, rather than simply a blog editing tool.

CONTENT AND CONVERSATION

Multiple linear feet of shelves in bookstores are filled with volumes that will improve your writing voice, literary style, blogging techniques, and other aspects of your content creation abilities. One of the goals of this book is to define the visual, stylistic, and context management mechanisms you can build with WordPress to shape vibrant user communities around your content. That context stimulates conversation with your readers. Publishing is not just about the words in each post, or even if you are an interesting writer. How will people find you? How will you stand out in the crowd? How do you put your own imprint on your site, and personalize it for whatever purpose: personal, enterprise, community, or commercial?

WordPress as a Content Management System

Blogging systems have their roots in simple content management operations: Create a post, persist it in stable storage such as a filesystem or database, and display the formatted output based on some set of temporal or keyword criteria. As the richness and types of content presented in blog pages expanded, and the requirements for sorting, searching, selecting, and presenting content grew to include metadata and content taxonomies, the line between vanilla, single-user-targeted blogging software and enterprise-grade content management systems blurred.

Content management systems (CMS) handle the creation, storage, retrieval, description or annotation, and publication or display of a variety of content types. CMS also covers workflow tasks, typically from an editorial or publishing perspective, and includes actions such as approval and marking content for additional editing or review. The WordPress Dashboard provides those elements of workflow management and editorial control. WordPress is not the only open source content management system in widespread use today; the Drupal and Joomla projects are equally popular choices. Drupal and Joomla start from the perspective of managing content repositories; they handle a variety of content types, multiple authors in multiple roles, and delivering the content to a consumer that requests it. WordPress is at its heart a publishing system, and the end focus is on displaying content to a reader. Although areas of functional overlap exist, you can integrate WordPress with other content management systems, a process covered in detail in Chapter 15.

WordPress has established itself as a bona fide content management system through its design for extensibility and the separation of content persistence from content display. Taking some liberties with the Model-View-Controller design pattern, WordPress separates the MySQL persistence layer as a data model, the theme-driven user interface and display functions, and the plugin architecture that interposes functionality into the data to presentation flow. Most important, WordPress stores content in raw form, as input by the user or an application posting through the WordPress APIs. Content is not formatted, run through templates, or laid out until the page is rendered, yielding immense power to the functions that generate the actual HTML. At the same time, the data model used by WordPress uses a rich set of tables to manage categories (taxonomies), content tags (folksonomies), author information, comments, and other pieces of cross-reference value. The WordPress database schema that makes this possible is explored in Chapter 6.

Although that design gives WordPress incredible power and flexibility as a content management system, it also requires knowledge of how those data persistence and control flows are related. (It was a search for such a dissection of WordPress in functional terms that got us together to write this book.)

Creating Conversation

Conversation is king; content is just something to talk about.

—Cory Doctorow

A robust CMS is measured by the utility of its content. Even the richest content types and most well-managed processes are of low return if nobody actually consumes the outputs. It is not sufficient to install blogging software, write a few posts, and hope the world shows up on your virtual doorstep; you need to create what Tim O’Reilly calls an “architecture of participation.” Social networking, advertising, feeds, and taking steps to ensure your site shows up in search engine results will drive readers to your site; the design, branding, and graphic elements coupled with the quality of your content will encourage them to take the steps toward active participation.

Look at the problem from the perspective of a reader: In a world of tens of millions of websites (many of which have a “first post” and not much else), how will you be found, heard, and echoed? Your Twitter followers should want to read your site, and your WordPress site can update your Twitter feed. Conversely, your Twitter updates may appear in your WordPress sidebar, marrying the ultra-short content timeline to the more thoughtful one. If you are active on Facebook, you can import entries into a public figure page and Facebook readership will drive traffic back to your website. If you cover specific, detailed, or arcane areas in your writing, Google searches for those terms should direct readers to you, where they will join the conversation. Chapter 12 looks at how your WordPress content can be more broadly distributed.

GETTING STARTED

Before any serious work on presentation, style, or content begins, you need a home for your website (despite the previous discussion about WordPress and content management systems, we will refer to your website and the actual WordPress installation that implements it interchangeably, mostly for convenience and brevity). Factors affecting your choice include:

Cost

—Free hosting services limit your options as a developer and frequently preclude you from generating money from advertising services. More expensive offerings may include better support, higher storage or bandwidth limits, or multiple database instances for additional applications.

Control

—What tools are provided for you to manage your MySQL database, files comprising the WordPress installation, and other content types? If you want to be able to muck around at the SQL level, or manage MySQL through a command-line interface, you should ensure your hosting provider supports those interfaces.

Complexity

—You can install the Apache or nginx web server with a PHP interpreter, MySQL, and the WordPress distribution yourself, but most hosting providers have wrapped up the installation process so that some of the rough edges are hidden from view. If you expect to need technical support on the underlying operating system platform, find a provider (including your own IT department) that provides that support in a reasonable time frame.

This section takes a quick look at some hosting options, walks you through the basics of a do-it-yourself installation, and concludes with an overview of the ways in which WordPress and MySQL choose to ignore each other when installation goes into the weeds.

Hosting Options

Three broad categories of WordPress hosting exist, each with trade-offs between administrative complexity and depth of control. The easiest and most popular is to use wordpress.com, a free hosting service run by Automattic using the multi-site version of WordPress (originally WordPress MU). You can install themes and plugins through the Dashboard but you can only enable or disable the choices that come preinstalled. Further, you will not have access to the underlying MySQL databases and core code, or be able to integrate WordPress with other systems. You can redirect one of your own URLs to wordpress.com, but if you want full control over everything from the code to the URLs used, you are probably looking at a paid option. The free route may be a reasonable first step for you, but for this book it is assumed that you are going to want to perform surgery on your installation.

You will find a starter list of for-fee hosting providers on www.wordpress.org, including the paid option on wordpress.com. Most have the latest, or close to latest, releases of the WordPress core available as a package to be installed in conjunction with MySQL and a web server. The third hosting option is to install everything on servers that you own and operate. If your servers live in a hosting facility but you enjoy root administrative access that is equivalent to a do-it-yourself installation. These are all options for putting your WordPress installation on the public Internet. If you are just looking to explore, Chapter 3 covers running WordPress locally for development.

WordPress requires a web server with PHP support, a URL rewriting facility, and an instance of MySQL. Apache is the most popular option for front-ending WordPress because it provides PHP interpretation through mod_php and URL rewriting in mod_rewrite. There is growing interest in lighttpd (Lighty) and nginx as replacements for Apache. Finally, you can use Microsoft’s IIS 7.0 as a web server with its URL_rewrite module. The emphasis on URL rewriting stems from WordPress’s support for “pretty” permalinks to content entries, allowing you to create a URL tree organized by date, category, tag, or other metadata. Those mnemonic, or human-readable, URLs are converted into MySQL database queries to extract the right WordPress content based on titles or other keywords as part of the WordPress main loop, which is covered in detail in Chapter 5. Your web server decides whether the URL should be parsed by WordPress or if it refers to a specific HTML file based on what is in the .htaccess file, and the URL rewriting rules ensure that its contents are interpreted properly. Technically, URL rewriting is not required to install WordPress, but it is good to have because it gives you tremendous flexibility in the presentation and naming conventions used for your content’s URLs. Permalink design and practices are covered in more detail in Chapter 2, but keep the requirement in mind as you select your WordPress substrate.

Up to this point, MySQL has been mentioned only in passing, but a brief review of MySQL requirements rounds out the hosting prerequisite list. It is worth establishing some terminology and distinguishing between the MySQL software, database instances, and WordPress instances using MySQL. When you install and configure MySQL, you have a full-fledged relational database system up and running. It does not have to be configured on the same machine as your web server, and some hosting providers will create horizontally scalable MySQL “farms” in parallel to their web server front ends. An instance of MySQL running on a server can support multiple databases, each with a unique name. When you install WordPress, you will need to know the name of the MySQL database reserved for your content, although this information may be auto-generated and configured for you if you are using a provider that supports WordPress and MySQL as an integrated package. WordPress creates a number of relational data tables in that named database for each website that you create.

Confusion can result from nomenclature and complexity. You (or your hosting provider) may run multiple MySQL instances on multiple servers, and you will need to know where your database is hosted. Because each instance of MySQL can run multiple databases, and each database contains groups of tables, it is possible, even common, to run multiple MySQL-based applications on the same hosting platform, using one MySQL instance or even one MySQL database.

If you want to have multiple WordPress sites on the same server, you can share a single MySQL database instance for all of them provided you configure WordPress to distinguish the MySQL database table names within the MySQL database. It is a simple configuration option that is covered in the next section, and it highlights the distinction between multiple sets of tables in a database and multiple databases for distinct applications.

Once you have secured the necessary foundation, it is time to get the code up and running. Even if you are using a hosting provider that installs MySQL and WordPress for you, it is worth knowing how the server-side components interact in case you need to track down a problem when you’re deep in plugin development.

Do It Yourself Installation

The famous, fabled, fabulous five-minute WordPress installation is a reality when everything is configured and coordinated properly. This section walks you through the steps that are often hidden from view when you use a provider with packaged installs, and highlights some of the common misfires between WordPress and MySQL instances.

The installation process is quite simple (assuming that your web server and MySQL server are already running): Download the WordPress package and install it in your web server’s directory tree, and then navigate to your top-level URL and complete the configuration. One (compound) sentence describes it completely.

It is possible and even advisable to install a fully functioning WordPress instance on your laptop or development machine, particularly if you are going to be working on the core, developing plugins, or otherwise making changes that would create embarrassing failures during testing on a public website. Mac OS X comes with an Apache web server (with PHP and URL rewriting); download MySQL from www.mysql.com, or use a prepackaged configuration such as MAMP (www.mamp.info, which includes the phpMyAdmin tool), and you will have a self-contained development and deployment lab. For other platforms, XAMPP (www.apachefriends.org) has a neatly integrated platform stack that runs on Windows, Mac OS, and Linux foundations. Furthermore, the use of virtual machines for your development environment has grown immensely, and now there are packaged VM solutions to get you started. Having everything under one hood is a powerful option for examining failure modes, as you will see in the next two sections. More information on working with WordPress locally is covered in Chapter 3.

Installing WordPress Files

If you download the WordPress code from wordpress.org, you will get a zip (or tarball) archive that expands into a directory called wordpress. The first part of a WordPress installation is to get the code into your web server’s directory structure; ensuring you have it in the right place is a critical step. Gloss over this part and you will find your website ends up with a URL like http://example.com/wordpress and you will either have to start over or e-mail ugly URLs to your friends and family. If that is what you want—to distinguish your WordPress site from other content on your website or to isolate multiple sections—choosing the filesystem layout is equally important.

Pick the top-level directory where you want to install WordPress. Most commonly, this is the root directory for your web server, and if you are using a hosting provider it is probably the subdirectory called public_html in the file tree. If you are using a packaged install where there is a menu asking you for the target location, make sure you pick this top-level directory (and yes, you know that it already exists, that’s the point!); if you are copying files from your local machine to the web server target using an FTP client, make sure you pick the right destination. The somewhat obvious move to copy the zip file to the server and then unpack it will put everything into a wordpress subdirectory, and if you want your WordPress site’s URL to be http://example.com rather than http://example.com/wordpress, move the files up one directory level before proceeding. There is a configuration option to have your WordPress installation in a subdirectory to your top-level URL, so it is not fatal if you drop WordPress into a less-than-desirable filesystem geography. That is covered at the end of this section.