Book Image

WordPress 2.8 Theme Design

Book Image

WordPress 2.8 Theme Design

Overview of this book

Themes are among the most powerful features that can be used to customize a web site, especially in WordPress. Using custom themes you can brand your site for a particular corporate image, ensure standards compliance, and create easily navigable layouts. But most WordPress users still continue to use default themes as developing and deploying themes that are flexible and easily maintainable is not always straightforward. It's easy to create powerful and professional themes for your WordPress web site when you've got this book to hand. It provides clear, step-by-step instructions to create a robust and flexible WordPress theme, along with best practices for theme development. It will take you through the ins and outs of creating sophisticated professional themes for the WordPress personal publishing platform. It reviews the best practices from development tools and setting up your WordPress sandbox, through design tips and suggestions, to setting up your theme's template structure, coding markup, testing and debugging, to taking it live. The last three chapters are dedicated to additional tips, tricks, and various cookbook recipes for adding popular site enhancements to your WordPress theme designs using third-party plugins. Whether you're working with a pre-existing theme or creating a new one from the ground up, WordPress Theme Design will give you the know-how to understand how themes work within the WordPress blog system, enabling you to take full control over your site's design and branding.
Table of Contents (15 chapters)
WordPress 2.8 Theme Design
Credits
About the Author
About the Reviewer
Preface
Index

Preface

This book will take you through the ins and outs of creating sophisticated, professional themes for the WordPress personal publishing platform. It will walk you through clear, step-by-step instructions to build a custom WordPress theme. This book reviews best practices in development tools and setting up your WordPress sandbox, through design tips and suggestions, to setting up your theme's template structure, coding markup, testing and debugging, to taking it live. The last three chapters are dedicated to additional tips and tricks for adding popular site enhancements to your WordPress theme designs using third-party plugins.

The WordPress publishing platform has excellent online documentation, which can be found at http://codex.wordpress.org. This title does not try to replace or duplicate that documentation, but is intended as a companion to it.

My hope is to save you some time finding relevant information on how to create and modify themes in the extensive WordPress codex, help you understand how WordPress themes work, and show you how to design and build rich, in-depth WordPress themes yourself. Throughout the book, wherever applicable, I'll point you to the relevant WordPress codex documentation along with many other useful book references, online articles, and sites.

I've attempted to create a realistic WordPress theme example that anyone can take the basic concepts from and apply to a standard blog, while at the same time, show how flexible WordPress and its theme capabilities are. I hope this book's theme example shows that WordPress can be used to create unique websites that one wouldn't think of as "just another blog".

Whether you're working with a preexisting theme or creating a new one from the ground up, this title will give you the know-how to understand how themes work within the WordPress blog system, enabling you to take full control over your site's design and branding.

I'd like to thank those of you in the WordPress community who took the time to read the first edition of this book and e-mailed me your comments along with posting your book reviews. This is your book.

What this book covers

Chapter 1: Getting Started as a WordPress Theme Designer introduces you to the WordPress blog system and lets you know what you need to be aware of regarding the WordPress theme project you're ready to embark on. The chapter also covers the development tools that are recommended and web skills that you'll need to begin developing a WordPress theme.

Chapter 2: Theme Design and Approach looks at the essential elements you need to consider when planning your WordPress theme design. It discusses the best tools and processes for making your theme design a reality. The chapter explains some "rapid design comping" techniques and gives some tips and tricks for developing color schemes and graphic styles for your WordPress theme. By the end of the chapter, you'll have a working XHTML and CSS-based "comp" or mockup of your theme design, ready to be coded up and assembled into a fully functional WordPress theme.

Chapter 3: Coding It Up uses the final XHTML and CSS mockup from Chapter 2 and shows you how to add WordPress PHP template tag code to it and break it down into the template pages a theme requires. Along the way, this chapter covers the essentials of what makes a WordPress theme work and how to enable your theme to take advantage of new WordPress 2.8 features such as sticky posts and threaded comments. At the end of the chapter, you'll have a basic, working WordPress theme.

