Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a blog plugin. I have the blog category in my blog. I would like to get the list of all the blog categories and list it in my www.domain.com/blogs/ page. My blog category name is 'blogcategory' . I do not know how to use it in the list-category function.

I am a nooby to wordpress development.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Can I use the following code for my question.

<?php $args = array('taxonomy' => 'blogcategory'); ?>
<?php $tax_menu_items = get_categories( $args );
foreach ( $tax_menu_items as $tax_menu_item ):?>

    <a href="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>">
        <?php echo $tax_menu_item->name; ?>
    </a>

<?php endforeach; ?>

I found it from here

Updated: I found the answer I was looking for

<?php

$taxonomy = 'blogcategory';
$tax_terms = get_terms($taxonomy);
?>
<ul>
<?php
foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';
}
?>
</ul> 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.