Private: Home › Forums › WordPress Themes › Elvyre – Retina Ready WordPress Theme › categories list by portfolio project › Reply To: categories list by portfolio project
November 7, 2014 at 1:24 pm
#1025
Participant
Hello,
You can try and copy the code which shows the category list from the wp-content/themes/elvyre/cpt-portfolio.php.
Copy the part which starts at line 85 untill 120th line.
This should be the code:
<ul id="filters">
<?php
$category_html = '';
$categories_count = 0;
if (is_tax()) {
$category_id = "";
$query_category = $wp_query->get_queried_object();
$category_id = $query_category->term_id;
$args = array(
'order' => 'ASC',
'include' => $category_id
);
} else if (!empty($specific_taxonomies)) {
$args = array(
'include' => $specific_taxonomies,
'order' => 'ASC'
);
} else {
$args = array('order' => 'ASC');
}
$categories = get_terms('portfolio-category', $args);
$index = 1;
foreach ($categories as $cat) {
$category_html .= '<li><a data-filter=".' . $cat->slug . '" href="#">' . $cat->name . '<span class="item-number">' . $cat->count . '</span></a></li>';
$categories_count += $cat->count;
$index++;
}
if (count($categories) > 1):
?>
<li class="active"><a href="#" data-filter="*"><?php _e('All', 'pi_framework') ?> <span class="item-number"><?php echo $categories_count ?></span></a></li>
<?php endif; ?>
<?php echo $category_html ?>
</ul>
You will need to style it as you wish and apply some css rules to it.
Let me know if it works…
Robert