Yay, thanks to the help of a co-worker, I now have a solution to this 🙂
Tertiary navigation for the tags (templates/nav-tags.php):
// only load tags from the current page
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'easy_steps',
'paged' => $paged,
'category__in' => ($cat),
);
$second_query = new WP_Query( $args );
global $wpdb;
$tags = array();
$terms = array();
foreach ($second_query->posts as $post)
{
$post_id = $post->ID;
// get post tags for post
$taxonomy = $wpdb->get_results(
$wpdb->prepare("
SELECT *
FROM `hchw_wp2_term_relationships` tr
INNER JOIN `hchw_wp2_term_taxonomy` tt ON tt.term_taxonomy_id=tr.term_taxonomy_id
INNER JOIN `hchw_wp2_terms` t on t.term_id=tt.term_id
WHERE tt.taxonomy='post_tag' AND tr.object_id=".(int)$post_id
)
);
foreach ($taxonomy as $tag)
{
$term = $tag->slug;
if (!isset($$term))
{
// populate tag
$$term = new stdClass;
$$term->term_id=$tag->term_id;
$$term->name=$tag->name;
$$term->slug=$tag->slug;
$$term->term_group=$tag->term_group;
$$term->term_taxonomy_id=$tag->term_taxonomy_id;
$$term->taxonomy=$tag->taxonomy;
$$term->description=$tag->description;
$$term->parent =$tag->parent;
$$term->count="1";
$tags[] = $$term;
$terms[$term] = $counter; // so I know what offset the tag is at in case I need to increase the count
$counter++;
}
else
$tags[$terms[$term]]->count += 1;
}
}
if (count($tags) > 0)
{
foreach ($tags as $tag)
echo '<li id="tag-' . $tag->slug .'"><a id="tag-' . $tag->slug .'" href="" title="' . sprintf( __( "filter posts by %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a></li>';
}