WordPress 2.8 Themes Cookbook

Over 100 simple but incredibly effective recipes for creating powerful, custom WordPress themes

WordPress 2.8 Themes Cookbook

Cookbook
Nick Ohrn, Lee Jordan

Over 100 simple but incredibly effective recipes for creating powerful, custom WordPress themes
$23.99
$36.00
RRP $23.99
RRP $39.99
eBook
Print + eBook
$12.99 p/month

Want this title & more? Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.
+ Collection
Free sample

Book Details

ISBN 139781847198440
Paperback312 pages

About This Book

  • Take control of the look and feel of your WordPress site
  • Quick recipes to get started and successfully build advanced themes
  • Step-by-step instructions and useful screenshots for easy learning
  • Give a professional look to your web site with popular JavaScript libraries

Who This Book Is For

This book is for WordPress developers who want to create powerful themes for their blogs and web sites to impress and influence visitors.

This book expects working knowledge of the WordPress platform. Knowledge of HTML and CSS would also be useful.

Table of Contents

Chapter 1: WordPress Theme Basics
Introduction
Finding documentation on WordPress.org
Downloading themes from the WordPress theme repository
Downloading themes from third-party websites
Installing and activating a theme
Displaying the blog name
Getting the absolute directory path of the active theme
Creating a theme from scratch
Creating a child theme
Creating a theme by using a theme framework
Adding expected WordPress hooks
Including PHP files from your theme
Chapter 2: Creating Navigation
Introduction
Listing all of the pages that exist on a blog
Listing all of the categories defined for a blog
Listing all of the tags in use on a blog
Highlighting the current page in the navigation
Adding a search function to a theme
Getting the category page link from a category name
Displaying page links only if the destination page exists
Creating a category drop-down menu
Creating drop-downs using child pages
Chapter 3: The Loop
Introduction
Creating a basic Loop
Displaying ads after every third post
Removing posts in a particular category
Removing posts with a particular tag
Highlighting sticky posts
Creating multiple loops in a single template
Displaying only posts in a particular category
Styling every other post differently
Styling posts in a particular category differently
Showing every post in a category on a category archive page
Chapter 4: Template Tags
Introduction
Displaying the post title
Automatically limiting the number of words of content
Determining if the user is on a specific page
Determining if the user is viewing a post in a particular category
Displaying the post date for each post
Highlighting search terms in post content
Displaying login/logout links
Adding navigation through older/newer posts
Displaying an edit link for posts
Displaying custom field content
Displaying a post author's avatar
Chapter 5: Comments
Introduction
Displaying a comment form on a post
Displaying comments on a post
Displaying the latest comments on your blog
Highlighting the post author's comments
Alternating the style for comments
Displaying threaded comments properly
Chapter 6: Sidebars
Introduction
Using the Text widget for custom sidebar content
Including a dynamic sidebar in your theme
Including multiple dynamic sidebars in your theme
Setting the default widgets for a sidebar in your theme
Positioning multiple sidebars in your theme by using CSS
Styling the appearance of sidebars in your theme by using CSS
Displaying different widgets on different
Showing asides in the sidebar by using the Miniposts plugin
Adding an interactive Facebook-style wall to a sidebar by using jQuery
Chapter 7: Custom Page Templates
Introduction
Creating a simple page template
Creating an archives page template
Creating a taxonomy navigation template
Displaying author avatars and descriptions
Creating a table of contents page template
Showing your pictures from Flickr
Displaying a special template for a specific category
Chapter 8: Integrating Media
Introduction
Aligning images properly within a post
Styling image galleries
Styling image captions
Creating a media template
Creating a media template for a specific media type
Displaying a related image for every post
Creating video posts by using the Viper's Video QuickTags plug-in
Chapter 9: Showing Author Information
Introduction
Getting author data via an author's ID
Dynamically displaying the author's name and linked e-mail address
Listing all of the published authors on a site
Listing the authors who most recently published a post
Listing authors by the total number of comments that their posts have received
Adding a custom user field to display an author's Twitter link
Chapter 10: Adding JavaScript Effects
Introduction
Linking to your theme's JavaScript files directly
Adding JavaScript files to your theme programmatically
Adding a bundled library to your theme programmatically
Creating a featured post slider
Making sidebar widgets toggle-able
Adding a font size toggle
Chapter 11: Advanced WordPress Themes
Introduction
Adding a theme options page
Allowing for multiple theme color schemes
Changing the default Gravatar icon for your theme
Registering shortcodes for your theme
Localizing your theme
Displaying information based on the logged-in user's role
Packaging your theme for distribution
Uploading your theme to the WordPress.org theme repository
Chapter 12: Layout
Introduction
Adding a skip navigation link for usability
Centering your site's layout in the browser window
Setting up a randomly-rotating header image
Making theme components drag-and-drop
Creating a global toolbar for your theme
Creating tabbed navigation for your theme

What You Will Learn

  • Enhance your page templates, optimize the use of images, and add effects to them
  • List your pages, categories, and tags on a blog and create navigation
  • Stylize your posts to make them look interesting
  • Display, format, and tweak the comment system to attract the visitors
  • Add sophistication to your dynamic web site using popular JavaScript libraries
  • Package and distribute your theme using the WordPress.org theme repository
  • Display auxiliary information about the post being displayed using dynamic sidebars
  • Empower your end users to change the contents displayed in the theme's sidebar without involving a programmer
  • Change the style of your theme depending upon image content and time

