// Surah
add_shortcode ( 'mc-count-tags', 'mc_count_tags' );
function mc_count_tags()
{
$args = array (
'hide_empty' => 1
);
$tags = get_tags ( $args );
return '<strong> ' . sizeof ( $tags ) . '</strong>';
}
// Returns Number of Categories
add_shortcode ( 'mc-count-categories', 'mc_count_cats' );
function mc_count_cats($atts, $content = null)
{
$typePassed = "";
if (! empty ( $atts ['type'] ))
{
$typePassed = $atts ['type'];
}
$args1 = array (
'taxonomy' => 'category',
'orderby' => 'name',
'hide_empty' => 0
);
$terms = get_terms ( $args1 );
$counter = 0;
foreach ( $terms as $term )
{
$type = get_field ( 'category_type', $term );
if ($type == $typePassed)
{
$counter ++;
}
}
return '<strong>' . $counter . '</strong>';
}