• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

How To Replace Your Wordpress Search With Google ...

Google is the undisputed king of search. They do it well. What many bloggers may not be aware of is that you can use Google as your site’s main search engine. You don’t have to use your blog engine’s built in search.

There are two really nice benefits to using Google for your site search engine:

   1. It’s Google! That means you have full power of Google search on your blog.
   2. You can use Adsense for your search results and make some money on your site searches. And the CPM is usually VERY high with Adsense in this case because the ads are super well targeted.

So the question is: how do you do it? Well, I’ll show you.

   1. You need an Adsense account. So, if you’re not already signed up as an Adsense publisher, do so now.
   2. In your Adsense account, click on “Adsense Setup”. Then click on “Adsense for Search”.
   3. Click the “Get Started” button. You will enter the wizard for creating your search form.
   4. For “Search Type”, select “Only sites I select”. In your “Selected Sites” box, type the URL to your blog. You can enter multiple sites if you wish.
   5. Enter some “optional keywords” which will gear the ads displayed toward your blog subject matter.
   6. You can leave all other fields as default. Continue to the next step.
   7. Choose the look and feel of your search form. Continue to the next step.
   8. Next, you can choose where you want your search results to appear. In order to make the search results appear within your own site, choose “open results within my own site” and specify the URL. For PCMech, I entered “http://www.pcmech.com/searchresults.php”. This is obviously not part of the Wordpress installation, but that’s OK. We’re going to create this file for you in a moment.
   9. Choose the ad position and color palette and then continue to the next step
  10. Assign a name to the search engine. This is for your own internal purposes later. Then hit the “Save and Get Code” button.
  11. You’re going to get two snippets of code. One is for the actual search form and the other is for your search results page. Include the search form HTML wherever you want it to appear in your blog theme (likely either the sidebar or the header). You can use CSS to customize the appearance of the search form to match your site as closely as possible.
  12. Now you need to create a file called searchresults.php. The code I use for this file is below. You will need to paste in your results code that Google gave you, modify as needed to suite your particular theme, and upload to your blog’s root directory.


<?php
unset($_SERVER[PATH_INFO]);
//Include current WordPress Theme Header etc.
require(’./wp-config.php’);
function maketitle() {
return ” | Search Results”;
}
//Check if we’re wrapping the WP Theme
//Get Theme settings.
$themes = get_themes();
$current_theme = get_current_theme();
$current_template_dir = $themes[$current_theme][Template Dir];
$current_stylesheet_dir = $themes[$current_theme][Stylesheet Dir];
//Initialize the WP class to be able to get the header
wp();
//Set status to 200 to override the 404 set by WordPress
status_header(200);
//Include the WP Header
add_filter(”wp_title”,’maketitle’);
get_header();
?>
[ PASTE YOUR SEARCH RESULTS CODE FROM GOOGLE HERE ]
<?php get_sidebar(); ?>
<?php
get_footer();
?>

This file will use your blog’s active theme, however you may need to do some modifications to suit your blog. You might also need to go back and define the width of the search results to fit your blog.

When you’re done, you will have a Google powered search engine within your blog.

NOTE: The only caveat to keep in mind here is that your posts will not appear in your search engine until Google indexes you. However, if you post often and use the XML Sitemaps plug-in, you should be fine.

 Original Source:
http://davidrisley.com

AddThis Social Bookmark Button

Posted at 12:55:01 pm | Permalink | Posted in Search Engines  How to Blog  

Related Stuff

Google Buzz Button Wordpress Plugin Released

If you are looking for a Google Buzz button to add into your Wordpress site then we have released the first Wordpress plugin exclusively ...

Plug And Play Ecommerce With Wordpress Plugins

Since 2003 Wordpress has slowly been gaining popularity amongst the elite of the internet, the bloggers. It is one of those few things ...

Add Google Search to Your WordPress Blog

The native WordPress search does not return very relevant results, thus it makes a lot of sense to add Google Search into your WordPress ...

Add More Sidebars to Your WordPress Theme

You can add more than one sidebar section to your WordPress site. For example, with the stc-intermountain.org site, I added a whole bunch ...

Series Posting in Wordpress

In my functions.php file, I have some code which implements series posting. This relies on the thematic ...

Top Stuff

Free Blogger templates Anime Themes

Wordpress Guestbook Generator Plugin

48 Unique Ways To Use WordPress

GeekLog

WordPress Single Post Templates

Get The Image WordPress Plugin



About Webloglines

Webloglines is a project offers a comprehensive collection of blogging services, articles, themes and plugins from around the world. Whether you're looking to promote your own blog or find blogs on various topics, this site is for you.


Search


Topics

  • Adsense (12)
  • Blogging Tips (73)
  • Blogs Slides (25)
  • Blogs Websites (22)
  • Digg (20)
  • How to Blog (129)
  • Search Engines (9)
  • SEO (135)
  • WordPress Plugins (269)
  • WordPress Security (75)
  • Wordpress Themes (99)
  • Wordpress Tips (162)

© 2006 www.webloglines.com. All Rights Reserved. Powered by IRange