In Detail

Themes are among the most powerful features that can be used to customize a web site and give it a professional look, 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 and lot of issues pop up during the process.

This easy-to-use step-by-step guide will help you create powerful themes for your WordPress web site, and solve your theme development problems in a quick and effective way. It enables you to take full control over your site's design and branding and make it look smarter.

WordPress is distributed with two ready-to-use themes. You can use these themes to give a common look to your website, or use the techniques described in this book to create custom themes. This book includes over 100 useful recipes to help you get started and create advanced themes. It starts with the basics of WordPress themes and creating a theme from scratch. Then, it covers how to enhance your template and add effects to get a rich look. You will learn how to manage pages, categories, and tags for your blogs, and how to make your posts look unique. You will also learn about the comment system and sidebars that will help you give a new feel to your blog and web site.

This book will help you through the most common problems encountered when developing a WordPress theme. You will get tips to enhance your design skill and eventually enhance your blog's design.

Authors

Table of Contents

Chapter 1: WordPress Theme Basics
Introduction
Finding documentation on WordPress.org
Downloading themes from the WordPress theme repository
Downloading themes from third-party websites
Installing and activating a theme
Displaying the blog name
Getting the absolute directory path of the active theme
Creating a theme from scratch
Creating a child theme
Creating a theme by using a theme framework
Adding expected WordPress hooks
Including PHP files from your theme
Chapter 2: Creating Navigation
Introduction
Listing all of the pages that exist on a blog
Listing all of the categories defined for a blog
Listing all of the tags in use on a blog
Highlighting the current page in the navigation
Adding a search function to a theme
Getting the category page link from a category name
Displaying page links only if the destination page exists
Creating a category drop-down menu
Creating drop-downs using child pages
Chapter 3: The Loop
Introduction
Creating a basic Loop
Displaying ads after every third post
Removing posts in a particular category
Removing posts with a particular tag
Highlighting sticky posts
Creating multiple loops in a single template
Displaying only posts in a particular category
Styling every other post differently
Styling posts in a particular category differently
Showing every post in a category on a category archive page
Chapter 4: Template Tags
Introduction
Displaying the post title
Automatically limiting the number of words of content
Determining if the user is on a specific page
Determining if the user is viewing a post in a particular category
Displaying the post date for each post
Highlighting search terms in post content
Displaying login/logout links
Adding navigation through older/newer posts
Displaying an edit link for posts
Displaying custom field content
Displaying a post author's avatar
Chapter 5: Comments
Introduction
Displaying a comment form on a post
Displaying comments on a post
Displaying the latest comments on your blog
Highlighting the post author's comments
Alternating the style for comments
Displaying threaded comments properly
Chapter 6: Sidebars
Introduction
Using the Text widget for custom sidebar content
Including a dynamic sidebar in your theme
Including multiple dynamic sidebars in your theme
Setting the default widgets for a sidebar in your theme
Positioning multiple sidebars in your theme by using CSS
Styling the appearance of sidebars in your theme by using CSS
Displaying different widgets on different
Showing asides in the sidebar by using the Miniposts plugin
Adding an interactive Facebook-style wall to a sidebar by using jQuery
Chapter 7: Custom Page Templates
Introduction
Creating a simple page template
Creating an archives page template
Creating a taxonomy navigation template
Displaying author avatars and descriptions
Creating a table of contents page template
Showing your pictures from Flickr
Displaying a special template for a specific category
Chapter 8: Integrating Media
Introduction
Aligning images properly within a post
Styling image galleries
Styling image captions
Creating a media template
Creating a media template for a specific media type
Displaying a related image for every post
Creating video posts by using the Viper's Video QuickTags plug-in
Chapter 9: Showing Author Information
Introduction
Getting author data via an author's ID
Dynamically displaying the author's name and linked e-mail address
Listing all of the published authors on a site
Listing the authors who most recently published a post
Listing authors by the total number of comments that their posts have received
Adding a custom user field to display an author's Twitter link
Chapter 10: Adding JavaScript Effects
Introduction
Linking to your theme's JavaScript files directly
Adding JavaScript files to your theme programmatically
Adding a bundled library to your theme programmatically
Creating a featured post slider
Making sidebar widgets toggle-able
Adding a font size toggle
Chapter 11: Advanced WordPress Themes
Introduction
Adding a theme options page
Allowing for multiple theme color schemes
Changing the default Gravatar icon for your theme
Registering shortcodes for your theme
Localizing your theme
Displaying information based on the logged-in user's role
Packaging your theme for distribution
Uploading your theme to the WordPress.org theme repository
Chapter 12: Layout
Introduction
Adding a skip navigation link for usability
Centering your site's layout in the browser window
Setting up a randomly-rotating header image
Making theme components drag-and-drop
Creating a global toolbar for your theme
Creating tabbed navigation for your theme

Book Details

ISBN 139781847198440
Paperback312 pages
Read More