MichaelH – here is the plugin code, in its entirety. Any thoughts on adapting your suggested chunk of code to restrict what taxonomy terms are listed by the plugin code below? Thanks!
if( !function_exists( 'pr' ) ) {
function pr( $var ) {
print '<pre>' . print_r( $var, true ) . '</pre>';
}
}
if( !function_exists( 'mfields_taxonomy_terms_list' ) ) {
add_filter( 'the_content', 'mfields_taxonomy_terms_list' );
function mfields_taxonomy_terms_list( $c ) {
global $post;
$o = '';
$terms = array();
$lists = array();
$custom_taxonomy_names = array();
$custom_taxonomies = mfields_get_custom_taxonomies();
if( !empty( $custom_taxonomies ) )
foreach( $custom_taxonomies as $name => $config )
$custom_taxonomy_names[] = $config->name;
if( !empty( $custom_taxonomy_names ) )
$terms = get_terms( $custom_taxonomy_names );
foreach( $custom_taxonomies as $name => $config )
$o.= get_the_term_list( $post->ID, $name, $before = '<div class="taxonomy-term-list"><div class="mfields-taxonomy-term-list-name">Related ' . $config->label . ':</div> ', $sep = '<br />', $after = '</div>' );
if( is_single() || is_page() )
return $c . $o;
return $c;
}
}
$taxonomy = 'post_tag';
$args='';
$terms = wp_get_post_terms($post->ID , $taxonomy, $args);
if ($terms) {
foreach ( $terms as $term ) {
if ($term->count > 1) {
echo '<p><a href="' . esc_attr(get_term_link($term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a> has ' . $term->count . ' post(s). </p> ';
}
}
}
if( !function_exists( 'mfields_get_custom_taxonomies' ) ) {
function mfields_get_custom_taxonomies( ) {
global $wp_taxonomies;
$custom_taxonomies = array();
$default_taxonomies = array( 'post_tag', 'category', 'link_category' );
foreach( $wp_taxonomies as $slug => $config )
if( !in_array( $slug, $default_taxonomies ) )
$custom_taxonomies[$slug] = $config;
return $custom_taxonomies;
}
}
?>