StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-05-2009, 06:38 PM
Bongo Bongo is offline
Registered User
Pro Plus Member
 
Join Date: Oct 2008
Location: US
Posts: 224
Default Guide: Adding Google Search to Theme

Hey Guys! Here is a quick little guide that shows you how to add a Google search box and Google Search Results to your Rev. Church Theme.

Step 1: (Do this before making code for search box and search results in Google)

We need to create a custom page for the search results to be on. Go into the root directory of the theme and create a new file called search.php that contains the following code...
Code:
<?php
/*
Template Name: Search Page
*/
?>

<?php get_header(); ?>

<div id="content">


		
</div>



<?php get_footer(); ?>
Now log into your Wordpress Administrative account and go to Pages - Add New. Type Search as the title of the new page. Leave the body area blank. Then go to Attributes, and change Default Template to Search Page. Now Publish the page.

Step 2: (Getting the Google Code)

You can now get the Google Search Code for both the webpage and the search box. When asked to display the search results on your own webpage, type in the following URL: http://www.url.com/search

We now need to past the code of the search results into the theme. To do this, go back to the search.php file and replace: with your new search results code from Google.

Step 3: (Replace the Search Box)

You now need to replace the search box created by Wordpress. To do this, go into the header.php file and replace the following code with your search box code:
Code:
		<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
		<input type="text" value="Search this website..." name="s" id="searchbox" onfocus="if (this.value == 'Search this website...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search this website...';}" />
		<input type="submit" id="searchbutton" value="GO" /></form>
You may need to change the size of the search box so it fits in the area given.

This is a very basic article on how to add Google Search to your Wordpress website... I will be working on creating a full article that has details.

Hope this helps anyone that needs the basics of adding Google Search to Wordpress.

NOTE: If the above does not correctly show your Google Search Results, remove all the text in search.php for the Google Search and paste it as HTML into the Search page that was made in Wordpress.
__________________
Get your StudioPress Theme customized @ motivosolutions.com
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Custom Search for Magazine Theme deveren General Discussion 4 05-27-2010 12:23 PM
Need 2 Search Boxes for local tourist guide site naweedshams General Discussion 1 08-15-2009 06:17 PM


All times are GMT -5. The time now is 07:48 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.