Okay, here’s the taxonomy registration:
if ( ! function_exists( 'album_slug' ) ) {
// Register Custom Taxonomy
function album_slug() {
$labels = array(
'name' => _x( 'Album Slug', 'Taxonomy General Name', 'text_domain' ),
'singular_name' => _x( 'Album Slug', 'Taxonomy Singular Name', 'text_domain' ),
'menu_name' => __( 'Album Slug', 'text_domain' ),
'all_items' => __( 'All Album Slugs', 'text_domain' ),
'parent_item' => __( 'Parent Album Slug', 'text_domain' ),
'parent_item_colon' => __( 'Parent Album Slug:', 'text_domain' ),
'new_item_name' => __( 'New Album Slug', 'text_domain' ),
'add_new_item' => __( 'Add New Album Slug', 'text_domain' ),
'edit_item' => __( 'Edit Album Slug', 'text_domain' ),
'update_item' => __( 'Update Album Slug', 'text_domain' ),
'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
'search_items' => __( 'Search Album Slugs', 'text_domain' ),
'add_or_remove_items' => __( 'Add or remove album slugs', 'text_domain' ),
'choose_from_most_used' => __( 'Choose from the most used album slugs', 'text_domain' ),
'not_found' => __( 'Not Found', 'text_domain' ),
);
$rewrite = array(
'slug' => 'album-slug',
'with_front' => true,
'hierarchical' => false,
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
'rewrite' => $rewrite,
);
register_taxonomy( 'album_slug', array( 'dub_track' ), $args );
}
// Hook into the 'init' action
add_action( 'init', 'album_slug', 0 );
}
And here’s the rest:
<?php if ($tracks_query->have_posts()) : ?>
<?php while ($tracks_query->have_posts()) : $tracks_query->the_post(); ?>
<p><?php if (has_term('','track_no')) { $terms = get_the_terms( $post->ID , 'track_no' ); foreach ( $terms as $term ) { echo $term->name; } }; ?> - <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<?php endwhile; ?>
<?php else : ?>
<h4>Nothing Found</h4>
<p>Sorry but this album doesn’t seem to have any tracks.</p>
<?php endif; ?>
<?php
wp_reset_postdata();
//END TRACK INFO
?>
I’ve slightly simplified the code just to show what’s relevant. Thanks