Birmingham Mumbai

WordPress 2.7 Cookbook

Copyright © 2009 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: June 2009

Production Reference: 1190609

Published by Packt Publishing Ltd.

32 Lincoln Road

Olton

Birmingham, B27 6PA, UK. ISBN 978-1-847197-38-2

www.packtpub.com

Cover Image by Vinayak Chittar ([email protected])

Credits

Author

Jean-Baptiste Jung

Reviewers

Alan Doucette

Narayan Bhat Paul Thewlis

Acquisition Editor

David Barnes

Development Editors

Amey Kanse

Nikhil Bangera

Technical Editors

Mehul Shetty

Rakesh Shejwal

Copy Editor Leonard D'Silva

Editorial Team Leader

Akshara Aware

Project Team Leader

Lata Basantani

Project Coordinator

Joel Goveya

Proofreader

Jeff Orloff

Indexer

Monica Ajmera

Production Coordinator

Shantanu Zagade

Adline Swetha Jesuthas

Cover Work

Shantanu Zagade

About the Author

Jean-Baptiste Jung is a Web developer, Web designer, and blogger born in Paris, France and now living in Wallonia (French-speaking part of Belgium) with his wife and cat.

Jean unearthed the World Wide Web in 1998 and started creating web sites three years later. In 2006, while working as a freelance Web developer for a well known French TV channel, Jean started to work with blogs and WordPress. A few months later, he created his first blog.

He became immensely passionate about WordPress and launched a blog dedicated to WordPress hacks, http://www.wprecipes.com/, which quickly managed to become one of the most popular WP-related web sites over the Internet. Meanwhile, Jean is also an author on some prestigious blogs, such as WpHacks, ProBlogDesign, and Smashing Magazine.

When he's not blogging or tweaking web sites, Jean enjoys travelling and spending time with his wife and cat. He has a strong love for animals and always stands up to defend animal rights.

I'd like to thank my wife Emmanuelle as well as our cute cat for being here with me. They mean so much to me.

About the Reviewers

Alan Doucette is a partner of KOI (www.koitech.net), a web development company. He is passionate about PHP and Open Source software. His constantly changing blog can be found at http://alanio.net.

Thanks go to the awesome WordPress community for all their daily hard work creating great Open Source software. I would also like to thank Brandi & Jack Lee (www.pandria.com) for their support and dealing with me while I constantly put time into Open Source projects.

Narayan Bhat is an avid user of Blogger, Twitter, and other useful web applications. He is a top contributor to the Blogger Help Group with more than 50,000 posts to date. Get Blogger tips and tricks and hacks at his blog http://www.blogdoctor.me.

He has also worked on the following books:

• Blogger Beyond the Basics by Lee Jordon.

• WordPress for Business Bloggers by Paul Thewlis.

Paul Thewlis has worked as a Web communications professional in public and private sectors. He is currently E-Communications Manager for a multinational transport company based in the UK. He began his Web career as a Technical Editor, working on web design books for a well-known publisher. He has extensive experience of many Content Management Systems and blogging platforms. He is an expert in the use of social media within corporate communications, and blogs about that subject, as well as WordPress and the Web in general, at http: //blog. paulthewlis . com. He also runs the popular Twitter trivia quiz, Twrivia (http: //twrivia. com), and the email reminder service, Urge-Me (http: //urge-me. com).

Paul is the author of WordPress For Business Bloggers, published by Packt.

Table of Contents

Preface_1

Chapter 1: Getting Ready to Cook with WordPress_5

Using built-in WordPress tools 6

Managing media files with the Media Library 6

Getting ready 6

How to do it 7

Deleting media 7

Bulk media deletion 8

How it works 9

Live editing themes with the built-in Theme Editor 9

Getting ready 9

How to do it 10

How it works 10

Editing plugins with the WordPress built-in Plugin Editor 11

Getting ready 11

How to do it 12

How it works 12

Managing authors and users with the User Manager 12

Getting ready 12

How to do it 13

Deleting users 13

Editing user details 13

How it works 14

Importing and exporting content with the Import and Export tool 14

Getting ready 14

How to do it 14

Importing content 15

Exporting content 17

How it works 18

