Скачать книгу

3) or you could open an account with WordPress.com. The main thing is that you be able to practice what's covered in the book and on these videos, which can be viewed at www.wrox.com/go/wp24vids.

      Also online you'll find a PDF with links to each of the more than 400 plugins mentioned in the book. You can find the plugins under the lesson where they were mentioned. Click on a link and you'll be taken to the listing in the WordPress.org Plugin Directory.

      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 Boxes like this one hold important, not-to-be-forgotten information that is directly relevant to the surrounding text.

      NOTE Notes, tips, hints, tricks, and asides to the current discussion are presented in boxes like this.

      PLUGINS

      At the end of virtually all the lessons, you'll find a box like this with a list of plugins from the WordPress Plugin Directory related to the topics of that lesson. Commercial plugins are not covered here, with the occasional exception.

      REFERENCE Reference References like this one point you to the website at www.wrox .com/go/wp24vids to watch the instructional video that accompanies a given lesson.

      As for styles in the text:

      ● We highlight new terms and important words when we introduce them.

      ● We show URLs and code within the text like so: persistence.properties.

      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, like 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 and locate the title using the Search box or one of the title lists. Then, on the Book Search Results page, click the Errata link. On this page, you can view all errata that has been submitted for this book and posted by Wrox editors.

      NOTE Note A complete book list, including links to errata, is also available at www.wrox.com/misc-pages/booklist.shtml.

      If you don't spot “your” error on the Errata page, click the Errata Form link and complete the form 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 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 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:

      1. Go to p2p.wrox.com and click the Register link.

      2. Read the terms of use and click Agree.

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

      4. 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.

Section I

      Before You Start

      Lesson 1

      Thinking Like WordPress

      WordPress provides you with the tools to create, organize, and update your website content. Those tools function in specific ways, just as one type of word processing software has its specific buttons for creating, say, lists. But there's a difference between knowing which button to press to create a list and thinking about ways to use lists in your documents. That's what this lesson is about: learning to think like WordPress so that you can build or rebuild your website in an efficient and flexible manner from the start, and to use it in new and useful ways.

      The driving principle behind this way of thinking is: Store everything in the smallest possible piece; then assemble as needed. It's the way of the digital world – photographs assembled out of pixels, data stored in database fields, or video recorded in bytes. WordPress operates with this kind of thinking, and you can make better use of its power if you think of your website and its content in this way.

      Static Versus Dynamic Web Pages

      If you right-click while viewing a page in your web browser, you'll see a tool called View Source, which displays the HTML of the page you're currently viewing. If you try this tool, it appears as though you're viewing a single file, but for most websites today, that's an illusion. In most cases there is no corresponding file sitting on a web server. Instead, the server has combined dozens and dozens of files in a split second to create what you're seeing with View Source.

      That was not the case in the early days of the Internet, when most web pages were stored as single HTML files. The fact that no assembly was required to produce the code you see in your browser is why they are called static files. They're easy to create and they load quickly (an important factor at a time when computers and Internet speeds were slow), but they aren't flexible. Suppose you decided to change the logo at the top of each of your website's pages, and it had a new file name. With static files, you would need to manually go in and replace the HTML in every file. Not so bad on a 5-page site, but what if you had 5,000 pages? Yes, there's such a thing as search-and-replace functions in HTML editors, but aside from the fact that methods like that are not user-friendly, they solve only one limitation of static files. Suppose you wanted an entirely different header area depending on what part of your site the visitor is on?

The answer is to break up the structure of web pages in such a way that different files control different parts of the final page. So instead of storing web pages as single files, the server would store a series of files that are then assembled into a single file at the moment the page is requested by someone's browser. It is this assembly process that leads us to refer to these types of web pages as dynamic. Figure 1.1 shows one way to split up a static HTML file.

Figure 1.1

      Notice

Скачать книгу