Get a free consultation now
Name  
Phone  
Email  

Client: PSIwebware.com

“The design team at Industry Forge listened to what we needed and made it even better than we expected. They helped us structure our site effectively for Search Engine Optimization, and we landed the number one spot on the first page on our key search terms within a few months. It was a pleasure to work with everyone involved.”

– John Harris, PSIwebware.com

Archive for June, 2009

How to Use WordPress Functions In Your Site The Search Engine Friendly Way

Monday, June 29th, 2009

I use a really simple MVC framework that I’ve developed over the years to create many of the websites I’ve built. I recommend that my clients have some portion of their site that is updated frequently with new relevant text. Sometimes I use WordPress to handle the blog portion of the site. WordPress provides a nice user interface for creating new content, managing comments, and is relatively simple to make search friendly. In most cases, I like to include portions of WordPress generated content outside of the blog itself. We’ve even done this on our own Industry Forge website.

I thought there might be a simple way to include the WordPress functions I needed outside of WordPress. I went to Google and searched for “show wordpress posts outside of wordpress.” I found a few articles on how to include the wp-blog-header.php file from WordPress to give your php script access to all the WordPress functions. They all provided a bad solution:

Wrong Way to Include WordPress Functions In Your Site

define('WP_USE_THEMES', false);
require('./blog/wp-blog-header.php');

This seemed to be a pretty simple way to get what I wanted quickly. I was happy with the solution for a few days until I saw the 404 errors begin to show up in my Google Webmaster Tools account for this domain. I was a little perplexed that Google had been picking up 404 errors from pages that actually existed. You don’t want your site to throw 404 errors on pages that actually exist. It’s not search engine friendly at all (even though users don’t know the difference unless they’re closely examining all the headers received by their browser). I realized that this method was not the right choice for me. It was not search engine friendly at all, and would cost me big-time in my own SEO efforts.

It turns out that since I was loading the wp-blog-header.php file before loading any of the rest of my own framework, and because WordPress could not find the specific requested page in its database it sent a 404 header. I verified this with the Live HTTP Headers add-on for Firefox. I never intended for WordPress to actually handle the delivery of the page—I only wanted a few of the recent blog posts—but how was WordPress to know that? Its built to be a full CMS system (I know, I should rethink using it this way). But wait! There is a simple fix.

The Simple Fix

I did a bit of poking through the massive WordPress codebase this morning looking for all the lines the would produce a 404 error. Of course after just a few minutes I thought, “what am I doing? Certainly some astute web developer has had this issue before and has likely posted a solution on his or her blog.” I was right. Thanks to a writing style much more succinct than my own, I was able to look at the post by the nice folks at Adrogen (a Denver website design company) and quickly implement the solution they offer. They suggest using the following 5 lines of code to include WordPress instead of just including the entire WordPress framework:

Correct Search Engine Friendly Way to Include WordPress Functions In Your Site

require('blog/wp-config.php');
$wp->init();
$wp->parse_request();
$wp->query_posts();
$wp->register_globals();

Thanks, Adrogen. You saved me a lot of headache and a lot of illegitimate 404 errors being sent to Google.

Microsoft Comes to Lehi

Thursday, June 18th, 2009

I just read an article in this morning’s paper about Microsoft opening an office at Thanksgiving Park in Lehi, Utah.  This is great news of course for Lehi and the area.  Of course, there are already other Microsoft locations in Utah, including an R&D shop in Draper and a sales office in Salt Lake City.  Microsoft seems to see the same potential here in Utah that I saw when opening a branch office here for a California based marketing firm a few years ago; that is—smart, hard-working talent at much better rates than many places in California.  Utah will continue to attract great companies (as has been done in the past) because of its very capable workforce.  Our friends at Silicon Slopes will be happy to continue covering the latest.  Now if we can just get Microsoft to notice our Utah web design firm down the street…