Chapter 14. Beyond Blogging: WordPress as a Content Management System

In This Chapter

  • Defining a Content Management System

  • Setting the home page

  • Creating a template for each static page, post category, and sidebar

  • Custom styles for sticky posts, categories, and tags

  • Using custom post types

  • Optimizing for search engine success

If you've avoided using WordPress as a solution for building your own Web site because you think it's only a blogging platform, and you don't want to have a blog (not every Web site owner does, after all), it's time to rethink your position. The self-hosted version of WordPress, WordPress.org, is a powerful Content Management System (CMS) that is flexible and extensible enough to run an entire Web site — with no blog at all, if you prefer.

A Content Management System (CMS) is a system used to create and maintain your entire site. It includes tools for publishing and editing, as well as for searching and retrieving information and content. A CMS lets you maintain your Web site with little or no knowledge of HTML. You can create, modify, retrieve, and update your content without ever having to touch the code required to perform those tasks.

This chapter shows you a few ways that you can use the self-hosted WordPress.org software to power your entire Web site, with or without a blog. It covers different template configurations that you can use to create separate sections of your site. You also discover how to use the front page of your site as a landing page (a static page) or portal (a page that contains snippets from other sections of your site, with links to those sections), which can include a link to an internal blog page, if you want a blog.

Creating the Front Page of Your Web Site

For the most part, when you visit a blog powered by WordPress, the blog is on the main page. My personal blog at http://justagirlintheworld.com, powered by WordPress (of course), shows my latest blog posts on the front page, along with links to the post archives (by month or by category). This setup is typical of a site run by WordPress (see Figure 14-1).

But the front page of my business site at http://ewebscapes.com, also powered by WordPress, contains no blog (see Figure 14-2). It doesn't display any blog posts; rather, it displays the contents of a static page I created in the WordPress Dashboard. This static page serves as a portal to my design blog, my portfolio, and other sections of my site. The site includes a blog but also serves as a full-blown business Web site, with all the sections I need to provide my clients the information they want.

Both of my sites are powered by the self-hosted version of WordPress.org, so how can they differ so much in what they display on the front page? The answer lies in the templates in the WordPress Dashboard.

My personal blog, set up like a typical site powered by WordPress.

Figure 14-1. My personal blog, set up like a typical site powered by WordPress.

My business site, set up as a business Web site, rather than a blog.

Figure 14-2. My business site, set up as a business Web site, rather than a blog.

You use static pages in WordPress to create content that you don't want to display as part of your blog but do want to display as part of your overall site (such as a bio page, a page of services, and so on).

Creating a front page is a three-step process: Create a static page, designate that static page as the front page of your site, and tweak the page to look like a Web site rather than a blog.

Note

Using this method, you can create unlimited numbers of static pages to build an entire Web site. You don't even need to have a blog on this site unless you want to include one.

Creating the static page

To have a static page display on the front page of your site, you need to create that page. Follow these steps:

  1. Click the Add New link on the Pages menu.

    The Add New Page page opens where you can write a new page to your WordPress blog, as shown in Figure 14-3. (Check out Chapter 7 for the difference between a page and a post in WordPress.)

  2. In the Title text box, type a title for the page.

  3. Type the content of your page in the text box.

  4. Set the options for this page.

    I explain all these options in Chapter 7.

  5. Click the Publish button.

    The page is saved to your database and published to your WordPress site with its own, individual URL (or permalink). The URL for the static page consists of your blog URL and the title of the page. For example, if you titled your page "About Me," then the URL of the page is http://yourdomain.com/about-me. (See Chapter 8 for more information about permalinks.)

Create the static page that you want to use as your front page.

Figure 14-3. Create the static page that you want to use as your front page.

Note that the Page Template option is set to Default Template. This setting tells WordPress that you want to use the default page template (page.php in your theme template files) to format the page you're creating. The default template is the default setting for all pages you create; assigning a page to a different template is something I discuss in the "Defining Specific Templates for Static Pages" section in this chapter.

Assigning a static page as the front page

