Search Engine Query in Wordpress (Related Contents)
The widget aim is trying to reduce the bounce rate of your blog and provide the visitor a better navigation experience.
When a visitor lands on your site from a search engine result page, he is in need of a certain information / service your page might satisfy. It often happens the visitor go away just after reading that page, for various reasons. Why not to try suggesting him more posts on the topic he is interested in at that moment, so that he might visit more pages?
The Search Engine Query in Wordpress widget grabs the query the visitor used on the search engine, executes it in the blog search and displays results, suggesting the visitor more information about what he is actually looking for.
If the visitor does not come from a search engine and the current page is the single post template, the widget can display the most recent posts in the current post category. There is an option in the widget control panel to turn this feature down. In that case, if the user does not come from the search engine the widget box simply doesn’t appear.
Widget Features
- If the visitor comes from a search engine result page, the widget grabs the search engine query, executes it in the internal search (with the WP_Query object) and shows results
- If the visitor is browsing a post detail (is_single()) and the visit source was not a search engine result page, the widget get the current post category and shows the most recent posts in that category
- If the “Track clicks” option is enabled in the widget control panel, the plugin adds campaign dimension tags to links in the widget box.
If your web analytics tool supports them, you’ll find a “Search engine query in WP widget” campaign that will allow you to understand how many clicks where produced by the widget box and if they were made from the category search or the search engine query search - The widget contrtrol panel lets you choose:
- The widget box title
- The number of related posts to display
- To search by category if the search engine query is not available
- To track clicks with campaign link tags
- The widget layout can be customized by editing the seq_in_wp.css css file located in the plugin directory
Installation
- Unzip and upload ’search-engine-query-in-wp’ directory to your ‘/wp-content/plugins/’ directory
- Activate the plugin through the ‘Plugins’ menu in the admin panel
- Activete the widget in the ‘Appearance -> Widgets’ section of the Admin panel
- Edit widget settings in the ‘Appearance -> Widgets -> Search Engine Query in WP’ for fine tuning (Title, number of posts, ajax, email etc.)
- Edit the seq_in_wp.css to change the box layout so that it fits your blog theme (not mandatory)
Changelog
- 1.2.4: if jQuery is not loaded by default, the plugin enqueues the script in the <head> section (fixes the “emply box” bug)
- 1.2.3: Far lighter Ajax scripts, integrated with Wordpress Jquery, the plugin auto-check requirements upon installation and deactivate itself it something is missing
- 1.2.2: “Install” bug and “wp-config.php not found” bug fixed. Php 5.0 or higher is required anyway. Will work on backwards compatibility soon indeed
- 1.2: option for executing the search on Ajax technology after the page has loaded, WP Super Cache compatibility, translations, logs by email, cool fade out effect if there are no related posts and much more ;)
- 1.1.1: more search engines supported, safer coding
- 1.0.7: first public release
Enhancements / todo list
- Support more search engines (suggest your favourite and I’ll add it)
- Better coding (Class instead of functions, some comments are in Italian)
- Option for showing random posts if related are not found
Download Search Engine Query in Wordpress widget now! It’s free :P
Some sites using it
If this plugin is worth for you, if it actually reduced your bounce rate, consider donating a very few bucks for the time I spent developing it ;)























































