I wanted create a widget for the sidebar of the theme that i'm working on recently...But I can't find a way to get links of categories.
This is the code of my widget:
<section class="sidebar-categories">
<div class="inner">
<h3><label>categories</label></h3>
<ul>
<?php
$args = array(
'taxonomy' => 'category',
'parent' => 0, // get top level categories
'orderby' => 'name',
'order' => 'ASC',
'number' => 2,
'hierarchical' => 1,
'pad_counts' => 0
);
$categories = get_categories( $args );
foreach ( $categories as $category ){
echo '<a href=""><li>'. $category->name . '<span>'. $category->count .'</span></li></a>';
}
?>
</ul>
</div><!-- /inner -->
</section><!-- /sidebar-categories -->
Everything is fine...Markup is exacly what I want...But I don't know what to put in <a href="">
to get the links of categories...
ANY HELP WOULD BE APPRECIATED...