Next, you need to tell WordPress that you want the static page to serve as the front page of your site. Follow these steps:

  1. Click the Reading link on the Settings menu to display the Reading Settings page.

  2. In the Front Page Displays section, select the A Static Page radio button.

  3. From the Front Page drop-down menu, choose the static page that you want to serve as your front page.

    In Figure 14-4, I'm choosing to display a static page, and Welcome to My Front Page is the page I want to display.

    Choosing which page to display as the front page.

    Figure 14-4. Choosing which page to display as the front page.

  4. Click the Save Changes button at the bottom of the Reading Settings page.

    WordPress displays the page you selected in Step 4 as the front page of your site. Figure 14-5 shows my site displaying the page I created as my front page.

WordPress displays the page you selected as your front page.

Figure 14-5. WordPress displays the page you selected as your front page.

Adding a Blog to Your Web Site

If you want a blog on your site but don't want to display the blog on the front page, you can add one with the WordPress Dashboard. To create the blog for your site, follow these steps:

  1. Click the Add New link on the Pages menu.

    The page where you can write a new post to your WordPress blog opens.

  2. Type Blog in the Title text box.

    This automatically sets the page slug to /blog. (Read more about slugs in Chapter 8.)

  3. Leave the Page Content box blank.

  4. Click the Publish button.

    The page is saved to your database and published to your WordPress site.

Now you have a blank page that redirects to http://yourdomain.com/blog. Next, you need to assign the page you just created as your blog page. To do so, follow these steps:

  1. Click the Reading link on the Settings menu to display the Reading Settings page.

    The Reading Settings page opens.

  2. From the Posts Page drop-down menu, choose the page you just created.

    The page is set as your blog page.

  3. In the Blog Pages Show at Most section, type the number of posts you want to display in the Posts text box.

    This setting specifies the number of posts you want to display on that page at any time. If you enter 5, the blog page shows the last five posts you've made to your blog.

  4. Click the Save Changes button.

    The options you just set are saved, and your blog is now at http://yourdomain.com/blog (where yourdomain.com is the actual domain name).

Now when you navigate to http://yourdomain.com/blog, your blog displays. Figure 14-6 shows my blog page with my latest post.

My blog at /blog with one post displayed.

Figure 14-6. My blog at /blog with one post displayed.

Note

This method of using the /blog page slug works only if you're using custom permalinks with your WordPress installation. (See Chapter 8 if you want more information about permalinks.) If you're using the default permalinks, the URL for your blog page is different; it looks something like http://yourdomain.com/?p=4 (where 4 is the ID of the page you created for your blog).

Tip

Easily add a link to your blog in the navigation menu (as shown on my site in Figure 14-6) by adding it to your custom menu. To find out how to build your own custom menu, check out Chapter 13.

Defining Specific Templates for Static Pages

As I explain in "Creating the Front Page of Your Web Site," earlier in this chapter, a static page contains content that is not displayed on the blog page, but as a separate page within your site. You can have numerous static pages on your site, and each page can have a different design, which is governed by the template you create. (See Chapter 12 to find out all about choosing and using templates.) You can create several static-page templates and assign them to specific pages within your site by adding code to the top of the static-page templates.

Following is the code that appears at the top of the static-page template I use for my About Us and Our Blog Designers page at http://ewebscapes.com/about:

<?php
/*
Template Name: About Page
*/
?>

Using a template on a static page is a two-step process: Upload the template, and tell WordPress to use the template by tweaking the page's code.

Tip

In Chapter 13, I cover information about Custom Menus, including how to create different navigation menus for your Web site. You can create a menu of links that includes all the pages you've created in your WordPress Dashboard. You can display that menu on your Web site using the Custom Menus feature.

Uploading the template

To use a page template, you have to create one. You can create this file in a text-editor program, such as Notepad. (To see how to create a template, flip to Chapter 12.) To create an About page, for example, you can name your template about.php.

