/**
         * Live search results functionality
         */
        function ht_knowledge_base_live_search_template($template)
        {
            global $ht_knowledge_base_options;
            //ensure this is a live search
            $ht_kb_search = array_key_exists('ht-kb-search', $_REQUEST) ? true : false;
            if ($ht_kb_search == false) {
                return $template;
            }
            if (!empty($_GET['ajax']) ? $_GET['ajax'] : null) {
                // Is Live Search
                //check custom search
                //search string
                global $s;
                // Get FAQ cpt
                $ht_kb_cpt = 'ht_kb';
                ?>

				<?php 
                hkb_get_template_part('hkb-search-ajax');
                ?>

				<?php 
                wp_reset_query();
                //required to stop
                die;
            } else {
                //non ajax search
                return $template;
            }
        }
?>

<?php 
hkb_get_template_part('hkb-breadcrumbs', 'single');
?>

        <?php 
if (have_posts()) {
    ?>
          <?php 
    while (have_posts()) {
        the_post();
        ?>

            <?php 
        hkb_get_template_part('hkb-content-article');
        ?>

          <?php 
    }
    ?>

          <?php 
    posts_nav_link();
    ?>

        <?php 
} else {
    ?>

        <h2 class="hkb-search-title">
<?php

/*
*
* Theme template for ht_kb_category
*
*/
?>

<?php 
get_header();
?>


<?php 
hkb_get_template_part('hkb-compat', 'taxonomy');
?>


<?php 
get_footer();
<?php

/*
*
* The template used for single page, for use by the theme
*
*/
?>

<?php 
get_header();
?>

<?php 
hkb_get_template_part('hkb-compat', 'search');
?>

<?php 
get_footer();
示例#5
0
    ?>
            <?php 
    if (!empty($ht_kb_tax_desc)) {
        ?>
                <p class="hkb-category__description"><?php 
        echo $ht_kb_tax_desc;
        ?>
</p>
            <?php 
    }
    ?>
        </div>

        <?php 
    //display sub categories
    hkb_get_template_part('hkb-subcategories', 'archive');
    ?>

        <?php 
    $cat_posts = hkb_get_archive_articles($tax_term, null, null, 'kb_home');
    ?>

        <?php 
    if (!empty($cat_posts) && !is_a($cat_posts, 'WP_Error')) {
        ?>

            <ul class="hkb-article-list">
                <?php 
        foreach ($cat_posts as $post) {
            ?>
                            
            <li class="hkb-article-list__<?php 
        hkb_post_format_class();
        ?>
">
                <a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        echo esc_attr(sprintf(the_title_attribute('echo=0')));
        ?>
"><?php 
        the_title();
        ?>
</a>
                <?php 
        hkb_get_template_part('hkb-article-meta', 'related');
        ?>
            </li>

        <?php 
    }
    ?>
        </ul>
    </section>
<!-- /.hkb-article__related -->
<?php 
}
?>

<?php 
//important - reset the post
示例#7
0
 /**
  * Custom content filter
  * @param (String) $content The current content
  * @return (String) Filtered content
  */
 function ht_knowledge_base_custom_content($content)
 {
     global $post, $wp_query, $hkb_current_article_id;
     //don't use in admin
     if (is_admin()) {
         return $content;
     }
     //don't use if current theme template in use
     if (true == $this->theme_template_in_use) {
         $hkb_current_article_id = @$wp_query->post->ID;
         //wp_enqueue_style( 'font-awesome', plugins_url( 'css/font-awesome.min.css', __FILE__ ) );
         remove_filter('the_content', array($this, 'ht_knowledge_base_custom_content'));
         return $content;
     }
     //dont use if ajax search
     if (!empty($_GET['ajax']) ? $_GET['ajax'] : null) {
         remove_filter('the_content', array($this, 'ht_knowledge_base_custom_content'));
         return $content;
     }
     //start custom content_compat mode
     $this->custom_content_compat = true;
     if (isset($post) && $post->post_type == 'ht_kb' && !is_author()) {
         ob_start();
         //remove filters
         remove_filter('the_content', array($this, 'ht_knowledge_base_custom_content'));
         //enqueue styles
         //wp_enqueue_style( 'font-awesome', plugins_url( 'css/font-awesome.min.css', __FILE__ ) );
         //wp_enqueue_style( 'hkb-style', plugins_url( 'css/hkb-style.css', __FILE__ ) );
         //restore query
         $wp_query = $this->temp_query;
         if ($this->is_single) {
             $hkb_current_article_id = $wp_query->post->ID;
             hkb_get_template_part('hkb-compat-single');
         } else {
             if ($this->is_ht_kb_category_tax) {
                 //category
                 hkb_get_template_part('hkb-compat-taxonomy', 'category');
             } elseif ($this->is_ht_kb_tag_tax) {
                 //tag
                 hkb_get_template_part('hkb-compat-taxonomy', 'tag');
             } elseif ($this->is_ht_kb_search) {
                 //search results
                 //@todo - decide what to do about this functionality
                 hkb_get_template_part('hkb-compat-search');
                 //else default to cpt archive
             } else {
                 //archive
                 hkb_get_template_part('hkb-compat-archive');
             }
         }
         //reset the query if single
         if (!$this->is_single) {
             wp_reset_query();
         }
         //skip over first post
         if ($this->is_single) {
             the_post();
         }
         if ($this->is_single) {
             $wp_query->posts_per_page = -1;
         }
         //fix for some themes that try to do post navigation after the loop
         $wp_query->max_num_pages = 1;
         //remove pagination
         global $multipage;
         $multipage = false;
         add_filter('the_content', array($this, 'ht_knowledge_base_custom_content'));
         $output = ob_get_clean();
         //end custom content_compat mode
         $this->custom_content_compat = false;
         //return possibly hi-jacked content
         return $output;
     }
     return $content;
 }
    if (hkb_show_usefulness_display()) {
        ?>
            <?php 
        hkb_get_template_part('hkb-article-meta-usefulness');
        ?>
        <?php 
    }
    ?>
        <?php 
    if (hkb_show_viewcount_display()) {
        ?>
            <?php 
        hkb_get_template_part('hkb-article-meta-views');
        ?>
        <?php 
    }
    ?>
        <?php 
    if (hkb_show_comments_display()) {
        ?>
            <?php 
        hkb_get_template_part('hkb-article-meta-comments');
        ?>
        <?php 
    }
    ?>
        
    </ul>
    <!-- /.hkb-meta -->
<?php 
}
					<?php 
    hkb_get_template_part('hkb-single-attachments');
    ?>

					<?php 
    //hkb_get_template_part('hkb-single-tags');
    ?>
 

					<?php 
    do_action('ht_kb_end_article');
    ?>

					<?php 
    //hkb_get_template_part('hkb-single-author');
    ?>

					<?php 
    hkb_get_template_part('hkb-single-related');
    ?>
		

			</div>	

	<?php 
}
// end of the loop.
?>

