Treehouse: Grow your CSS skills. Land your dream job.

Google search on wordpress

  • # August 8, 2010 at 3:35 pm

    Good evening all.

    Can anyone please help me out. I am trying to add a google search to my wordpress site, but im having difficulties on the results bit.

    The results will show on a different page,(iframe) so i put as the link for the landing results page. And then type in googles code on search.php file. But when i try and test it on the site, it goes to the 404 page.

    Ive done this before on a static site with no worries but im struggling with WordPress.

    # August 8, 2010 at 9:12 pm

    Create a new page from within wordpress and paste the landing page code in the html editor there. You’ll obviously have to give the custom search setup the URL of the page you’ve just created.

    # August 9, 2010 at 1:06 pm

    Hey. Thanks for the reply. Yeah i found out to do it that way, but is that the only way to do it ?

    Because on the result page i dont want to include the side bar

    # August 9, 2010 at 6:12 pm

    *Off the top of my head:

    You can copy page.php and create a new template called search-results.php, remove the sidebar from it, and use that template for the new page you’ve created.

    # August 10, 2010 at 12:08 am

    Or wrap the sidebar on page.php with

    <?php if(!is_page(‘<page name or id>’): ?>
    <?php endif:?>
    # August 10, 2010 at 2:48 am

    Ok. Cheers guys. I’ll try your suggestions this afternoon, when i get back from work :D

    # August 10, 2010 at 5:43 pm

    Ha. I hardly know anything about WordPress so took me a while but it is all sorted now.

    Cheers for the help. :D

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.