• Hi,

    i′m using the HelpGuru Theme & Knowledgebase along Relevanssi.

    The built in Search Box works pretty fine with Relevanssi, but hitting the “Show more results”, which should show a results page, shows a blank page with the term “Search for”.

    Someone any idea or experiences using HelpGuru and Relevanssi?

    hkb-search.php (plugin)

    <?php
    /*
    * Theme template for ajax search results
    */
    ?>
    
    <ul id="hkb" class="hkb-searchresults">
    
      <?php $total_results = 0; ?>
        <!-- ht_kb -->
        <?php if (have_posts()) : ?>
              <?php $counter = 0; ?>
            <?php $total_results += (int) $wp_query->posts; ?>
              <?php while (have_posts() && $counter < 10) : the_post(); ?>
                  <li class="hkb-searchresults__article <?php hkb_post_type_class(); ?> <?php hkb_post_format_class(); ?>">
                    <a href="<?php the_permalink(); ?>">
                            <span class="hkb-searchresults__title"><?php the_title(); ?></span>
                            <?php if( hkb_show_search_excerpt() && function_exists('hkb_the_excerpt') ): ?>
                                <span class="hkb-searchresults__excerpt"><?php hkb_the_excerpt(); ?></span>
                            <?php endif; ?> 
                      <?php hkb_get_template_part( 'hkb-article-meta', 'search' ); ?>
                    </a>
                  </li>
                  <?php $counter++; ?>
              <?php endwhile; ?>
        <?php endif; ?>
    
        <?php if($total_results>0): ?>
          <li class="hkb-searchresults__showall">
            <a href="<?php echo home_url( '?s=' . urlencode($s) . '&ht-kb-search=1' ); ?>" title="<?php _e('Show all results', 'ht-knowledge-base'); ?>"><?php _e('Show all results', 'ht-knowledge-base'); ?></a> 
          </li>
        <?php else: ?>
          <li class="hkb-searchresults__noresults">
            <span><?php _e('No Results', 'ht-knowledge-base'); ?></span>
          </li>
        <?php endif; ?>
    
    </ul>
    <?php
    /*
    * Theme template for the search results
    */
    ?>
    
    <?php get_header(); ?>
    
    <?php hkb_get_template_part('hkb-compat', 'search'); ?>
    
    <?php get_footer(); ?>

    Searchbox:

    <?php
    /*
    * Theme template for displaying the search box
    */
    ?>
    
    <?php if(hkb_show_knowledgebase_search()): ?>
        <?php /* important - load live search scripts */ ht_knowledge_base_activate_live_search(); ?>
        <form class="hkb-site-search" method="get" action="<?php echo home_url( '/' ); ?>">
            <label class="hkb-screen-reader-text" for="s"><?php _e( 'Search For', 'ht-knowledge-base' ); ?></label>
            <input class="hkb-site-search__field" type="text" value="<?php echo get_search_query(); ?>" placeholder="<?php echo hkb_get_knowledgebase_searchbox_placeholder_text(); ?>" name="s" autocomplete="off">
            <input type="hidden" name="ht-kb-search" value="1" />
            <input type="hidden" name="lang" value="<?php if(defined('ICL_LANGUAGE_CODE')) echo(ICL_LANGUAGE_CODE); ?>"/>
            <button class="hkb-site-search__button" type="submit"><span><?php _e( 'Search', 'ht-knowledge-base' ); ?></span></button>
        </form>
    <?php endif; ?>

    search.php

    <?php
    /**
    * The template for displaying Search Results pages.
    *
    */
    
    get_header(); ?>
    
    <?php 
    if( function_exists( 'ht_kb_is_ht_kb_search' ) && ht_kb_is_ht_kb_search() ){
    	get_template_part( 'page-header', 'kb' );
    } else {
    	get_template_part( 'page-header', 'posts' );
    }
    ?>
    
    <!-- #primary -->
    <div id="primary" class="sidebar-right clearfix"> 
    <div class="ht-container">
    
    <?php 
    if( function_exists( 'ht_kb_is_ht_kb_search' ) && ht_kb_is_ht_kb_search() ){
    	get_template_part( 'search', 'ht_kb' );
    } else {
    	get_template_part( 'search', 'posts' );
    }
    ?>
    
    <?php ht_get_sidebar(); ?>
    
    </div>
    </div>
    <!-- /#primary -->
    
    <?php get_footer(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Looks like the HelpGuru has a separate search that is not perfectly compatible with Relevanssi – it’s using nonstandard search parameters and so on. It may be you need to choose which search you want to use, and disable the other.

    Thread Starter Koolkill

    (@koolkill)

    Thx,

    strange, because it previews results within the search box and it works perfectly fine.
    Hitting the “show all results” button returns an empty page without any header footer and content.

    Plugin Author Mikko Saari

    (@msaari)

    Yes: the preview uses Ajax search that is powered by something else than Relevanssi. When you hit “Show all results”, it runs a full query, which is not compatible with Relevanssi – the search form doesn’t include a “s” field for the search terms, for example.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘HelpGuru – KnowledgeBase returns blank results page’ is closed to new replies.