Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have website with wordpress. I have problem in sidebar widgets. when i implement the google search code in search.php file , the search works fine. but in the search page, sidebar came down. Howerver, if i use inbuilt wordpress search, it works fine. The problem only occurred, when i implement the google search code in search.php and theme style get breakdown. please help me...

The URL is: http://latestcrickethighlights.com/?s=cricket

I will provide you the original search code and my google search code.

Original wordpress search code:

<div class="page-head">
        <h2 class="page-title">
            <?php if ( have_posts() ) : ?>
            <?php printf( __( 'Search Results for: %s', 'tie' ), '<span>' . get_search_query() . '</span>' ); ?>
            <?php else : ?>
            <?php _e( 'Nothing Found', 'tie' ); ?>
            <?php endif; ?>
        </h2>
        <div class="stripe-line"></div>
    </div>

    <?php if ( have_posts() ) : ?>
        <?php get_template_part( 'loop', 'search' );    ?>
        <?php if ($wp_query->max_num_pages > 1) tie_pagenavi(); ?>
    <?php else : ?>
        <div id="post-0" class="post not-found post-listing">
            <div class="entry">
                <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'tie' ); ?></p>
            </div>
        </div>
    <?php endif; ?>

This is Google custom code, where i replaced this search code:

<script>
(function() {
var cx = 'partner-pub-xxxxxxxxxxxxxxx:xxxxxxx';
    var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
   gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
    '//www.google.co.in/cse/cse.js?cx=' + cx;
   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
 })();
</script>
<!-- Place this tag where you want the search results to render -->
<gcse:searchresults-only></gcse:searchresults-only> 

Please help me, fix the sidebar as normal.

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.