Chapter 2: Finding, Installing, and Tweaking Themes_19

Installing a theme 20

Getting ready 20

How to do it 20

Classic themes 22

Advanced themes 28

Premium themes 34

Lists of themes 40

Important notes about themes 41

Chapter 3: Get the most out of your WordPress Theme_43

Modifying your theme colors 44

Getting ready 44

How to do it 45

How it works 45

Modifying your theme fonts 46

Getting ready 46

How to do it 47

Tips and things to know about fonts 47

Creating and integrating a favicon 48

Getting ready 48

Favicon format 48

How to do it 48

How it works 49

Integrating your own logo 49

Getting ready 50

How to do it 50

How it works 51

Adding a link to the homepage 52

Adding social bookmarking buttons to your theme 52

Getting ready 52

How to do it 52

How it works 53

Using CSS to style the social bookmarking widget 53

Adding Del.icio.us live count 54

Code explanation 55

Integrating Feedburner feeds on your theme 55

How to do it 56

How it works 57

Integrating Twitter on your theme using the Twitter Tools plugin 57

Getting ready 58

How to do it 59

How it works 59

Displaying your Twitter entries on your blog, using a page template 59

Getting ready 59

How to do it 60

How it works 62

Customizing WordPress admin login page 62

Plugin versus hack 62

How to do it 63

How it works 64

Using conditional tags to display content on specific pages 64

Getting ready 64

How to do it 64

How it works? 66

Special parameters 67

Using page templates in your theme 67

Getting ready 68

How to do it 68

How it works 69

Creating an archive page 69

Getting ready 69

How to do it 69

How it works 70

Creating a custom 404 error page 71

Getting ready 71

How to do it 72

How it works 72

Using a static page as a homepage 73

Getting ready 73

How to do it 73

How it works 74

Creating a Featured Posts block on your homepage 74

Getting ready 75

How to do it 75

How it works 76

Making your new posts stands out with a custom style 76

Getting ready 77

How to do it 77

How it works 78

Chapter 4: Doing anything with Plugins and Widgets_81

Installing plugins 82

Getting ready 82

How to do it 82

How it works 83

Getting rid of comment spams with Akismet 83

Getting ready 83

How to do it 83

How it works 84

Backing up your database with WP Database Backup 84

Getting ready 84

How to do it 84

How it works 85

Scheduling automatic backups 85

How it works 85

Optimizing your blog performances with WP Super Cache 86

Getting ready 86

How to do it 86

How it works 87

Prevent URLs from being cached 87

Adding redirects for changed Permalinks 88

Getting ready 88

How to do it 88

How it works 89

Using redirects for affiliate marketing and cloaking 89

Get more comments with the Subscribe to Comments plugin 89

How to do it 89

How it works 90

Accessing real time statistics with WordPress.com Stats 90

Getting ready 91

How to do it 91

How it works 91

Monetizing your blog with ISIS Ads Management 92

Getting ready 92

How to do it 92

How it works 93

Extending WordPress search with Search Unleashed 93

Getting ready 93

How to do it 93

How it works 94

Installing widgets 95

Plugins versus widgets 95

Getting ready 95

How to do it 96

How it works 96

Installing downloaded widgets 97

Make your sidebar widget-ready 97

Getting ready 97

How to do it 97

How it works 98

Creating two (or more) different widget-ready zones 98

Getting ready 99

How to do it 99

How it works 100

Modifying core widgets 101

Getting ready 101

How to do it 101

How it works 102

Creating your own widget 102

Getting ready 102

How to do it 102

How it works 103

Complete widget code 104

Chapter 5: Displaying Posts_107

Getting posts within the WordPress loop 108

Getting ready 108

How to do it 108

How it works 108

Retrieving posts from a particular category only 108

Getting ready 109

How to do it 110

How it works 110

Getting an exact number of posts 110

Getting ready 110

How to do it 110

How it works 111

Retrieving posts by date 111

Getting ready 111

How to do it 111

How it works 112

Getting posts published today 112

Getting ready 112

How to do it 112

How it works 113

Getting posts published exactly a year ago 113

Getting ready 113

How to do it 113

How it works 114

Using two different loops without duplicate posts 114

How to do it 115