Chapter 4: Debugging and Validation discusses the basic techniques of debugging and validation that you should employ throughout your theme's development. It covers the W3C's XHTML and CSS validation services, along with how to use the Firefox browser and some of its extensions as a development tool, and not as just another browser. This chapter also covers troubleshooting some of the most common reasons "good code goes bad", especially in IE, along with best practices for fixing those problems, giving you a great-looking theme across all browsers and platforms.

Chapter 5: Putting Your Theme into Action discusses how to properly set up your WordPress theme's CSS stylesheet so that it loads into WordPress installations correctly. It also discusses compressing your theme files into the ZIP file format to share with the world and running some test installations of your theme in WordPress' Administration panel so that you can share your WordPress theme with the world.

Chapter 6: WordPress Template Tag, Function, and CSS Reference covers key information under easy-to-look-up headers that will help you with your WordPress theme development—from the CSS class styles that WordPress itself outputs, to WordPress' PHP template tags and plugin hooks, to a breakdown of "The Loop" along with additional WordPress functions and features such as shortcodes that you can take advantage of in your theme development. Information in this chapter is listed along with key links to bookmark, in order to make your theme development as easy as possible.

Chapter 7: Ajax/Dynamic content and Interactive Forms continues showing you how to enhance your WordPress theme by looking at the most popular methods for leveraging AJAX techniques in WordPress using plugins and widgets. It also gives you a complete background on AJAX and when it's best to use those techniques or skip them. The chapter also reviews some cool JavaScript toolkits, libraries, and scripts you can use to simply make your WordPress theme appear "Ajaxy".

Chapter 8: Dynamic Menus and Interactive Elements dives into taking your working, debugged, validated, and properly packaged WordPress theme from the earlier chapters, and enhancing it with dynamic menus using the SuckerFish CSS-based method and Adobe Flash media.

Chapter 9: Design Tips for Working with WordPress reviews the main tips from the previous chapters and covers some key tips for easily implementing today's coolest CSS tricks into your theme, as well as a few final SEO tips that you'll probably run into once you really start putting content into your WordPress site.

What you need for this book

Essentially, you'll need a code editor, the latest Firefox browser, and any other web browser you would like your theme to be displayed in. Most importantly, you'll need an installation of the latest, stable version of WordPress.

WordPress 2.7+ and 2.8+ require the following to be installed:

  • PHP version 4.3 or greater

  • MySQL version 4.0 or greater

For more information on WordPress 2.8's requirements, browse to http://wordpress.org/about/requirements/.

You'll also need a code editor and an image editor such as GIMP, Photoshop, Fireworks, or Corel Paint (or any graphic editor you prefer really). This book covers samples using Photoshop and some samples in GIMP.

Who this book is for

This book can be used by WordPress users or visual designers (with no server-side scripting or programming experience) who are used to working with the common industry-standard tools such as Photoshop and Dreamweaver, or other popular graphic, HTML, and text editors.

Regardless of your web development skill set or level, you'll be walked through the clear, step-by-step instructions, but familiarity with a broad range of web development skills and WordPress know-how will allow you to gain maximum benefit from this book.

Conventions

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: "You have to add it to your theme's header.php or files that contain the header tags "

A block of code is set as follows (Code and markup preceded and ended with ellipses "..." are extracted from the full context of code and/or a larger body of code and markup. Please reference the downloadable code packet to see the entire work.):

... 
#container { 
   font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
} 
...

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:

<form method="get" id="searchform" action="http://yourdevurl.com/">
<div><input value="" name="s" id="s" type="text">
<input id="searchsubmit" value="Search" type="submit">
</div>
</form>

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "The best way to proceed with the Error Console is to first hit Clear and then reload your page to be sure that you're looking only at current bugs and issues for that specific page ".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to , and mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Tip

Downloading the example code for the book

Visit http://www.packtpub.com/files/code/0080_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or 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 to 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 let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

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 with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

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