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 want to show all my post taxonomies on the left side of the web page in such a way that when a person click on it the post can be displayed according to the taxonomies.is there anyway to display them and i also want to add some style in it.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can build a list using two functions: get_terms() and get_term_link():

<?php
function wpse73271_get_term_archive_link_list( $taxonomy ) {
    // First, get an array of term IDs
    $term_objects = get_terms( $taxonomy );

    // Now, loop through $term_ids and get
    // an array of term archive permalinks
    foreach ( $term_objects as $term_object ) {
        $term_object->url = get_term_link( $term_object, $taxonomy );
        $term_object->permalink = '<a href="' . $term_object->url . '">' . $term_object->name . '</a>';
    }

    // Now, build an HTML list of permalinks:
    $output = '<ul>';
    foreach ( $term_objects as $term_object ) {
        $output .= '<li>' . $term_object->permalink . '</li>';
    }
    $output .= '</ul>';

    // Now return the output
    return $output;
}
?>
share|improve this answer
    
thanks it will help me alot –  FAWAZ Nov 20 '12 at 12:52

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.