When you have your template created, follow these steps to make it part of WordPress:

  1. Upload the template file to your WordPress theme folder.

    You can find that folder on your Web server in /wp-content/themes/. (See Chapter 6 for more information about FTP.)

  2. Log in to your WordPress Dashboard, click the Editor link on the Appearance menu.

    The Edit Themes page opens.

  3. Click the about.php template link located on the right side of the page.

  4. Type the Template Name tag directly above the header template tag.

    The header tag looks like this: <?php get_header(); ?>.

    If you're creating an About Page, the code to create the Template Name looks like this:

    <?php
    /*
    Template Name: About Page
    /*
    ?>
  5. Click the Update File button.

    The file is saved, and the page refreshes. If you created an About Page template, the about.php template is now called About Page in the template list on the right side of the page.

Figure 14-7 shows the Page template and displays the code needed to define a specific name for the template.

Naming a static-page template.

Figure 14-7. Naming a static-page template.

Assigning the template to a static page

When you have the template created and named the way you want it, you assign that template to a page by following these steps:

  1. Click the Add New link on the Pages menu.

    The Add New Page page opens, where you can write a new post to your WordPress blog.

  2. Type the title in the Title text box and the page content in the text box.

  3. Choose the page template from the Page Template drop-down menu.

    The Page Template drop-down menu in the Attributes module by default is shown on the right side of the page. You can reposition the modules on this page; see Chapter 7 for more information.

  4. Click the Publish button to save and publish the page to your site.

Figure 14-8 shows the layout of my home page on my business site at http://ewebscapes.com and the information it contains, whereas Figure 14-9 shows the layout and information provided on the Services page at http://ewebscapes.com/services. Both pages are on the same site, in the same WordPress installation, with different static-page templates to provide different looks, layouts, and sets of information.

My home page at E.Webscapes.

Figure 14-8. My home page at E.Webscapes.

The Services page at E.Webscapes.

Figure 14-9. The Services page at E.Webscapes.

Creating a Template for Each Post Category

You don't have to limit yourself to creating a static-page template for your site. No, you can completely gorge yourself at the table of WordPress templates and create unique sections for your site, as I did (with an espresso chaser, of course).

Figure 14-10 shows my design portfolio. Design Portfolio is the name of a category that I created in the WordPress Dashboard. Instead of using a static page for the display of my portfolio, I used a category template to handle the display of all posts made to the Design Portfolio category.

You can create category templates for all categories in your blog simply by creating template files with filenames that correspond to the category ID numbers and then uploading those templates to your WordPress themes directory (see Chapter 12). The logic to this is as follows:

My Design Portfolio page, using a category template file.

Figure 14-10. My Design Portfolio page, using a category template file.

  • A template with the filename category.php is a catch-all for the display of categories.

  • Add a dash and the category ID number to the end of the filename (as shown in Table 14-1) to specify a template for an individual category.

  • If you don't have a category.php or category-#.php file, the category display pulls from the Main Index template (index.php).

Table 14-1 shows three examples of the category template naming requirements.

Table 14-1. WordPress Category Template Naming Conventions

If the Category ID Is . . .

The Category Template Filename Is . . .

1

category-1.php

2

category-2.php

3

category-3.php

Pulling In Content from a Single Category

WordPress makes it possible to pull in very specific types of content on your Web site through the <query_posts> template tag. You place this template tag before The Loop (see Chapter 12), and it lets you specify which category you want to pull information from. If you have a category called WordPress, and you want to display the last three posts from that category on your front page, in your blog sidebar, or somewhere else on your site, you can use this template tag.

Tip

The <query_posts> template tag has several parameters that let you display different types of content, such as posts in specific categories and content from specific pages/posts or dates in your blog archives. The <query_posts> tag lets you pass so many variables and parameters that it's impossible for me to list all the possibilities. Instead, you can visit this page in the WordPress Codex and read about the options available with this tag: http://codex.wordpress.org/Template_Tags/query_posts.

First, you have to find the ID number for the category you want to use; then you have to tell WordPress how to display the content with the <query_posts> tag.

Finding the category ID number

The unique ID number for a category is not easy to find unless you know where to look. Follow these steps:

  1. Click the Categories link on the Posts menu.

    The Categories page opens.

  2. Hover your mouse over the name of the category that you need the ID number for.

  3. Look in the status bar of your browser to view the category ID number.

    Figure 14-11 shows the category ID in the status bar of Mozilla Firefox. (Internet Explorer and Safari have similar status bars.) The last part of the URL displayed in the status bar is cat_ID=1, which means that 1 is the category ID for my Uncategorized category.

    Finding the unique category ID number.

    Figure 14-11. Finding the unique category ID number.

Adding the <query_post> tag

When you have the category ID number in hand, you're ready to add the <query_post> tag to your template.

Here is an example of two parameters you can use with the <query_posts> tag:

  • showposts=X: This parameter tells WordPress how many posts you want to display. If you want to display only three posts, enter showposts=3.

  • cat=X: This parameter tells WordPress that you want to pull posts from the category with this specific ID number. If the ID category is 40, enter cat=40.

Follow these steps to add the <query_post> tag to your template:

  1. Click the Editor link on the Appearance menu.

    The Edit Themes page opens.

  2. Click the template in which you want to display the content.

    If you want to display content in a sidebar, for example, choose the Sidebar template: sidebar.php.

  3. Locate the ending </ul> tag at the bottom of the template for the theme you're using.

    If you're using the Twenty Ten theme, the ending </ul> tag is the second-to-the-last line.

  4. Type the following code directly above the ending </ul> tag:

    <?php query_posts('showposts=3&cat=40'), ?>
    <h2>Type Your Desired Title Here</h2>
    <?php if (have_posts()) : while (have_posts()) : the_
            post(); ?>
    <strong><a href="<?php the_permalink() ?>"
            rel="bookmark" title="Permanent Link to <?php
            the_title_attribute(); ?>"><?php the_title();
            ?></a></strong>
    <?php the_excerpt();endwhile;endif; ?>

    Tip

    In the first line, I indicated the following: showposts=3&cat=40. You can change these numbers to suit your specific needs. Just change 3 to whatever number of posts you'd like to display (there is no limit!), and change 40 to the specific category ID number that you want to use.

  5. Click the Update File button.

    The changes you just made are saved to the sidebar.php template.

Using Sidebar Templates

You can create separate sidebar templates for different pages of your site by using a simple include statement. When you write an include statement, you're simply telling WordPress that you want it to include a specific file on a specific page.

The code that pulls the usual Sidebar template (sidebar.php) into all the other templates, such as the Main Index template (index.php), looks like this:

<?php get_sidebar(); ?>

What if you create a page and want to use a sidebar that has different information from what you have in the Sidebar template (sidebar.php)? Follow these steps:

  1. Create a new sidebar template in a text editor such as Notepad.

    See Chapter 12 for information on template tags and themes.

  2. Save the file as sidebar2.php.

    In Notepad, choose File

    Using Sidebar Templates
  3. Upload sidebar2.php to your themes folder on your Web server.

    See Chapter 6 for FTP information, and review Chapter 12 for information on how to locate the themes folder.

    The template is now listed in your theme files on the Edit Themes page (log in to your WordPress Dashboard, click the Editor link on the Appearance menu).

  4. To include the sidebar2.php template in one of your page templates, find this code:

    <?php get_sidebar(); />
  5. Replace it with this include code:

    <?php include (TEMPLATEPATH . '/sidebar2.php'), ?>

Tip

Using that include (TEMPLATEPATH statement, you can include virtually any file in any of your WordPress templates. You can use this method to create footer templates for pages on your site, for example. To do this, first create a new template with the filename footer2.php. Then locate the following code in your template:

<?php get_footer(); ?>

and replace it with this code:

<?php include (TEMPLATEPATH . '/footer2.php'), ?>

You can do multiple things with WordPress to extend it beyond the blog. This chapter gives you a few practical examples using the default Twenty Ten theme. The point is to show you how to use WordPress to create a fully functional Web site with a CMS platform — anything from the smallest personal site to a large business site.

Custom Styles for Sticky, Category, and Tag Posts

In Chapter 12, I discussed the method of putting a very basic WordPress theme together, which included a Main Index template using the WordPress Loop. You can use a custom tag to display custom styles for sticky posts, categories, and tags on your blog. That special tag looks like this:

<div <?php post_class() ?> id="post-<?php the_ID(); ?>">

The part of that template tag that is so cool is the post_class() section. This template tag tells WordPress to insert specific HTML markup in your template that allow you to use CSS to make custom styles for sticky posts, categories, and tags.

Note

In Chapter 8, I tell you all about how to publish new posts to your blog, including the different options you can set for your blog posts, such as categories, tags, and publishing settings. One of the settings is the Stick This Post to the Front Page setting. In this chapter, I show you how to custom style those sticky posts — it's not as messy as it sounds!

For example, I have published a post with the following options set for that post:

  • Stick this post to the front page

  • Filed in a category called WordPress

  • Tagged with News

By having the post_class() tag in my template, WordPress inserts HTML markup that allows me to use CSS to style sticky posts, or posts assigned to specific tags or categories, differently. WordPress inserted the following HTML markup for my post:

<div class="post sticky category-wordpress tag-news">

In Chapter 13, I talk about CSS selectors and HTML markup and how they work together to create style and format for your WordPress theme. I can now go to my CSS file and define styles for the following CSS selectors:

  • .post: Use this as the generic style for all posts on your blog. Te CSS for this tag is

    .post {background: #ffffff; border: 1px solid silver;
            padding: 10px;}

    A style is created for all posts that have a white background with a thin silver border and 10 pixels of padding space between the post text and the border of the post.

  • .sticky: The concept of sticking a post to your front page is to call attention to that post, so you may want to use different CSS styling to make it stand out from the rest of the posts on your blog:

    .sticky {background: #ffffff; border: 4px solid red;
            padding: 10px;}

    This creates a style for all sticky posts that display with a white background, a thicker red border, and 10 pixels of padding space between the post text and border of the post.

  • .category—wordpress: Because I blog a lot about WordPress, my readers may appreciate it if I gave them a visual cue as to which posts on my blog are about that topic. I can do that through CSS by telling WordPress to display a small WordPress icon on the top-right corner of all my posts in the WordPress category:

    .category-wordpress {background: url(wordpress-icon.
            jpg) top right no-repeat; height: 100px;
            width: 100px;}

    This code inserts a graphic — wordpress-icon.jpg — that is 100 pixels in height and 100 pixels in width at the top-right corner of every post I've assigned to the WordPress category on my blog.

  • .tag—news: I can style all posts tagged with News the same way I've styled the categories:

    .tag-news {background: #f2f2f2; border: 1px solid
            black; padding: 10px;}

    This CSS styles all posts tagged with News with a light grey background and a thin black border with 10 pixels of padding between the post text and border of the post.

Using the post-class() tag, combined with CSS, to create dynamic styles for the posts on your blog is fun and easy!

Working with Custom Post Types

Brand new to the latest version of WordPress (version 3.0) is a feature called Custom Post Types. This feature allows you, the site owner, to create different content types for your WordPress site that give you more creative control over how different types of content are entered, published, and displayed on your WordPress Web site.

By default, WordPress already has different post types built in to the software, ready for you to use. These default post types include:

  • Blog posts

  • Pages

  • Navigation menus (see Chapter 13)

  • Attachments

  • Revisions

Custom post types give you the ability to create new and useful types of content on your Web site, including a smart and easier way to publish those content types to your site.

The possibilities for the use of Custom Post Types are really endless, but here are a few ideas that will kick start your imagination, as well as being some of the more popular and useful ideas that others have implemented on sites:

  • Photo Gallery

  • Podcast or Video

  • Book Reviews

  • Coupons and Special Offers

  • Events Calendar

In order to create and use Custom Post Types on your site, you need to be sure that your WordPress theme contains the correct code and functions. In the following steps, I am creating a very basic and generic Custom Post Type called "Generic Content" — follow these steps to create the same basic Custom Post Type and later in this section, you find detailed information on the different parameters you can use with Custom Post Types to create different types to suit your needs:

  1. Open the Theme Functions template file (functions.php).

    Click the Editor link under the Appearances menu to open the Theme Editor page. Then click the Theme Functions template link to open the functions.php file in the text editor on the left side of the page.

  2. Add the Custom Post Types code to the bottom of the Theme Functions template file.

    Scroll down to the bottom of the functions.php file and include the following code to add a 'Generic Content' Custom Post Type to your site:

    add_action( 'init', 'create_my_post_types' );
    
    function create_my_post_types() {
    register_post_type( 'generic_content',
    array(
    'label' => __( 'Generic Content' ),
    'singular_label' => __( 'Generic Content' ),
    'description' => __( 'This is a description of
    the Generic Content type' ),
    'public' => true,
    );
     }
  3. Save your changes.

    Click the Update File button to save the changes made to the functions.php file.

Note

The function: register_post_type can accept several different arguments and parameters, which are detailed in Table 14-2. You can use a variety and combination of different arguments and parameters to create a specific post type. You can find more information on Custom Post Types and using the register_post_types function in the official WordPress Codex here: http://codex.wordpress.org/Function_Reference/register_post_type.

Now that you have completed the steps to add the Generic Content post type to your site, you see that there is a new post type added to the left navigation menu in the Dashboard labeled Generic.

You add and publish new content using the new Custom Post Type just as you would when you write and publish blog posts (see Chapter 8). The published content is not added to the chronological listing of blog posts, but are, rather, treated as separate content, just like static pages.

View the permalink for it, and you see that it adopts the post type name, Generic Content, and uses it as part of the permalink structure, creating a permalink that looks like: http://yourdomain.com/generic-content/new-article.

Table 14-2. Arguments and Parameters for: register_post_types();

Parameter

Information

Parameters

Example

label

The name of the post type

None

'label' =>
__( 'Generic
Content' ),

singular_label

Same as label

None

'singular_label' =>
__( 'Generic
Content' ),

description

The description of the post type; displayed in the Dashboard to represent the post type

None

'description'
=> __( 'This
is a
descrip-
tion of the
Generic
Content
type' ),
public

show_ui

publicly_
queryable

exclude_
from_search

Sets whether the post type is public, or not

There are three other arguments

show_ui: show admin screens, or not

publicly_queryable: query for this post type from the front end, or not

exclude_from_search: show post type in search results, or not

true or false Default is false

'public' =>
true,

'show_ui' =>
true,

'publicly_
queryable' =>
true,

'exclude_
from_search'
=> false,

menu_position

Sets the position of the post type menu item in the Dashboard navigation menu

Default: 20By default, custom post types appear after the Comments menu in the Dashboard Set integer in intervals of 5 (ie: 5, 10, 15, 20, etc)

'menu_
position' =>
25,

menu_icon

Define a custom icon (graphic) to the post type menu item in the Dashboard navigation menu

Create and upload the image into the images directory of your theme folder

None

'menu_icon'
=> get_
stylesheet_
directory_
uri() . '/
images/
generic-
content.png',

hierarchical

Tells WordPress whether to display the post type content list in a hierarchical manner, or not

true or false Default is true

'hierarchical'
=> true,

query_var

Allows you to control whether or not this post type can be used with a query variable such as query_posts (see previous section) or WP_Query

true or false Default is false

'query_var'
=> true,

capability_type

Defines permissions for users to edit, create, or read the custom post type (see Chapter 7)

post (default)Gives the same capabilities for those who can edit, create and read blog posts

'query_var'
=> post,

supports

Defines what meta boxes, or modules, are available for this post type in the Dashboard

title
editor

comments

track-
backs

revisions

author

excerpt

thumbnail

custom-
fields

page-
attributes
'supports' =>
array
( 'title',
'editor',
'excerpt',
'custom-
fields',
'thumbnail' ),

rewrite

Rewrite the permalink structure for the post type

true or false Two other arguments are available:

slug: permalink slug to prepend your custom post types

with_front: if you've set your permalink structure with a specific prefix such as /blog

'rewrite' =>
array( 'slug'
=> 'my-
content',
'with_front'
=> false ),

taxonomies

Allows you to use existing WordPress taxonomies (category and tag)

Category post_tag

'taxonomies'
=> array
( 'post_tag',
'category'),

Optimizing Your WordPress Blog

Search engine optimization (SEO) is the practice of preparing your site to make it as easy as possible for the major search engines to crawl your site and cache your data in their systems so that your site appears as high as possible in the search returns.

If you visit Google's search engine page at http://google.com and do a search using the keywords WordPress blog design, my own site at E.Webscapes is in the top ten search results for those keywords (at least, it is as I'm writing this chapter). Those results can change from day to day, so by the time you read this book, someone else may very well have taken over that coveted position. The reality of chasing those high-ranking search engine positions is that they're here today, gone tomorrow. The goal of search engine optimization is to make sure that your site ranks as high as possible for the keywords that you think people will use to find your site. After you attain those high-ranking positions, the next goal is to keep them. Check out Search Engine Optimization For Dummies, by Peter Kent (Wiley Publishing), for some valuable information on keeping those high rankings through ongoing optimization of your site.

WordPress is equipped to create an environment that is friendly to search engines, giving them easy navigation through your archives, categories, and pages. This environment is provided by a clean code base, content that is easily updated through the WordPress interface, and a solid navigation structure.

To extend search engine optimization even further, you can tweak five elements of your WordPress posts, pages, and templates:

  • Custom permalinks: Use custom permalinks, rather than the default WordPress permalinks, to fill your post and page URLs with valuable keywords. Check out Chapter 8 for information on WordPress permalinks.

  • Posts and page titles: Create descriptive titles for your blog posts and pages to provide rich keywords in your site.

  • Text: Fill your blog posts and pages with keywords for search engines to find and index. Keeping your site updated with descriptive text and phrases helps the search engines find keywords to associate with your site.

  • Category names: Use descriptive names for the categories you create in WordPress to place great keywords right in the URL for those category pages, if you use custom permalinks.

  • Images and ALT tags: Place <ALT> tags in your images to further define and describe the images on your site. You can accomplish this task easily by using the description field in the WordPress image uploader.

Planting keywords in your Web site

If you're interested in a higher ranking for your site, I strongly recommend using custom permalinks. By using custom permalinks, you're automatically inserting keywords into the URLs of your posts and pages, letting search engines include those posts and pages in their databases of information on those topics. If your site is hosted by a provider that has the Apache mod_rewrite module enabled, you can use the custom permalink structure for your WordPress-powered site.

Keywords are the first step on your journey toward great search engine results. Search engines depend on keywords, and people use keywords to look for content.

The default permalink structure in WordPress is pretty ugly. When you're looking at the default permalink for any post, you see a URL something like this:

http://yourdomain.com/p?=105

This URL contains no keywords of worth. If you change to a custom permalink structure, your post URLs automatically include the titles of your posts to provide keywords, which search engines absolutely love. A custom permalink may appear in this format:

http://yourdomain.com/2007/02/01/your-post-title

I explain setting up and using custom permalinks in full detail in Chapter 8.

Optimizing your post titles for search engine success

Search engine optimization doesn't completely depend on how you set your site up. It also depends on you, the site owner, and how you present your content.

One way to present your content in a way that lets search engines catalog your site easily is to give your blog posts and pages titles that make sense and coordinate with the actual content being presented. If you're doing a post on a certain topic, make sure that the title of the post contains at least one or two keywords about that particular topic. This practice gives the search engines even more ammunition to list your site in searches relevant to the topic of your post.

Note

As your site's presence in the search engines grows, more people will find your site, and your readership will increase as a result.

A blog post with the title A Book I'm Reading isn't going to tell anyone what book it is, making it difficult for people searching for information on that particular book to find the post.

If you give the post the title WordPress For Dummies: My Review, you provide keywords in the title, and (if you're using custom permalinks) WordPress automatically inserts those keywords into the URL, giving the search engines a triple keyword play:

  • Keywords exist in your blog post title.

  • Keywords exist in your blog post URL.

  • Keywords exist in the content of your post.

Writing content with readers in mind

When you write your posts and pages, and want to make sure that your content appears in the first page of search results so that people will find your site, you need to keep those people in mind when you're composing the content.

When search engines visit your site to crawl through your content, they aren't seeing how nicely designed your site is. What they're looking for are words — which they're grabbing to include in their databases. You, the site owner, want to make sure that your posts and pages use the words and phrases that you want to include in search engines.

If your post is about a recipe for fried green tomatoes, for example, you need to add a keyword or phrase that you think people will use when they search for the topic. If you think people would use the phrase recipe for fried green tomatoes as a search term, you may want to include that phrase in the content and title of your post.

A title such as A Recipe I Like isn't as effective as a title such as A Recipe for Fried Green Tomatoes, right? Including it in your post or page content gives the search engines a double keyword whammy.

Here's another example: I once wrote a post about a rash that I developed on my finger, under my ring. I wrote that post well over a year ago, not really meaning to attract a bunch of people to that particular post. However, it seems that many women around the world suffer from the same rash, because a year later, that post still gets at least one comment a week. When people do a Google search using the keywords rash under my wedding ring, out of a possible 743,000 results returned, my blog post appears in the top five slots.

This is how great blogs are! I was actually able to solve my problem with the rash under my finger because one woman from Australia found my blog through Google, visited my blog post, and left a comment with a solution that worked. Who says blogs aren't useful?

Creating categories that attract search engines

One little-known SEO tip for WordPress users: The names you give the categories you've created for your blog provide rich keywords that attract search engines like bees to honey. A few services — Technorati.com being one of the biggest — treat categories in WordPress like tags. These services use those categories to classify recent blog posts on any given topic. The names you give your categories in WordPress can serve as topic tags for Technorati and similar services.

Search engines also see your categories as keywords that are relevant to the content on your site. In this regard, it's important to make sure that you're giving your categories names that are relevant to the content you're providing on your site.

If you sometimes blog about your favorite recipes, you can make it easier for search engines to find your recipes if you create categories specific to the recipes you're blogging about. Instead of having one Favorite Recipes category, you can create multiple category names that correspond to the types of recipes you blog about — Casserole Recipes, Dessert Recipes, Beef Recipes, and Chicken Recipes, for example.

Note

Creating specific category titles not only helps search engines, but also helps your readers.

You can also consider having one category called Favorite Recipes and creating subcategories (also known as child categories) that give a few more details on the types of recipes you've written about. (See Chapter 8 for information on creating categories and child categories.)

Categories use the custom permalink structure as well. So links to your WordPress categories also become keyword tools within your site to help the search engines — and ultimately, search engine users — find the content. Using custom permalinks gives you category page URLs that look something like this:

http://yourdomain.com/category/Category_Name

The Category_Name portion of that URL puts the keywords right into the hands of search engines.

Using the <ALT> tag for images

When you use the WordPress image uploader to include an image in your post or page, you're given a Description text box in which you can enter a description of the image. (I cover using the WordPress image uploader in detail in Chapter 9.) This text automatically becomes what is referred to as the <ALT> tag.

The <ALT> tag's real purpose is to provide a description of the image for people who, for some reason or another, can't actually see the image. In a text-based browser that doesn't display images, for example, visitors see the description, or <ALT> text, telling them what image would be there if they could see it. Also, the tag helps people with impaired vision who rely on screen-reading technology, because the screen reader reads the <ALT> text from the image. You can read more about Web site accessibility for people with disabilities at www.w3.org/WAI/References/Browsing.

An extra benefit of <ALT> tags is that search engines gather data from them to further classify the content of your site. The following is the code for inserting an image, with the <ALT> tag of the code in bold to demonstrate what I'm talking about:

<img src="http://yourdomain.com/image.jpg" alt="This is an
       ALT tag within an image" />

Search engines harvest those <ALT> tags as keywords. The WordPress image uploader gives you an easy way to include those <ALT> tags without having to worry about inserting them into the image code yourself. Just fill out the Description text box before you upload and add the image to your post. Chapter 9 covers in-depth information on adding images to your site content, including how to add descriptive text for the ALT tag and keywords.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.48.244