SEO Anchor Text SEO Anchor Text SEO Anchor Text SEO Anchor Text

(Reading time: 3 – 5 minutes)

Do I have your attention?

Good.

I’ve mentioned this before, anchor text matters.

If linking is the door to higher search results, anchor text is the key that unlocks that door.

I know this for several reasons. I rank pretty well for a couple of long tail terms. I also watch as many of those free SEO videos as I can from people like Brad Callen, Andy Jenkins and the like. You know, the Stompernet guys and big time internet marketers. They give away a lot of good stuff for free. And if they’re a-givin’ I’m a-takin’.

Using anchor text naturally, such that it doesn’t break the flow of your prose (and sound all weird) is a bit of an art.

But first you have to get the anchor text (if you are linking), or find a way to provide it people who want to link.

1. Ask for anchor text

If you aren’t sure what anchor text to use when linking to an article, ask the article’s author.

If you’re an author, provide anchor text information to people who want to link to you.

If you find yourself being linked to with unsuitable anchor text, here’s what Erica Douglass does:

I send them an email thanking them for linking to my blog, and then say “Instead of erica.biz as your link text, can you put ‘starting your own business‘?” (I’ll also often throw in an entire sentence with the <a href=""></a> etc. already in there.

Sometimes it works. Sometimes it doesn’t. I’ve gotten most of my good rankings from guest posting and putting the SEO’d text in my blurb. I show how to do this in Guest Post Secrets.

2. Using SEO keyword metadata

STOP.

I’m not going to write what you think I’m going to write about keywords. Instead, I’m going to make an offer. First:

Use your meta keywords to specify your preferred anchor text.

That way, when I want to link to you, I’ll know what you want to rank for. I just look at the source for your page, extract what I need. Easy.

Here’s the offer: if you want to link to one of my articles, and you find that it (the article) has no keyword metadata (there are plenty, too many), email me, I’ll add keywords you can use for anchor text, and send you a free copy of Blog Post Engineering when I get the trackback from your link.

3. Let’s plug it in

If the notion of specifying keyword metadata is simply too repellent, I offer a tiny plugin for your amusement.

Since it’s Tuesday, we can go technical.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Plugin name: Fast Anchor Text
 * Plugin URI: http://website-in-a-weekend.net/seo-anchor-text
 * Description: Set desired anchor text as custom field.
 * Version: 0.1
 * Author: Dave Doolin
 * Author URI: http://website-in-a-weekend.net/
 */
 
function anchor_text_meta() {
 
   if (is_home()) return;
 
   global $post;
   $anchor = get_post_meta($post->ID, 'anchortext', true);   
   if ($anchor) {
      echo "<meta name=\"anchortext\" content=\"$anchor\" />\n";  
   }
}
add_action('wp_head', 'anchor_text_meta');
?>

If you don’t like plugins, and you prefer messing around with functions.php (or custom_functions.php in Thesis theme), you can just paste the functional parts into those files.

Here’s a screenshot of how to use it:

Custom anchor text

Key in blue box, anchor text in red box

Here’s the plugin file: anchor.zip.

Blog Maintenance Challenge

Believe it or not, I am slowly yet surely adding material to the Blog Maintenance Challenge. Dealing with keywords and anchors is definitely on the curriculum.

I’ll have some videos over there too.

WordPress Plugin Activation using PHP classes

(Reading time: 2 – 3 minutes)

In the last two DIY WordPress articles we examined the basic structure of registering an activation hook for a plugin, and we found out what, exactly, comprises a minimal WordPress plugin.

Next, we’re going to step it up, and show one way plugins built using PHP classes register activation functions.

We’re going to do it with two files, a driver file and a class file. Let’s take a closer look.

Plugin driver file

The driver file:

  1. loads the class file;
  2. instantiates the class;
  3. registers the functions for activation and deactivation (hooks).

Here’s what the code looks like:

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
/*
 * Plugin name: A Class Activator
 */
include dirname(__FILE__).'/class.php';
$myclass = new MyClass();
 
/* Make the class works first */
if (isset($myclass)) {
   register_activation_hook(__FILE__, array($myclass,'activate'));
   register_deactivation_hook(__FILE__, array($myclass, 'deactivate'));
}
?>

Let’s take a look at the class next.

Plugin class file

For this example, the class is simple, just the activate and deactivate function.

1
2
3
4
5
6
7
8
9
10
11
12
<?php
Class MyClass {
 
   function activate() {
      add_option('a_myclass','Activated');
   }
 
   function deactivate() {
      delete_option('a_myclass');
   }
}
?>

These functions can be named anything you want, say, “foo” and “bar.”

Simple, right?

This isn’t the only viable pattern using classes. There’s many more, experiment a bit, find your own pattern that works.

More plugin activation coming

And stay tuned, because next week concludes this series with a short article giving you three necessary and sufficient conditions for register_activation_hook. It’s easier than you think, and you’ll see why we needed to take a look at how WordPress deals with named plugins last week. Once you understand these three conditions, you won’t have to experiment, you can just design.

As it should be.

If you have any questions, please leave a comment. Alternate techniques? Leave a comment as well. I’ll clean up the formatting if necessary, or just add it in here with a link to your website.

Finally, I’ll give the first person who can guess why I named the plugin “A Class Activator” and the option “a_myclass” an hour of blog post engineering.