[…] pour résoudre ses deux problèmes il faut utiliser deux petits hacks qui sont présentés sur cette page et le tour est joué… Vous venez peut être de fidéliser […]
Landing Sites, WP-Cache and Google Reader
Note: This post is over 2 years old. You may want to check later in this blog to see if there is new information.
The following links are auto-generated but may help you locate newer content:
One of my favorite functionalities of this blog was the Landing Sites plugin from The undersigned, which I lost when I started using WP-Cache. So I needed to change a few things.
- I needed it not to display a landing site page for Google Reader users
- I needed it to work with WP-Cache which was becoming more and more vital as my traffic increased
- I needed a modified version that would break apart the request string on a 404 page and try to guess what the user was actually looking for and offer helpful suggestions, in the case of broken or malformed links to my blog
Here are my current solutions:
Please note that I have not yet made a full switch to Wordpress 2.1 on my live site, so these are not fully battle tested. I’d be interested in feedback reports, if anyone has the guts to try.
1. The Google Reader Problem
First, Google Reader was showing up as plain old Google, so I just added a catch to the Landing Sites plugin that checked for “/reader” in the referrer string. The code looks like this:
Right Click to Download: ls_get_refer.txt. Or just click it and copy the text from your browser…
The code to note is on the 9th line of the above snippet. This is modified from version 1.3 of the Landing Sites plugin. You can open up the landingsites13.php file and replace the whole ls_get_refer function with this code and your Google Reader problems will be solved. You may also want to go ahead and add the relatively new search.live.com to the search engines (delim = q) while you’re at it.
2. The WP-Cache Problem
This one took some head-scratching. WP Cache basically overrides Landing Sites ability to serve up dynamic content based on the referrer. There were a few options for fixing this, but I eventually decided just to have a check at the beginning of the wp-cache plugin that would disable caching on a page if there was a valid search-engine referrer. I copied out and modified the code from the Landing Sites plugin and included it in the wp-cache-phase1.php file in the wp-cache plugin directory. I inserted the following code starting at line 9, after the “$new_cache = false;” and before the comment “// Don’t change variables behind this point”.
Right Click to Download: wpcache-ls-snippet.txt. Or just click it and copy the text from your browser…
That runs the same checks that the Landing Sites plugin runs, but does it at a point where the caching plugin is completely disabled if it finds a matching referrer. Note that search.live.com has been added and the Google Reader hack is included in this code. I make no guarantees, so back up your plugin before making any modifications.
To use this hack:
- Upload/activate the Landing Sites plugin if you haven’t already
- Add the necessary code to your template
- Download or open a copy of wp-cache-phase1.php from the WP Cache plugin
- Insert the above code at line 9
- Save the file and upload it to the wp-cache directory in your wp-content/plugins directory
- Refresh your site in your browser
- If all is well, search for your site on Google and follow the link
- If it’s working, you should now get a landing page
- If anything goes wrong at any point, just replace wp-cache-phase1.php with your backup copy
3. The 404 Guesser
I was all set to post my custom code for this when I realized it’s been done. No surprise… it’s really useful. I’ve had quite a few links to my site get cut off in email messages because my titles were too long (I’ve started using shorter slugs, but my permalink structure kind of makes that a moot point) but this system will help people find the right post anyway. Most of the time…
Well, hopefully this post will help a few people out. If you have any questions or improvements on my ideas, please let me know. I’m not a programmer by any means, and am not confident that these are the best methods for accomplishing the necessary tasks. But they’re working! 
-
05.11.07 / 12am
-
06.27.07 / 8pm
Muito obrigado pelo hack! Funcionou. Parabéns.
Abraços do Alessandro.
-
06.27.07 / 8pm
Você é bem-vindo.
-
07.23.07 / 11pm
FIda… …
-
08.11.07 / 10pm
Those are some very useful tips. I’ve been frustrated over those wp-cache problems for long, and this seems to fix the problem. I would suggest you also email this to the author so it could be integrated into the official release. Thanks.
-
03.04.08 / 2pm
[…] the page is blank there is a modified version to handle Wordpress Cache here http://blog.circlesixdesign.com/2007/01/23/landing-sites-no-cache/. There is more information about a fix here […]
-
10.17.08 / 4am
[…] Circle Six Blog » Blog Archive » Landing Sites, WP-Cache and Google Reader (tags: plugin wordpress landingsite wp-cache cache google reader hack) […]
-
12.25.08 / 8pm
Hi! I tried your tip with WP-Super-Cache 0.86 and although it worked when I came from a search engine, I got two error messages:
Warning: unlink(/home/xxxx/public_html/wp-content/cache/meta/) [function.unlink]: Is a directory in /home/xxxx/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 479
Warning: rename(/home/xxxx/public_html/wp-content/cache/meta/40021986495434ad050d73.99240096.tmp,/home/xxxx/public_html/wp-content/cache/meta/) [function.rename]: Not a directory in /home/xxxx/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 480
It seems wp-cache-phase2.php was unaware that we bailed out because it was a landing page…
For now, I inserted an at symbol (‘@’) before both lines to hide those errors…
Do you have any other suggestion?
Have your say
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
8 Comments
Jump to comment form | comments rss [?] | trackback uri [?]