Sticky Features for your Blog Network with WordPress MU 2.8: Part 2

October 2009

Community features—gravatars

Gravatars are Globally Recognized Avatars. They allow people to carry the same avatar from site to site without having to register at each site and take the time to upload an image. Gravatars are supported by IntenseDebate by default. If a user has a gravatar and gives the email address that the gravatar is tied to when they make a comments, then the gravatar will be displayed beside that comment. Since version 2.5, WordPress MU has had gravatar support built in. Let's add gravatars to our post pages.

Time for action – gravatars in WordPress MU

  1. Open your theme's index.php file. In our case we are editng the Blue Zinfandel theme.
  2. Find the secton that begins with < div class="contentdate" > .
  3. Remove all markup up to the closing tag and insert the following code:
    $email = $authordata->user_email;
    $hash = md5($email);
    $uri = '' . $hash . '?d=identicon&r
    $headers = wp_get_http_headers($uri);
    if (!is_array($headers)) :
    echo "<h3>";
    echo the_time('M');
    echo "</h3><h4>";
    echo the_time('j');
    echo "</h4>";Stcky Features for your Blog Network
    [ 142 ]
    elseif (isset($headers["content-disposition"]) ) :
    echo get_avatar( $authordata->user_email, $size = '50') ;
    else :
    echo "<h3>";
    echo the_time('M');
    echo "</h3><h4>";
    echo the_time('j');
    echo "</h4>";
  4. Save and upload the file.
  5. If you wish to use gravatars on user blogs, you will also need to edit the user's version of the theme file.
  6. Now, if a post author has a gravatar, it will be displayed in the title secton of their posts. If not, the default Date of Post box will appear instead.

What just happened?

We have used the built-in WordPress MU gravatars function to display a member's gravatar in the title section of any posts they make.

As the default No Gravatar Set image is rather boring, our code checks to see if the author in question has a gravatar. If the author does not, or if the Gravatars web site is not accessible for any reason, then we display the normal post date icon instead.

Gravatars provide a way for people to carry their identity from site to site. Showing a recognizable face for your site's authors builds recognition among readers and helps readers and blog authors to build a relationship with each other.

You might be wondering why the output in the previous code is broken into several echo statements. I have chosen that method purely because I find it more readable. You could save yourself some typing if you built an echo statement similar to this one:

echo "<h3>". the_time('M')."</h3>"

Have a go hero – gravatars and themes

The code used to edit the SlayerCafe blog theme was very simplistic. The theme you are using for your site may be structured differently.

In the theme for the SlayerCafe, the calendar icon that shows the date of the latest post is coded into the CSS file. The change I have made to the index.php file does not prevent the calendar icon from being loaded. The gravatar image simply loads over the top of it.

Try reworking the theme file to correct this. One way to do so would be to create a copy of the contentdate class in the styles.css file, which does not load the calendar image. Call the new class contentgravatar and then create different < div > tags to be displayed depending on whether you wish to show the calendar or the gravatar.

Encouraging sign-ups with downloads for members only

If you offer file downloads, restricting some of them to only members is a good way to encourage people to sign up. It is a good idea to offer some file downloads to visitors who are just passing through so that you can build up their trust, as some people are uncomfortable giving out their email address to an unknown web site. Also, some people do not want to take the time to register to download a file, especially if they don't know if it is going to be a worthwhile download.

A good compromise is to offer some files to everyone and other files for members only, or to offer some content on your blog and then a download in a more convenient form.

As an example, some of the Watchers on SlayerCafe could run tutorials about demon identification and slaying techniques. They may offer text and image versions as blog posts, with an MP3 version of the lesson that registered Slayers could download to listen to while they are on patrol. This is likely to have a high conversion rate in terms of registrations; the visiting Slayers will hopefully be impressed by the quality of the information in the tutorials and want to download the audio version.

One useful plugin that restricts downloads to registered users only is the User Only Downloads plugin available at This plugin is very easy to use. For some reason the author uploaded the plugin to WPMU Dev as a text file, so you will need to rename it to a .php file before you can use it. Just upload the renamed file to your mu-plugins folder and tell your users that they can restrict file downloads to members only by using the following tag in their posts:

[user_download URL]

Logged in users will see a download link, while everyone else will see a bold message telling them that they need to be logged in to download files.


Welcoming new visitors

Blog networks can be confusing when you first visit them. Why not ease the confusion a little by showing first-time visitors a special welcome message at the top of the page, which explains what the site is about and invites them to get involved in some way?

Time for action – creating a welcome message

  1. Download the What Would Seth Godin Do plugin from
  2. Copy the what_would_seth_godin_do.php file to your /wp-content/plugins folder.
  3. Activate the plugin in your admin panel.
  4. Turn on auto-activation using Plugin Commander.
  5. Go to Settings | WWSGD and add a welcome message for new members.
  6. Leave the Repetition setting at the default (first 5 visits).
  7. If you have something you would like to alert regular visitors of, you can use the Message to Return Visitors box.
  8. I recommend testing the plugin with the Location of Message set to Before Post. If you don't like the location of the message, change the setting to use the template tag instead.

    Sticky Features for your Blog Network with WordPress MU 2.8: Part 2

  9. New visitors to your site should see a welcome message like this one:

    Sticky Features for your Blog Network with WordPress MU 2.8: Part 2

