Current File : /home/itiffy/rockyjohnsonconcrete.com/wp-content/themes/rockyjohnson/category.php |
<?php
get_header();
wp_reset_query();
$cat_id = get_queried_object_id();
?>
<?php include_once('top.php'); ?>
<div class="content">
<div class="services_sec productListPg section">
<div class="container">
<div class="pgHeading catTitle">
<h1><?php wp_reset_query(); if( $cat_id == 3 ){ echo "All Products"; }else{ echo get_cat_name($cat_id); } ?></h1>
</div>
<div class="row">
<div class="col-md-12 itemFilter">
<p>Filter by category: </p>
<select id="selectCatID" name="selectCatID">
<?php
$taxonomy = 'products';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$empty = 0;
$args = array(
//'taxonomy' => $taxonomy,
'child_of' => 3,
'orderby' => 'ASC',
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'hide_empty' => $empty,
'exclude' => 1
);
$all_categories = get_categories( $args );
foreach ($all_categories as $sc){
?>
<option label="<?php echo $sc->name;?>" value="<?php echo $sc->term_id;?>" <?php if($sc->term_id == $cat_id ){ echo "selected"; } ?>><?php echo $sc->name;?></option>
<?php } ?>
</select>
</div>
</div>
<div class="row" id="ajaxItemList">
<div id="loading-image" class="col-md-12"><img src="<?php echo bloginfo('template_directory'); ?>/images/ajax-loader.gif"/></div>
<?php
wp_reset_query();
query_posts(array( 'post_type'=>'product', 'order'=> 'ASC', 'cat'=> $cat_id, 'posts_per_page' => -1 ));
if(have_posts()){
while(have_posts()){
the_post();
?>
<div class="col-md-3">
<div class="servBox">
<div class="thumb_img"><a href="<?php the_permalink(); ?>"><img src="<?php the_post_thumbnail_url(); ?> " /></a></div>
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<p><?php echo wp_trim_words( get_field('product_short_description'), 12, '...' ); ?></p>
<a class="btns" href="<?php the_permalink(); ?>">View Item</a>
</div>
</div>
<?php } } ?>
</div>
</div>
</div><!--productListPg end-->
</div><!--Content end-->
<!--Footer start-->
<?php get_footer(); ?>
<?php include_once('commonJs.php'); ?>
</body>
</html>