How it works 115

Complete code 116

Accessing post data outside of the WordPress loop 116

Getting ready 116

How to do it 116

How it works 117

Usage 118

Accessing permalinks outside the loop 118

Getting ready 118

How to do it 118

How it works 119

Using the $post global variable 119

Displaying any RSS feed on your blog 110

Getting ready 120

How to do it 120

How it works 120

Displaying thumbnails on your blog homepage 121

Getting ready 121

How to do it 121

How it works 122

Defining a default image 123

Alternating background color on post list 123

Getting ready 124

How to do it 124

How it works 124

Displaying posts in two columns 125

Getting ready 125

How to do it 125

How it works 126

Save time by using WordPress shortcodes 126

Getting ready 126

How to do it 127

How it works 127

Creating a nice download message box using a shortcode 128

Getting ready 129

How to do it 129

How it works 130

Chapter 6: Managing and Enhancing Multi-Author Blogs_131

Creating an author page template 132

Getting ready 132

How to do it 132

How it works 133

Displaying a custom login form in your blog's sidebar 134

Getting ready 135

How to do it 135

How it works 136

Adding a control panel to your blog's sidebar 137

Getting ready 137

How to do it 137

How it works 138

Adding a login form and a control panel 139

Configuring author roles 141

Getting ready 141

How to do it 141

How it works 142

Controlling what authors can do 142

Displaying author-related information on posts 145

Getting ready 145

How to do it 146

How it works 146

Displaying author picture on posts 147

Getting ready 147

How to do it 148

How it works 148

Displaying the author's gravatar picture on posts 149

Getting ready 149

How to do it 151

How it works 151

Adding moderation buttons to the comments 151

Getting ready 152

How to do it 152

How it works 153

Getting notified when a new draft is saved 153

Getting ready 153

How to do it 154

How it works 154

Allowing multiple authors on posts 154

Getting ready 154

How to do it 155

How it works 155

Displaying a list of all of the authors 156

Getting ready 156

How to do it 156

How it works 156

Controlling the wp_list_authors() function 157

Chapter 7: Securing your WordPress Blog_159

Creating manual backups of your WordPress blog 160

Getting ready 160

How to do it 160

How it works 161

Restoring a MySQL backup 161

Getting ready 162

How to do it 162

How it works 163

Creating backups of your WordPress files 163

Getting ready 163

How to do it 164

How it works 164

Using a shell script to create automatic files and database backups 164

Getting ready 164

How to do it 164

How it works 165

Securing your plugins directory 165

Getting ready 165

How to do it 166

How it works 166

Removing a WordPress version from the theme files 166

Getting ready 167

How to do it 167

How it works 167

Getting rid of the Administrator account 168

Getting ready 168

How to do it 168

How it works 169

Automatically forbid login after some failed login attempt 169

Getting ready 169

How to do it 169

How it works 170 Protecting the wp-admin directory brute force with the help of AskApache 171

Getting ready 171

How to do it 171

How it works 173

Restricting wp-admin directory to your IP address 174

Getting ready 174

How to do it 174

How it works 175

Allowing access to more than one IP 175

Testing your blog security 176

Getting ready 176

How to do it 176

How it works 178

Deny comment posting on no referrer requests 179

Getting ready 179

How to do it 180

The .htaccess method 180

The PHP method 180

How it works 180

Chapter 8: SEO Tips and Tricks to Get More Visits_181

Optimizing your permalinks for SEO 182

Getting ready 182

How to do it 182

How it works 183

Structure tags reference 184

Further optimizing your permalinks 184

Migrating your permalinks safely 185

Getting ready 186

How to do it 186

How it works 186

Optimize your title tag for SEO 187

Getting ready 187

How to do it 188

How it works 189

Create Meta descriptions for your posts 189

Getting ready 189

How to do it 190

How it works 190

A more sophisticated code by using custom fields 190

Avoid duplicate content with a robot.txt file 191

Getting ready 191

How to do it 191

How it works 192

PHP code to avoid duplicate content 192

Adding a sitemap to your blog 193

Getting ready 193

How sitemaps works 193

General rules for creating sitemaps 194

How to do it 195

How it works 196

Basic options 196

