<?php } wp_reset_query(); } ?> </div> <div class="col-lg-4 col-lg-offset-1 col-md-4 col-sm-12"> <?php $taxonomies = array(); $post_type = array(); $taxonomies[] = 'news-type'; $post_type[] = 'news'; $post_cat = get_terms_by_post_type($taxonomies, $post_type); if ($post_cat) { echo "<div class='widget-box'><h3 class='widget-title'>" . __('Categories', 'govintranet') . "</h3>"; echo "<p class='taglisting " . $post->post_type . "'>"; foreach ($post_cat as $cat) { if ($cat->name) { $newname = str_replace(" ", " ", $cat->name); echo "<span><a class='wptag t" . $cat->term_id . "' href='" . get_term_link($cat->slug, 'news-type') . "'>" . $newname . "</a></span> "; } } echo "</p></div>"; } //$tagcloud = my_colorful_tag_cloud('', 'news-type' , 'news'); $tagcloud = gi_howto_tag_cloud('news'); if ($tagcloud != '') { echo "<div class='widget-box'>";
function the_category_filter($post_type = NULL) { $this_cat_id = get_query_var('cat'); if ($post_type) { $categories = get_terms_by_post_type(array("category"), array($post_type)); } else { $categories = get_terms('category'); } ?> <select class="form-control input-sm" onchange="javascript:location.href = this.value;"> <?php if (!$this_cat_id) { ?> <option>Choose a Category</option> <?php } foreach ($categories as $cat) { ?> <option<?php if ($this_cat_id == $cat->term_id) { echo ' selected'; } ?> value="<?php echo home_url('category/' . $cat->slug . '?post_type=' . $post_type); ?> "><?php echo $cat->name; } ?> </select> <?php }