How to Fix Landing Sites Plugin
Posted by Ken Cheung on Tuesday, July 18, 2006 in How-to, Reviews, WordPress : : 10 commentsI finally got around to testing the Landing Sites plugin for WordPress.
Don't let the name fool you. The plugin does not create or direct visitors to a landing page. Instead, the plugin displays related links when visitors come to your site via a search engine. The idea is that when visitors are referred to your site from a search engine, they are looking for something specific – often they quickly check the page they land on and then leave if what they are looking for isn't there. This plugin creates additional links for your search engine visitors to increase the stickiness of your site.
Incorrect Instructions
In my test, the plugin worked as advertised. However, I did encounter a few problems. First, the instructions mentioned renaming the files (as in plural) extension to .php. However, my zipped file only contained one file and it was already a .php file. I downloaded the file again and got the same result. I looked around the plugin site and did not find any newer version. So, I concluded the instructions must have been for an older version.
Error After Installing
The second problem I encountered was copying and pasting the code to generate the related links. When I did so, I got an error message when I tried to load the page in the browser. After spending more time than I care to admit, I finally discovered the problem has to do with WordPress converting quotes into stylized quotes. So, when you copy a quote from a WordPress page and paste it into a text editor like Homesite, you don't actually get a quote. Instead, you get a special character that looks like a quote, but doesn't behave like one. As a result, the plugin crashes and you get an ulcer. After I converted the special characters to normal quotes, the plugin worked.
RSS Feed via Google
The third problem I encountered was with RSS feeds via Google. If you click on a RSS feed link to your site from Google, the plugin is triggered. You get something like the screen shot below (notice the missing keyword after "searching for" and no related posts):

To fix this problem, you need to add a short line of code to the landingsites13.php file. The new line of code tells the plugin not to activate if no keywords are found. Between these two lines (around lines #161-2):
$terms = ls_get_terms($delimiter);
if($what == 'isref') { return true; }
Add this line:
if (!$terms) return false; // skip if from google rss feed
So, the end result is:
$terms = ls_get_terms($delimiter);
if (!$terms) return false; // skip if from google rss feed
if($what == 'isref') { return true; }
Unrelated Pages Displaying as Related
The next problem I encountered is unrelated pages showing up in the related posts results. As you can in the screen shot below, my newsletter confirmation and verification pages are showing up as related.

I blogged about this problem with the Related Posts plugin previously and the solution can be applied here as well. Remove the reference to ‘static' around line 126.
Before change:
. "AND (post_status IN ( 'publish', ‘static' )) ";
After change:
. "AND (post_status IN ( 'publish' )) ";
After the change, pages are no longer displayed as related posts:

[...] The other problem I have with the fancy quotes is that some of the WordPress plugins choke on the fancy quotes. This usually happens when you are on a site (like this one) that explains how to do something by copying and pasting some code from their site. If the code involves quotes, WordPress turns them into fancy quotes. So, when you copy a quote from a WordPress site and paste it into a text editor like Homesite, you don't actually get a quote. Instead, you get a special character that looks like a quote, but doesn't behave like one. As a result, a plugin like the Landing Sites Plugin crashes. [...]
Ok this post might be old, but it is very useful :) thanks a lot for that I had a bad time with the results of the Google RSS feeds until I found your fix.
Thanks again
Thanks so much for this – I've been cursing merrily away for the past hour or so, and it was the curly quote marks that tripped me up as well.
You've saved me an unbelievable amount of frustration.
Why on earth hasn't the plugin's author addressed this issue on his post???
Do you know how we can remove the related post to the post you view?
Sorry, I do not know and don't have time to look at their code.
Thank you for the heads up on this plugin, It's a great usability function, looks like the dev isn't active. Someone could pick this one up and flush it out.
[...] There is more information about a fix here http://izachy.com/2006/07/18/fix-landing-sites-plugin/ for the original version. Eeek! I'd like to use this, but will try it out on a [...]
[...] Här hittade jag en del av det som till slut fick Landing Sites att funka här hos mig: Hämta Landing Sites HÄR Landing Sites på svenska: med mer info om pluginet o hur det funkar. selig.se – Wordpress-plugin landing sites på svenska Izachy – How to fix Landing Sites [...]
Ken, Great article and very helpful.
I tested this plugin in IE7 and FF3 and it works like a charm. However IE6 does NOT work and it gives blank value for _SERVER[HTTP_REFERER$] variable when the request comes from IE6.
Are you aware of this and what is the work around for this?
Please share with us your thoughts.
Thanks, JK
I wasn't aware of the problem. I think it use to work on IE6. I think I upgraded to IE7 after this post. I'll see if I can find a computer with IE6.