• I have designed a theme with several taxonomies. In order to use a Jquery tooltip in the single template I want to show these taxonomies in a list with get_the_term_list but I would also like the a tags produced to have a title (specific to the taxonomy) and a class.

    Anyone have any ideas how I could do this? I’m currently using:

    <a href="<?php bloginfo('url'); ?><?php $terms_as_text = strtolower(strip_tags( get_the_term_list( $wp_query->post->ID, 'brand', '', '', '' ) ));
    echo str_replace(" ","-", $terms_as_text); ?>/" title="View all <?php $terms_as_text = strip_tags( get_the_term_list( $wp_query->post->ID, 'brand', '', '', '' ) ); echo $terms_as_text; ?>" class="tooltip"><?php $terms_as_text = strip_tags( get_the_term_list( $wp_query->post->ID, 'brand', '', '', '' ) ); echo $terms_as_text; ?></a>

    which works only if there is one term per taxonomy. Any more and it all goes wrong!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘get_the_term_list with title and class’ is closed to new replies.