hi. Thanks for plugin
perfect.
Regards
There are several, well established, related posts plugins out there. I would suggest your plugin feeds them, if installed, with the search query rather than trying to find yet another set of related posts. This approach will make your plugin much simpler as all it has to do is 1) capture the search term 2) determine if this is a page/post or the index and 3) pass the search term to the related posts plugin.
Also, how is the plugin’s function affected by WP Super Cache or similar plugins?
@Your Life Regained
Thanks Your Life :)
If the visitor comes from a search engine, related posts are fetched by the internal wordpress search methods.
I thought about interacting with an existing “related posts” plugin if the visitor is not coming from a search engine search but… I haven’t found any in the official plugin directory :P Could you suggest one?
Finally I am not going to support WP Cache or WP Super Cache because I am going to write my own caching system. I don’t like those plugins because if the user is not logged or has not commented yet, they do not show dynamic parts of the page (comments!!).
What I’d like my a caching system to do is staticize just the post, not comments so that it reduces the number of queries executed, but still executes some. I’ve already done that for many cms, I need some time to study wordpress core to port that system here ;)
There are several related posts plugins that have gained popularity:
http://wordpress.org/extend/plugins/similar-posts/
http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/
as well as a plugin that does landing page optimization, similar to what you do:
http://wordpress.org/extend/plugins/landing-sites/
As far as not supporting WP Super Cache, my recommendation is to consider a middle ground, where you develop you own plugin for the cache system instead of outright ignoring it. The reality is that the WPC plugin has a significant installed based and not supporting it is going to limit the adoption of your own plugin.
@devu
Hey there! Great plugin!
Can I use it in my templates? Is there a way to call the function using PHP and not the widget?
Many thanks!
@Psyk
Thanks :)
Yes, just copy this snippet in your theme:
< ?php if (function_exists('SEQ_in_wp')) SEQ_in_wp(array()); ?>
If you don’t have widget configuration too, just tune widget settings in the SEQ_getDefaults function:
$options['title'] = ‘Related Posts’;
$options['show_category'] = ‘true’;
$options['track_clicks'] = ‘true’;
$options['number'] = 5;
$options['use_ajax'] = false;
I’m looking for someone with the WP Super Cache plugin to test the new ajax version of this widget ;)
Anyone?
Nice plugin.
If you plan to support multiple languages, drop me a line I’ll translate it in italian.
@blau
Translations are now available :) I did my best with it_IT but if you’d like to contribute… you’re more than welcome ^__^
Hi,
AWESOME plug-in. Instantly one of my “must-have” plug-ins. But… Everything worked perfectly until I installed V1.2. WP barfed all over it. Can I get the rev 1.1.1 again? The auto-upgrade function in WP nuked the previous version.
Thanks a million. Great stuff!
CG
@Chuck Gillooley
Hi Chuck,
sorry for that. The 1.1.1 version is always available @wordpress.org: http://wordpress.org/extend/plugins/search-engine-query-in-wordpress-related-contents/download/
Before rolling back I suggest you to try manually install the 1.2 version. I’ve never tested auto-update with this plugin, I’d better do it :P
Could you report here what WP didn’t like about the new version?
I get this error inside the widget box:
Warning: require_once(wp-config.php) [function.require-once]: failed to open stream: No such file or directory in /nfs/c01/h02/mnt/34828/domains/phoenixrealestateguy.com/html/wp-content/plugins/search-engine-query-in-wordpress-related-contents/external.php on line 44
Fatal error: require_once() [function.require]: Failed opening required ‘wp-config.php’ (include_path=’.:/usr/local/php-5.2.6-1/share/pear’) in /nfs/c01/h02/mnt/34828/domains/phoenixrealestateguy.com/html/wp-content/plugins/search-engine-query-in-wordpress-related-contents/external.php on line 44
@Jay Thompson
Thanks Jay. For a very fast fix replace in external.php line 44:
require_once($inc_path.”wp-config.php”);
with
require_once(“../../../wp-config.php”);
Let me know if it works.
hi Francesco
thanks for your work,this plug is great, unfortunately in a blog
i’ve got :
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/userxxx/domains/userxxx.org/public_html/wp-content/plugins/search-engine-query-in-wordpress-related-contents/lib.php on line 10the
private
$seqOptions;what shall I do?
@lorenzo
Hi Lorenzo,
unfortunately your server does not support php5 :(
You could:
- delete all “private ” and “public ” instructions you find in the lib.php file
- go back to the 1.1.1 version which support php4: http://wordpress.org/extend/plugins/search-engine-query-in-wordpress-related-contents/download/
@devu
Many many thanks for this prompt and precise reply Francesco,
so I’m not alone ‘celebrating’ the day of the Sun, indeed (LOL)
plugin (1.1.1) installed and running, monday it’ll be CSSed .
ciao e graxie
@devu
Works like a charm. Thanks!
@devu
Works like a charm, thanks! Great plug in!
@devu
PHP 5 turned out to be the culprit. I was getting the same error message as Lorenzo did, but when I upgraded to PHP 5, everything worked perfectly. What a great plug-in!!
@Chuck Gillooley
Looks very cool on your blog! Have you tried the “Email log feature”? What do you think?
@Jay Thompson
Jay, the “Loading” icon seems too big for your blog layout. Can I suggest you to replace it with a smaller one? Look at here :)
Will this create duplicates on the single page if I use this along with related Posts using YARP PLugin.
Very nice information. Check out my blog, I just posted a great blog about the 36 Best Wordpress plugins for 2009.
@Avinash Just disable the Show category posts if no results with “search engine query” are found option and the box will appear only when visitors come from search engines.
How about integrating the functions of WP-Greetbox and Referer Detector into this plugin.
And it would be a perfect referer plugin concerned about not only traffic from search engine but from social networks.
@devu
I’ve got an empty box.
I’m using wp-super-cache… Can I help you?
@Pande
I’m using WP Super Cache too, and the plugin is working as you can see on the right column. Do you have the last “Search Engine Query in Wordpress” version? Be sure the “Use Ajax technology” checkbox in the plugin settings is checked, so that the database query is run from javascript after the static page is loaded.
I am the same issue as Pande. I have an empty box and I am using super-cache, wordpress 2.7.1, and I am using the last plugin version and using ajax technology in the plugin settings.
Maybe the plugin is not working with the 2.7.1 version?
Hi
Its not working for me. It displays posts from one category always and I disabled it from the widget. Now, it says no related posts every time and dissapears!
Ciao Francesco,
posso parlare italiano ?
Ho provato ad installare il tuo plugin ma sembra non funzionare…
Si attiva correttamente ma quando inserisco il widget, rimane soltanto il titolo senza visualizzare niente.
Il sito gira su Wp 2.7.1 con php5.
Consigli ?
Grazie mille.
I’m sorry for the delay, it’s that I have been very very busy with a few projects and couldn’t find the time to check the plugin and debug the problem.
Here we are: I read the wordpress documentation and understood that since WP 2.5.something jquery was included in every blog and took it as an assumption. Now jquery is loaded by themes and if themes do not apply developer guidelines (don’t load jquery), you’ll see the box empty and not working.
Here is the fast workaround you can use, until I update the official release with subversion.
1) Open your /wp-content/plugins/search-engine-query-in-wp/search-engine-query-in-wp.php file with a text editor
2) Add a new line after line 113 (line 113 should contain echo ‘<link rel=”stylesheet” href=”‘.$seqiwp_base_url.’/seq_in_wp.css” type=”text/css” />’;)
3) At line 114, paste this: wp_enqueue_script(‘jquery’);
4) Save and upload
Is the manual snippet you posted here going to render any html if the visitor doesn’t come from a search engine?
Will this work if I put it in the 404 template?
I’m asking because it is already a redirected page, and I wonder if the query will be still there at that stage.
Hi,
I tried to install the plugin on version 2.8 wp and got this error:
Unpacking the package.
Incompatible archive PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature
@Jesse
It’s odd because the zip archive is created by wordpress.org. With svn I just upload the plugin files.
Hmmm
@sergio
Depends on how the redirect is done: the plugin uses the $_SERVER["HTTP_REFERER"] variable.
Fixed adding the line!
Great…
Thank you for information
i’ll test it in my site and if no problem with theme and search unleashed i’ll put it cuz it is very important for new users
cool plugin but all the time it showing no related post found :(
Hey this is great plugin!
Thanks so much…it really is cool addition. I’ve put it to show at beginning of posts and then have YARRP at the end of posts.
This was interesting because your plug showed results and YARPP showed nothing related (maybe the setting are too high ;)
Anyways, I think it’s great!
Would you be able to have the *Category* that it suggests in the results become a link to that actual *Category*?
This is a great plugin.. Infact I liked it so much that I removed YARPP
Is it possible to add wordpress TAGS support for related post instead of category
is there a way to display the search engine query and related posts outside of a the widget (ie, on a page or in a post)
@devu
hello. i like it and i want to translate it in greek.What sould i replace?
i create the po files. but when i upload them, notning hapens. Should i create mo files also? & if yes how the end user load them? ( i cant load the fr translation for example)
Hey great plugin. I saw the comment with “” to add it to the theme but is there and easy way to show the actual keyword from the search engine query just by itself in a post or the theme?
Thanks much.