Using Google Webmaster Tools 197

How to do it 197

How it works 198

Overview 199

Statistics 199

Links 199

Sitemaps 200

Tools 200

Pinging third party services 200

Getting ready 200

How to do it 201

How it works 202

Services to ping 202

Enhancing your WordPress blog SEO with the All in One SEO Pack plugin 203

Getting ready 203

How to do it 204

Five more tips for a better SEO 206

Chapter 9: Making Money with WordPress_209

Integrating Adsense to your WordPress blog 210

Getting ready 210

How to do it 211

Method 1: Using your Adsense code in your theme files 211

Method 2: Using a text widget to display your Adsense ads 212

How it works 212

Display ads anywhere in your posts by using WordPress shortcodes 213

Getting ready 213

How to do it 213

How it works 214

Inserting shortcodes into sidebar widgets 215

Displaying Adsense ads to search engines visitors only 215

Getting ready 216

How to do it 216

How it works 217

Managing who Sees Ads 218

Getting ready 218

How to do it 219

How it works 220

Advanced conditions 221

Inserting ads in your RSS feeds 221

Getting ready 222

How to do it 222

Option 1: Using a hack 222

Option 2: Using a plugin 223

How it works 224

Solving problems with Feedburner 224

Redirecting your WordPress RSS feeds to Feedburner 225

Getting ready 225

How to do it 225

Option 1: Using a hack 226

How it works 226

Option 2: Using a plugin 226

How it works 227

Plugin versus hack 227

Show your blog stats to find advertisers 228

Getting ready 228

How to do it 228

How it works 230

Managing your 125*125 px ad spots 230

Enhancing your Advertise page by adding Paypal subscriptions 230

Getting ready 231

How to do it 231

Telling advertisers how to unsubscribe 233

Chapter 10: Enhancing User Experience_235

Replacing the Next and Previous links by a paginator 236

Getting ready 236

How to do it 236

How it works 238

Highlighting searched text in search results 238

Getting ready 238

How to do it 238

How it works 239

Using the CSS sliding doors technique within WordPress 239

Getting ready 239

How to do it 241

Applying this hack to pages 241

Applying this hack to categories 242

How it works 243

Creating a drop-down menu for your categories 243

Getting ready 243

How to do it 244

Step 1: PHP and HTML 244

Step 2: The CSS 245

Step 3: Optional JavaScript 246

How it works 247

Creating a horizontal drop-down menu 247

Adding a breadcrumb to your theme 250

Getting ready 250

How to do it 250

How it works 251

Using a hack to display breadcrumbs 252

Displaying related posts 253

Getting ready 253

How to do it 254

How it works 255

Display tabs on your sidebar 255

Getting ready 256

How to do it 256

How it works 256

Chapter 11: Make your Blog Stand Out_257

Rewarding your commentators to get more comments 257

Making your blog dofollow with the 258

NoFollow Free plugin 258

The NoFollow Free plugin 258

Using the Top Commentators widget 260

Installing the Top Commentators widget 260

Conclusion 262

Adding a print stylesheet to your blog 262

Getting ready 263

How to do it 263

How it works 264

Print button 264

Print stylesheet inclusion and selection 264

Print stylesheet 264

Using WordPress as a photoblog 266

Photoblog themes for WordPress 266

Photoblog 266

Nishita 267

Fotolog 268

Creating your own Photoblog theme 268

Getting ready 268

How to do it 269

How it works 272

Creating an iPhone-friendly version of your blog 272

Getting ready 272

How to do it 273

How it works 273

Using an header image 274

Modify the title and slogan 274

Integrating a forum in your WordPress blog 274

Getting ready 275

How to do it 276

How it works 277

Skins 277

Moderators 277

User groups 278

Index_279

Preface

About 120,000 blogs are created every day. Most of them quickly die, but a few stay, grow up, and then become well known and respected places on the Web. If you are seriously interested in being in the top league, you will need to learn all the tricks of the trade. WordPress 2.7 Cookbook focuses on providing solutions to common WordPress problems, to help make sure that your blog will be one of the ones that stay.

The author's experience with WordPress enables him to share insights on using WordPress effectively, in a clear and friendly way, giving practical hands-on solutions to WordPress problems, questions, and common tasks—from themes to widgets and from SEO to security.

