Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there.

    I just might give you a description on how to integrate Google Custom Search in WP without any plug-ins..

    Here is how you do that.It Took me some time, but did manage to make it work and make it look good..
    This assumes that you have active Google account.
    If not you need a Google account and you need to create the search engine, https://www.google.com/cse/manage/create.

    1.Once you are registered with Google and did create the search engine.
    Go to your Google account control panel and select (look and feel) option and select the (results-only) layout and click save and get code.For now just copy the code to notepad on your computer for later modifications.

    2.You need to create a custom page for word press.
    Here is how you do that.
    Create a new notepad file on your pc and Copy this code to that file.
    <——–cut here———->
    <?php
    /*
    Template Name: test
    */
    ?>

    Put the Google code here..

    <——–cut here———->
    and save it with .php extensions, you can give it any name, example test.php

    3.Upload the test.php to your active WP theme directory.

    4.Now go to you WP dashboard and create new page, give it a title any tile and leave body empty, and on your right under default template select your template you just created the test template,
    and click publish.

    5. You need to modify your searchform.php
    Open that file and make sure that this matches your code.
    <form action=”https://www.yourdomain.com/blog/test/”&gt;
    This is the link where, when you click search this page will appear with the search results ,your custom page you just created before.
    Your directory can be different but this is very simple, you are just creating a link to that page.

    All done you can test it now and whoila you got your search engine ??

    Now if you want to hide the link from the main page( i mean i dont want to see the link of the test page appearing on my website).
    You can do this, I did this with Google chrome is very and handy tool.
    Do this.
    As you are on the main page of you site , right click the (test) link and select (inspect element) and you need to copy the actual code which is the “li.page_item.page-item-708”
    copy this code to your style sheet and save it..
    <—cut here—>
    li.page_item.page-item-708 {
    display:none;
    }
    <—cut here—>
    Remember the 708 if from mine page, yours can be different.type your number there..
    It’s just there for clarity..

    AND lastly if you want your test page to match the design of your site.
    You need to modify the test.php by adding the php header,content, sidebar footer, etc.

    Hope you manage to do this.
    If you need any help please let me know.

    Thread Starter Be Dark

    (@b_dark)

    and who can i modify me template search box with the ad pubid code for my own ads?

    You can ad your ads on the sidebar, and i think you can’t get your ads within the search result.
    I’m not sure about that , is more complex to do that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[HOW TO] Integrate Google Custom Search in WP with own ads with or without plgn?’ is closed to new replies.