Featured Photos

Baseball Hall of Fame - 8/23/11

Featured Video

Avery's QuEST Project - It's Healthy!

House Construction

The Completed Home Renovation

Home Renovation - Complete!

Our House Construction Photoblog

RSS Feed

« | Main | »

Linking WordPress to Facebook – My non-ideal solution

By Brian | June 21, 2009 | Share on Facebook

Warning: This is one of those technical posts that won’t make much sense to many people, but will be a goldmine to those who have exactly the same problem I was just working on. OK, now that that’s out of the way, let’s begin:

A few weeks ago, I became both a Blogger and a Facebook user. One of my first tasks on Facebook was to find a way to link my blog posts to my Facebook Wall & News Feed, so that my Facebook friends could read my posts without me needing to cross-post them.

The first step was Facebook’s built-in RSS reader. Unlike a lot of things in Facebook, this works as advertised. Trouble is, it doesn’t provide a link to the blog post. Rather, it copies the blog post into a Facebook “Note,” and provides a link to the note. This is OK (everyone still gets to read the post), but it divides any discussion about the post into two groups – the Facebook group (who comments using Facebook’s built-in comment feature) and the blog readers (who comment using the blog’s comment box).

Step two was to find a WordPress plugin that would automatically “share a link” to my post whenever I posted something to the blog. After much Googling, the tool of choice seems to be WordBook. This plugin does exactly what I described – you install it in WordPress and then link it to your Facebook account with a handy link in the Settings page that the plugin gives you. When you’re done, every time you post to your blog, a link to the post appears on your Facebook wall. At least I hope that’s what it does, because I never saw it actually work. Seems WordBook requires PHP 5.0 or greater, and my web hosting provider (Yahoo Small Business) only supplies PHP 4.3.x. There’s a lot of documentation on Yahoo’s site about how they now support PHP 5.0 (which is, as I understand it, almost three years old now!), but there’s no indication about how to upgrade PHP, nor do I remember ever selecting a PHP version when I signed up.

If your provider gives you PHP 5.0 or higher and you’re looking to accomplish this linkage, I’d love it if you tried WordBook and then commented here about whether or not it worked. From everything I’ve read, it really does look like the right answer.

But alas, we press on. My next idea was to put a “Share on Facebook” link on the blog itself, and then click that link myself every time I posted a blog entry (I always go look at the entry on the blog itself after I publish it – just to make sure WordPress didn’t do anything funny to it in the publishing process). Accomplishing this was relatively easy. Facebook has a Share Partners page that provides embed code to share pages. I put that code in my “Single Post” template (single.php) and my “Main Index Template” template (index.php) and set off to try it.

That works, except for one small hitch: the code they give you is javascript, and javascript seems to execute after php code when a page is loaded. So, the functionality on the single post page is fine, but on the main index page, the “Share to Facebook” link was always linking the last post on the page, regardless of which post’s “Share” link I clicked on. Changing this is above & beyond my ability, so I took the link off my Main Index template page.

Bottom line: with this post, I’ve removed the automatic RSS feed from Facebook (no more Facebook notes!). Each time I post to my blog, I’m going to (try to) remember to open the post’s individual page (not the main blog page) and click the “Share to Facebook” link. Users will see an entry on my wall (and in their news feeds) as they did before, but the link will take them to my blog, not to a Facebook note, where they can read the post in all it’s blog-like glory, and then (hopefully) comment on it using the blog tools. They still have the option of using the “Comment” button on the iFrame header that Facebook keeps above the page, so it’s not perfect.

Also, I’m not sure how my stats engine (Google Analytics) will handle these requests. Ideally, I’d see counts for everyone who visits my blog there, but that iFrame means that the page Facebook users are seeing doesn’t have a familygreenberg.com domain (they won’t get that unless they click “remove the frame” at the top). That said, Facebook is making a request to my server, so maybe Analytics will identify that request as a pageview and record it for me. Good for accurate stats & ego building which, after all, is the purpose of a blog in the first place, right?

Anyway, I’ll try it like this for a while and see how it goes. I can always switch back…

Topics: Blogging about Blogs, Tech Talk | 4 Comments »

4 Responses to “Linking WordPress to Facebook – My non-ideal solution”

  1. XkiD | Linking WordPress to Facebook – My non-ideal solution | blog.xkid.ro says at June 21st, 2009 at 4:13 am :
    [...] more: Linking WordPress to Facebook – My non-ideal solution Posted in News, PHP | Tags: facebook-wall, few-weeks, iphone, laoag, make-much, posts, [...]

  2. Linking WordPress to Facebook – My non-ideal solution | Web 2.0 Designer says at June 21st, 2009 at 7:17 am :
    [...] Go here to read the rest: Linking WordPress to Facebook – My non-ideal solution [...]

  3. Linking WordPress to Facebook – My non-ideal solution | Web 2.0 Designer says at June 21st, 2009 at 7:17 am :
    [...] Read more from the original source: Linking WordPress to Facebook – My non-ideal solution [...]

  4. R says at September 25th, 2009 at 10:57 am :
    Thank you for the recommendation!


Comments will be sent to the moderation queue.