Are you feeling limited with WordPress, or are you wondering how popular blogs do a certain kind of thing that you can't? With this cookbook, you will learn many WordPress secrets and techniques with step-by-step, useful recipes dedicated to achieving a particular goal or solving a particular problem. You'll learn the secret of expensive premium themes, how to optimize your blog for SEO and online profits, and how to supercharge WordPress with killer functions used by the most popular blogs over the Internet.

What this book covers

Chapter 1 introduces you to WordPress. It introduces you to some basic—but often forgotten—built-in tools to make your blogger life easier.

Chapter 2 discusses the various WordPress themes and provides you with the location where to find professional—but free—themes. It also teaches you how to install and customize these themes.

Chapter 3 teaches you how to customize any existing WordPress theme and make it fit your taste and need.

Chapter 4 describes an easy procedure to install plugins. It shows what different plugins can do for you in particular situations. It also teaches you how to download and install widgets and how to make a WordPress theme widget-ready.

Chapter 5 describes the procedure to display posts and to retrieve post information from WordPress.

Chapter 6 teaches you to manage a multi-author blog and integrate powerful functions for creating an author page template.

Chapter 7 educates you about hacks, plugins, and tips and tricks to secure your database and your WordPress blog.

Chapter 8 teaches you—by providing you with tips and tricks—the art of getting traffic from search engines to your blog.

Chapter 9 discusses the monetization solution that can be used in a WordPress blog. It will also provide you with many tips and tricks to make money while blogging.

Chapter 10 helps you make your blog easy and functional for your visitors.

Chapter 11 provides you with tips and hacks to make your blog better than your competitor's blog.

What you need for this book

You'll need a working installation of WordPress on a server, or on your local machine (using MAMP, WampServer, EasyPHP, and so on). WordPress can be downloaded from the link, http://wordpress.org/download/.

You need to have minimal knowledge of XHTML and CSS, PHP and JavaScript.

You also need an FTP client for uploading files. I recommend Cyberduck

(http://cyberduck.ch/) for Mac and Filezilla (http://filezilla-project.org/) for both GNU/Linux and Windows platforms.

Who this book is for

This book is for anyone who wants to enhance their WordPress blog to make it more engaging and feature-rich. It is not specifically for developers or programmers, rather it can be used by anyone who wants to get more out of their WordPress blog by following step-by-step instructions. A basic knowledge of PHP, XHTML, CSS, and WordPress is desirable, but not necessary.

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: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

<a href="<?php bloginfo('wpurl');?>/wp-admin/edit.php?p= <?php the_ID(); ?>">Edit Post</a> <?php } ?>

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 the text like this: "Scroll down until you see a Page template link".

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 send an email to [email protected], and mention the book title via 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 [email protected].

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

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Tips and tricks appear like this.

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.

Downloading the example code for the book

Visit http://www.packtpub.com/files/code/7382_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 content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration, and help us 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 [email protected] with a link to the suspected pirated material.

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

Questions

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

Getting Ready to Cook with WordPress

Back in 2003, when blogs weren't as popular as they are nowadays, an average 2000 users used a blogging platform created by Michel Valdrighi known as b2.

This year, two b2 users, Matt Mullenweg and Mike Little, decided to create a fork of b2 and named it as WordPress.

Due to its open source license and community development, WordPress quickly started to gain popularity as more and more bloggers adopted it as a blogging platform.

Two years later, WordPress introduced themes. It was now possible, and easy, to customize and change your blog's look and feel. This major evolution pushed the popularity of WordPress a step forward. In 2005, the WordPress themes were downloaded over 900,000 times.

Due to the growing popularity of the blogging platform, several core members of WordPress development team decided to create a company devoted to promote and enhance WordPress, called Automattic. The team also started to provide a hosted service at www.wordpress. com.

WordPress downloads increased with every passing year. In 2006, it was downloaded 1,545,703 times from the official site, and a year later, 3,816,965 new copies were downloaded.

Today, WordPress is used by many people and companies. While there's a lot of personal blogs, with people simply willing to stay tuned with their friends, some very well-known companies, such as CNN, use WordPress to share their content on the web.

