How can I integrate Google Custom Search or Adsense for search results into the WordPress Twenty Ten theme of the 404.php site?

Everyone knows the standard WordPress search for a 404 error.

I didn’t quite like this, so today I’ll show you how I adapted my 404 page of WordPress with the theme Twenty Ten.

WordPress Twenty Ten 404 Google Custom Search, search results pages

Which section of the 404 page of WordPress should I replace?

You have to mark this area in WordPress 404.php:

<!-- gone ###
                    <p><?php _e( 'Apologies, but the page you requested could not be found. Perhaps searching will help.', 'twentyten' ); ?></p>
                    <?php get_search_form(); ?>
                </div><!-- .entry-content -->


Then replace this section of the Twenty Ten theme with your Google Custom Search, search results pages for Adsense.

With me, that was next:

<div style="background-color: #ffffff; color: #000000;">
<div><form id="cse-search-box" action="">
<div><input type="hidden" name="cx" value="XXXXXXXXXXXXXXXXXXXXXXXXXXX" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="55" />
<input type="submit" name="sa" value="Search" /></div>
<div><img src="" alt="Google" /></div>
<div>User-defined search</div>

So you have created your 404 error page wonderfully.

I don’t particularly want to create a spectacular 404 page, I just want to show the Google Adsense search results pages.

Alternative, if you want, you can also “Excuse me, but the page could not be found. Maybe the search function will help you to find a result”.

It’s like this, replaced:

                    <?php get_search_form(); ?>

through your Google Custom Search, search results code!