Adding the Google Custom Search Engine into your wordpress theme can be a great lift to your visitors satisfactions.I have test wordpress search but i didn't find it as good as i want so i last week i try to use Goggle cse for my site search.
i will suppose your theme include Search.php and searchform.php if it doesn't than you can create it by your self. Here are some steps to make cse for your wordpress.
Step 1:
go to Google CSE and create a Custom search engine
Step 2
complete all the three steps that you can see at google cse at thrid step
you will see "look and feel"don't copy the code just click at look and feel
Step 3
In layout section select "Results Only" and than select any style and click save
Step 4
Now click at "Indexing" link at side bar menu. There don't forget to index sitemap of your site.
select sitemap that you have submitted to google webmaster and than click at "index now".Remember this is more important step.
Step 5
Now click at "get code" link in side bar menu and there write "s"as your search parameter.
because wordpress use this to search the database and it will reduce your coding time that you might not want to invest in coding your theme. After this copy the code and open search.php in your theme. and replace everything between
"<?php if ( have_posts() ) : ?>" and "<?php endif; ?>" like this
Now save the file and you done every thing.
The benefit of this method is that you have full control over the css of your search form. just in case if you are using twenty-eleven theme that has fancy style search box ( i like that one) than you may not want to modify any thing of this search box. we are concerned with search result not with search box. this is why by this method you will save allot of your time that you don't want to invest in your theme coding. For demo purpose you can see my website search there and you will see the how it is working.
i will suppose your theme include Search.php and searchform.php if it doesn't than you can create it by your self. Here are some steps to make cse for your wordpress.
Step 1:
go to Google CSE and create a Custom search engine
Step 2
complete all the three steps that you can see at google cse at thrid step
you will see "look and feel"don't copy the code just click at look and feel
Step 3
In layout section select "Results Only" and than select any style and click save
Step 4
Now click at "Indexing" link at side bar menu. There don't forget to index sitemap of your site.
select sitemap that you have submitted to google webmaster and than click at "index now".Remember this is more important step.
Step 5
Now click at "get code" link in side bar menu and there write "s"as your search parameter.
because wordpress use this to search the database and it will reduce your coding time that you might not want to invest in coding your theme. After this copy the code and open search.php in your theme. and replace everything between
"<?php if ( have_posts() ) : ?>" and "<?php endif; ?>" like this
<?php if ( have_posts() ) : ?>
<-- paste here the code that you copied from Google cse-->
<?php endif; ?>
Now save the file and you done every thing.
The benefit of this method is that you have full control over the css of your search form. just in case if you are using twenty-eleven theme that has fancy style search box ( i like that one) than you may not want to modify any thing of this search box. we are concerned with search result not with search box. this is why by this method you will save allot of your time that you don't want to invest in your theme coding. For demo purpose you can see my website search there and you will see the how it is working.




Comments
Post a Comment