</div><!-- /#ht-kb -->
<?php

/*
*
* The compat template for displaying heroic knowledgebase CPT archive content
*
*/
?>

<!-- #ht-kb -->
<div id="hkb" class="hkb-template-archive">

    <?php 
hkb_get_template_part('hkb-searchbox', 'archive');
?>

    <?php 
hkb_get_template_part('hkb-content', 'archive');
?>

</div>
<!-- /#ht-kb -->
<?php

/*
*
* The template used for single page, for use by the theme
*
*/
get_header();
?>

<?php 
hkb_get_template_part('hkb-compat', 'single');
?>

<?php 
get_footer();
        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 
        }
        ?>
 
                  <?php 
        hkb_get_template_part('hkb-article-meta', 'search');
        ?>
                </a>
              </li>
              <?php 
        $counter++;
        ?>
          <?php 
    }
    ?>
    <?php 
}
?>

    <?php 
if ($total_results > 0) {
<article id="post-<?php 
the_ID();
?>
" class="hkb-article" <?php 
//post_class();
?>
>

    <h3 class="hkb-article__title" itemprop="headline">
        <a href="<?php 
the_permalink();
?>
" rel="bookmark"><?php 
the_title();
?>
</a>
    </h3>

    <?php 
hkb_get_template_part('hkb-article-meta');
?>

</article>
<?php

/**
* Theme template for archive display
*/
?>

<?php 
get_header();
?>

<?php 
hkb_get_template_part('hkb-compat', 'archive');
?>

<?php 
get_footer();