PHP Code, SEO Optimization, Web

Hacking WordPress to Encourage Visitor Loyalty

I've spent quite a bit of time modyfing the default WordPress template for the purpose of SEO optimization. I've changed the way the title displays; I've added meta tags; I've written with searcher-friendly content. The techniques are working (I have a steady increase in web traffic), but still a problem remains: most searchers are coming onto my site for the content they search for, and leaving from the same page. So my new goal is to get people to stay on the site, and here's the first modification I'm making in that regard…

So in the last month I've had a large increase in traffic from Google & MSN search engines. In analyzing the keywords that people are searching on to get to my site, I found that most are programming problems to which they need a solution. Basically they'll enter my site for that one page, get the solution, and exit. I however, would like to pique their interest, maybe get them to check out the latest posting.

Unfortunately WordPress only shows new postings on the home page. So I whipped up this code, and placed it in 'sidebar.php', right before the line that displays the list of pages. You can change the number of latest posts shown, but I only wanted to show one… for now.

if (is_single()) {
   $posts = get_posts('numberposts=1');
   foreach ($posts as $post) :
    <li><h2>Latest Post:</h2><br />
    <a href="<?php the_permalink(); ?>"><?php the_title() ?></a></li>

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image