• Resolved Chickenfloss

    (@chickenfloss)


    Like the title says..I am using the “Mystique” 2.4.2 theme and when I put in my search query I have issues. If the string is not found found the error page is displayed correctly. “Nothing found. Try a different search?” However, if results are returned it quickly flashes the result page across the screen and then almost instantly goes to a blank white page and stays.

    The problem happens in multiple browsers in both Linux and Windows. Firefox shows “Stopped” in the bottom left corner. I have looked at the coding and see nothing wrong, but I have limited experience. I have also tried disabling all plugins and widgets I can. The problem persists.

    searchform.php

    <?php /* Mystique/digitalnature */ ?>
    
    <?php
     $searchquery = wp_specialchars(get_search_query(),1);
     if (!is_search() || (is_search() && have_posts() && ($searchquery && $searchquery!=__("Search","mystique")))):
      mystique_search_form();
     else: ?>
      <p class="aligncenter">
      <?php
       if(($searchquery) && ($searchquery!=__('Search',"mystique"))):
        printf(__("You have searched the archives for %s","mystique"), '<span class="altText"><strong>'.wp_specialchars(get_search_query(),1).'</strong></span>');
       else:
        _e("Type a valid search term...","mystique");
       endif;
    
      ?>
      </p>
    <?php endif; ?>

    search.php

    <?php
     /* Mystique/digitalnature */
     get_header();
    ?>
      <div id="main">
       <div id="main-inside" class="clear-block">
        <!-- primary content -->
        <div id="primary-content">
         <div class="blocks">
          <?php do_action('mystique_before_primary'); ?>
          <?php
           $searchquery = wp_specialchars(get_search_query(),1);
           if(($searchquery) && ($searchquery!=__('Search',"mystique"))):
             if (have_posts()): ?>
             <h1 class="title"><?php printf(__("Search results for %s","mystique"),'<span class="altText">'.$searchquery.'</span>'); ?></h1>
             <?php
              mystique_pagenavi();
    
              while (have_posts()):
               the_post();
               mystique_post();
              endwhile; ?>
    
             <!-- page navigation -->
             <div class="page-navigation clear-block">
              <?php mystique_pagenavi('alignright'); ?>
             </div>
             <!-- /page navigation -->
    
            <?php else: ?>
             <h1 class="title"><span class="error"><?php _e('Nothing found.','mystique'); ?></span> <?php _e('Try a different search?','mystique'); ?></h1>
             <?php mystique_search_form(); ?>
            <?php endif; ?>
          <?php else: ?>
      	    <h1 class="title"><?php _e('What do you wish to search for?','mystique'); ?></h1>
            <?php mystique_search_form(); ?>
          <?php endif; ?>
          <?php do_action('mystique_after_primary'); ?>
         </div>
       </div>
       <!-- /primary content -->
    
        <?php get_sidebar(); ?>
    
       </div>
      </div>
    
    <!-- /main content -->
    
    <?php get_footer(); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Chickenfloss

    (@chickenfloss)

    Just an update…for some reason there is one word that returned a result that worked just fine. I have one post I can search any phrase or word that is unique to that specific post and everything is ok. However any other word and the same problem returns. I have tried backing up my database and deleting all but a single post to rule out the problem of multiple returned results. I am extremely confused. Other themes work fine, but the coding doesn’t seem to have a problem…

    Thread Starter Chickenfloss

    (@chickenfloss)

    Ok, I have found the problem. I am using google adsense in my posts. When a search result is returned and the ad is shown in the post and not hidden by the “more” button it causes a page forward to about:blank. Removing the ad works, but I need the revenue. So is there a way around this?

    try removing
    add_action('mystique_jquery_init', 'mystique_highlight_search_query');

    from functions.php

    how did you add the adsense code inside the posts?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Successful search return forwards page after results displayed?’ is closed to new replies.