Skip to content

Instantly share code, notes, and snippets.

@unwiredtech
Created October 6, 2017 18:26
Show Gist options
  • Save unwiredtech/f2b763d5e1027bfb055ffc176298aa13 to your computer and use it in GitHub Desktop.
Save unwiredtech/f2b763d5e1027bfb055ffc176298aa13 to your computer and use it in GitHub Desktop.
WordpressTaxonomy Terms Template
<?php // get_template_part('archive-kb'); ?>
<?php
/**
* The template for displaying Archive pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Fourteen
* already has tag.php for Tag archives, category.php for Category archives,
* and author.php for Author archives.
*
* @link http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Kleo
* @since Kleo 1.0
*/
get_header();
?>
<?php
//Specific class for post listing */
$blog_type = sq_option('blog_type', 'masonry');
$blog_type = apply_filters('kleo_blog_type', $blog_type);
$template_classes = $blog_type . '-listing';
if (sq_option('blog_archive_meta', 1) == 1) {
$template_classes .= ' with-meta';
} else {
$template_classes .= ' no-meta';
}
if ($blog_type == 'standard' && sq_option('blog_standard_meta', 'left') == 'inline') {
$template_classes .= ' inline-meta';
}
add_filter('kleo_main_template_classes', create_function('$cls', '$cls .=" posts-listing ' . $template_classes . '"; return $cls;'));
?>
<?php get_template_part('content', 'kb-search'); ?>
<?php get_template_part('page-parts/general-title-section'); ?>
<?php get_template_part('page-parts/general-before-wrap'); ?>
<?php if (category_description()) : ?>
<div class="archive-description"><?php echo category_description(); ?></div>
<?php endif; ?>
<?php
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$q = new WP_Query([
'post_type' => 'kb',
'posts_per_page' => get_option('posts_per_page'),
get_query_var( 'taxonomy' ) => get_query_var( 'term' ),
'paged' => $paged
]);
$temp_query = $wp_query;
$wp_query = null;
$wp_query = $q;
if ( $q->have_posts() ) :
while ( $q->have_posts() ) : $q->the_post();
?>
<div class="col-md-12">
<div style="margin-bottom:30px;">
<h4><a href="<?php echo get_permalink( $post->ID ); ?>"><?php the_title(); ?></a></h4>
<p><?php the_excerpt(); ?></p>
<p><?php get_post_meta( get_the_ID(), 'url', true ); ?></p>
</div>
</div>
<?
endwhile;
endif;
// Reset postdata
wp_reset_postdata();
kleo_pagination();
// Reset main query object
$wp_query = NULL;
$wp_query = $temp_query;
?>
<?php do_action('kleo_after_archive_content'); ?>
<?php get_template_part('page-parts/general-after-wrap'); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment