0

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.

0

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;
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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