Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How To Add Google Custom Search To Genesis Theme

Not happy with the default WordPress Search option in your Genesis theme? Well, you are in the right place. Here, I have given a step by step tutorial to add Google Custom Search to Genesis WordPress theme.

Follow this tutorial, Add Google Custom search to your Genesis child them and make extra AdSense income when people use the search box in your website.

How To Add Google Custom Search To Genesis Theme:

1) To get started, log into your AdSense account and visit http://www.google.com/cse.

2) Now click on “Add” for creating a custom search engine for your WordPress website. In the next page, enter your website URL in the “Sites to search” box. Once you enter your website URL, Google will automatically choose your domain name as the name of the search engine. Next, change the language of the search engine if your website is not in English or else leave the default settings and click on “Create”.

3) Once your custom search is successfully created, click on “Get Code”.

4) Now instead of copying the code, click on “Look and feel” under “Edit Search Engine”. Now select “Results Only” and click on “Save”.

5) Next, click on “Search Features” under “Edit Search Engine”. Once done, click on the “Advanced Tab”. Now expand “Websearch Settings”, enter the letter “q” in the “Query Parameter Name” and click on “Save”.

6) Now click “Setup” under “Edit Search Engine” and open the “Make Money” tab. Once done, enable “Search Engine Monetization” so that you can make money when your visitors use the search box in your website.

7) Next, click on “Basics” tab. Under basic settings, click on “Get Code” button and copy the code given in the next page to a text document in your computer.

8) Now log into your WordPress dashboard and add the following code in your functions.php file (you can get there by following this path: Appearance -> Editor).

add_filter( 'genesis_search_text', 'wpselect_search_text');
function wpselect_search_text() {
return esc_attr__( 'Search This Site…', 'genesis' );
}

9) Next, open a new text document in your computer, copy and paste the following code in it and save the document.

/**
* Template Name: Google Custom Search
* Description: Google Custom Search
* Created by John Levandowski
* Modified by: Rowell Dionicio
* Site: http://packet6.com
* Date: 7/8/2013
*/
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
add_action('genesis_meta', 'wpselect_google_cse_meta');
function wpselect_google_cse_meta() { ?>
}
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
add_action( 'genesis_post_content', 'wpselect_google_cse_content' );
function wpselect_google_cse_content() { ?>

INSERT GOOGLE CUSTOM SEARCH ENGINE CODE HERE

}
genesis();

In the above code replace “INSERT GOOGLE CUSTOM SEARCH ENGINE CODE HERE” with the code from “Step 7”.

10) Now rename the document as “page_google_search.php” and make it a .php file. If you not able to change the extension of your text document, go to “Folder Options” in your Windows control panel and untick the “Hide extensions for known file types” box.

11) Next, log into your website’s cPanel and upload this .php file to your Genesis child theme directory (wp-content/themes/CHILD THEME NAME).

12) Now create a page and name it as “Search”. Make sure that the permalink of this page look likes: “yourdomain.com/search/”.

13) Next, select “Google Custom Search” under “Template” in the “Page Attributes” settings and “Publish” the page.

14) That’s it. Now you have successfully integrated Google custom search in Genesis WordPress theme. You can test it by adding a “Search Widget” in your sidebar.

If you encounter any issues while following this tutorial, do let me know via comments.

The post How To Add Google Custom Search To Genesis Theme appeared first on Crack Aloud.



This post first appeared on Crack Aloud - Useful Tips, Tricks And Tutorials, please read the originial post: here

Share the post

How To Add Google Custom Search To Genesis Theme

×

Subscribe to Crack Aloud - Useful Tips, Tricks And Tutorials

Get updates delivered right to your inbox!

Thank you for your subscription

×