What just happened?

The What Would Seth Godin Do plugin uses cookies to distinguish between first-time visitors and regular visitors. You can use this knowledge to offer visitors a different experience depending on how many times they have visited the site.

If a visitor comes to your site via a link on someone else's blog, they may not realize that they are visiting a blog network and may not understand what the site is about. A simple message letting them know the subject of the site and inviting them to create their own blog or subscribe to the site's feed should help to point them in the right direction.

You may not want to show a message to returning visitors all the time, but if you have a promotion or special offer that you'd like to display prominently, then using the What Would Seth Godin Do plugin is a convenient way to do so.

The default Before Post setting did not work well for SlayerCafe, so I edited the index.php and home.php template files to get the welcome message to appear in the right place. For the theme I was using, the following code:

<?php wwsgd_the_message(); ?>

should be placed below the line that says:

<div id="contentmiddle">

If you decide to use template tags to display the welcome message, don't forget to add the tags to all of the themes that you will be allowing your users to select.

Welcome message not showing up?
If you can't see the welcome message, you may need to clear your cookies, or at least delete the cookies for the blog network. Most browsers make it easy for you to find the cookies that belong to a particular site. For example, in Firefox just go to Tools | Options, click on the Privacy tab, and then click Show Cookies..... Use the search box to find the cookie you want to delete, select it, and click Remove Cookie.
See the following screenshots for a clearer idea of what you're looking for.

Sticky Features for your Blog Network with WordPress MU 2.8: Part 2

The Cookies screen allows you to see a list of all the cookies Firefox has stored, and you can find the cookies related to your site by using the search box.

Sticky Features for your Blog Network with WordPress MU 2.8: Part 2

Related posts for visitors from search engines

If visitors arrive on your blog network via a search engine, it's likely that they are looking for some information about a specific topic.

Why not take advantage of that by showing search engine-referred visitors a list of posts related to the keywords they searched for?

One way to achieve this is to use the Search Engine Related Posts plugin available at Just install the plugin as normal and then add the following markup:

<div style="display:none" id="search_content"></div>

to your theme files at the point where you want the list to appear. For most people, this would be after the post display section of their index.php file.

The plugin will check the referrer details of your visitors and only show a list  of related posts to the people who have been referred by a search engine. This increases the chance of those visitors staying around to read more articles, finding what they need, and becoming a  regular reader of your site.

Regular visitors are probably reading your blog to stay up to date with the latest news and don't need to see a list of links to older posts, as it is likely that they have already seen them.

Other ways to engage the community

The above are just a few ways you can engage your visitors. There are many others that you may want to look into. Here are a few for inspiration:


Allowing your members to create polls is a useful way to get feedback from your members and to add a little interactivity to the site. If your site's authors pick the right questions, the information gathered from the polls can be useful, too.

A good polls plugin is:

This is one of the easier plugins to get working with WordPress MU. Many of the standard WordPress poll plugins require several steps to activate them on each member's blog,  but PoWPoll can be set to automatically activate on new blogs.

The plugin supports voting restrictions, such as one vote per IP address, and restricts vote casting to logged-in visitors.

Sitewide searching

Making it easy for your visitors to find the content they are looking for is an important part of making a sticky site. With a niche blogging network, it is likely that  someone who is interested in the posts of one member will also be interested in the posts of  others. They may want to search for posts on a specific topic contained anywhere within the network.

There are a number of ways you could implement a sitewide search feature. There are some plugins, such as One Search (, that tie in to WordPress MU to allow sitewide searching, or you could use Google's Site Search.

One Search requires that the user who is accessing the WordPress MU database has  the rights to create VIEWS. At the time of writing, the code available on the plugin  author's web site will also need to be tweaked to work with WordPress MU versions 2.7.1  and  above.

It is possible to integrate Google Custom Search Engine so that the results page  fits with your template. You can learn more at


This article covered ways to make your site sticky so that when you attract new visitors, they stay around and become part of the community.

We learned about using contact forms to make it easy for our visitors to contact us, and adding a more personal feel to blog posts through the use of gravatars. We also learned about comments and how to make the discussion that takes place in the comments sections of our blogs easier to follow through rating, threaded discussions, and subscription options.

We discussed the value of related posts links to help our visitors find posts that may interest them, and we talked about using polls and searches to draw users in to the site encouraging them to explore everything the site has to offer and making them feel like a part of the community. We also discussed some other ways to improve the experience for both new and regular visitors, including displaying different messages to new visitors to help them "find their feet" on the site.

So far, we've looked at ways to encourage readers to engage with the authors who own blogs on our site. This is a good way to build regular readers. Many people enjoy joining in with discussions on the Internet, but do not want to run their own blog—perhaps because they don't have the time to commit to writing on a regular basis. Such people may still want to discuss issues relating to our site's niche in more depth. That way, bigger discussions can take place in one central location instead of being spread out across various blog comment sections.

If you have read this article you may be interested to view :

You've been reading an excerpt of:

WordPress MU 2.8: Beginner's Guide

Explore Title