I’ve recently been building my own NLP Life Coach site. And yes, I’ve been using all the WordPress skills I’ve acquired from building sites for other people the last few years. Very handy! It’s been quite a task, mainly as I probably know too much and spend far too much time tweaking things so they’re just right rather than getting any content together… Anyway, I’ve just published my very first NLP Life Coach podcast called “2011: A Retrospective Of A Wonderful Year Ahead”. (Have a listen – it’s pretty bloody good. Even if I do say so myself… and I do!).
As I sat and admired my handiwork, I noticed something missing. Yes, I’m using the all the SEO tricks I possibly can. I even found this nifty little WordPress Facebook Like plugin (by AJ Batac) to use on the site. I like it. It has those pictures of people you know appearing under the “Like” button – not like the one I’m using on this site. Cool.
…but, here’s the problem:
“The WordPress Facebook Like plugin doesn’t work with Pages!”
Not good. I’m quite proud of the jQuery tabs on my NLP Life Coach Contact page on my new site. It would be nice if people “Liked” it. Or had the option to! For some reason, this option isn’t built into the plugin.
But it’s okay folks… I got another WordPress Hack to fix this page issue. And it’s simple too! So here it is:
The WordPress Facebook Like Plugin Pages Hack
Important: Always remember to make a backup of any files you edit! You have been warned.
- In WordPress, click on Plugins / Editor.
- For “Select plugin to edit:“, choose the WordPress Facebook Like plugin and click Select.
Alternatively,you can use your favourite editor and open:
- Look for the following on line 198:
if( !is_feed() && !is_page() && !is_archive() && !is_search() && !is_404() )
- Change it to read:
if( !is_feed() && !is_archive() && !is_search() && !is_404() )
- Click the blue “Update File” button and save the file.
- You’re done!
All that’s really been done here is to remove the !is_page() function so the plugin doesn’t look to exclude it from Pages.
When you check your Pages, you should now see that you have the WordPress Facebook Like plugin working on Pages!
Improving the WordPress Facebook Like plugin
Having looked at the code, it wouldn’t take much to add something like this:
<h2>Posts & Pages Setting</h2>
<div>The Post Type of the plugin (Default: Posts)</div>
<select name=”wp_fb_like_posttype” id=”wp_fb_like_posttype”>
<option value=”post” <?php if (get_option(“wp_fb_like_posttype”) == “post”) echo ‘selected’; ?>>Posts</option>
<option value=”pages” <?php if (get_option(“wp_fb_like_posttype”) == “pages”) echo ‘selected’; ?>>Pages</option>
<option value=”both” <?php if (get_option(“wp_fb_like_posttype”) == “both”) echo ‘selected’; ?>>Both</option>
to make another option, then have a few conditional statements so people could select what they’d prefer to output.
…but I’ll leave that to AJ Batac to update!
For the moment, it’s worthwhile checking out the WordPress Facebook Like plugin. Even if you do need to use it on Pages, a slight code tweak and it can be easily done.