0

I have a custom Taxonomy sports and want to edit the front-end display. I have got taxonomy-sports.php and used this code to get the data on the taxonomy, but I feel like it should already be available? Is there a simpler way to do this or is going into $wp_query the way to go?

$sport_slug = $wp_query->query_vars['sports'];
$the_sport = get_term_by( 'slug', $sport_slug, 'sports', ARRAY_A );
print_r($the_sport);

Basically I understand http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display but don't exactly know what is available to me and the best way to get to my taxonomy data on taxonomy-{sometax}.php

Thanks, Andrew

0
-1

I found the answer I was looking for as this:

$sport_slug = get_query_var('term');

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.