Day after day, WordPress is showing its possibilities and its incredible extensibility. You may already be aware of it, but you can use WordPress to create a static site, a photoblog, a tumbler platform, an online store, and even an online magazine.

With its Open Source code, dynamic community, and passionate individuals WordPress can be used by everyone and easily make it fit to their own needs.

Even if understanding the working of WordPress isn't that difficult, it may take some time for a novice or a non-developer to get accustomed to it. The WordPress Cookbook can be read chapter wise, as a way to understand the working of WordPress and explore new things using it.

On the other hand, it is possible to keep the WordPress Cookbook on your desk and refer to it in case an issue arises. WordPress Cookbook features many recipes that can be read in no particular order.

In this chapter, you will learn:

► Using built-in WordPress tools

► Managing media files with the Media Library

► Live editing themes with the built-in Theme Editor

► Editing plugins with the WordPress built-in Plugin Editor

► Managing authors and users with the User Manager

► Importing and Exporting content with the Import and Export tool

Using built-in WordPress tools

By default, WordPress provides some useful tools for the bloggers that make your blogging life easier. The following are the tools provided by WordPress:

► Media Library

► Plugin Editor

► Import/Export Manager

Managing media files with the Media Library

The Media Library allows you to manage all the media files (images, videos, and so on) in one place. The Media Library allows you to add, delete, and edit media files for further integration on your blog posts.

Getting ready

To access WordPress Media Library, log in to your WordPress Dashboard and go to Media | Library, located to the right of the screen.

How to do it

1. To add a new media file on the Media Library, click the Media option, in WordPress admin menu, and then click on Add new. A Select files button will be displayed. Simply click on it and select the media files from your hard drive.

2. There are two uploaders available: the Flash uploader (which uses Adobe Flash technology) and the Browser uploader (which uses a good old input file HTML field). The Flash uploader allows you to select multiple files at once, while the browser uploader allows you to upload only one file at a time. With WordPress 2.6, the Flash uploader wasn't working on Mac OS and GNU/Linux platforms. This has been fixed with WordPress 2.7. However, if you have any issues with Flash uploader, the Browser uploader will always work.

Deleting media

1. Deleting media is an easy process. On the Media Library, simply hover an item and the Edit, Delete, and Views buttons will be displayed.

2. Click on Delete and the media will be deleted for good.

Bulk media deletion

1. If you need to delete around 5 or 10 media files, WordPress allows you to erase all the undesired files at once.

2. To do so, simply go to the Media Library and check the checkboxes related to the media you want to delete.

3. Select the Delete option in the Bulk Actions drop-down list (located on the top left of the page) and then click on the Apply button.

Editing media

All media files can be edited. You can change its title and add a caption or description. Carry out the following steps to do so:

1. Go to the Media Library.

2. Hover the mouse over the item you'd like to edit and click on the Edit link which appears.

3. A new page opens, allowing you to define the file settings.

4. Click on the Apply button when you're done editing the file settings.

How it works

The Media Library allows you to manage, upload, and delete media files. Unlike adding or deleting media files directly on your server by using a FTP program, the Media Library ensures that database entries related to media are updated or deleted, depending on the action you have taken.

Live editing themes with the built-in Theme Editor

Among other tools, WordPress features the Theme Editor, which allows you to edit your theme files without downloading or uploading the files. Chapter 3 covers WordPress themes in detail.

Getting ready

To access the Theme Editor, log in to your WordPress Dashboard, and go to Appearance | Editor located at the top of the screen. To select a theme for editing, use the drop-down list located at the top right of the screen. By default, you'll be editing the theme being used currently by your blog.

How to do it

1. You can access the templates in the Theme Files, located on the right of the screen.

2. Simply click on one of the files to begin editing that particular file.

3. When you're done, click on the Update File button to save your modifications.

I Edit Themes

¿t Posts m Pages

Cp Comments

Themes

Widgets

Editor

OpenBook

Header Image and

Color

$$ Plugins

Users Tfi Tools Settings

® StatPress Overview Details Spy 5earch Export

Select theme to edit: CatsWhoCode

position : absolute;

#slogan{

left:S80px;

0 0

Post a comment