[wp-hackers] custom taxonomies : how to get the current slug?
Jimmy Roy
jimmy.roy at gmail.com
Wed Jan 19 08:48:08 UTC 2011
hi,
I've a custom post type and a custom taxonomy.
in the sidebar of my site I list the terms, for example:
*Color* (the taxonomy)
- red (2)
- blue (3)
if I click on blue I list all post with associated to the blue term.
in this page (www.example.com/color/blue/, I would like to show the number
of post (ie 3), I use this piece of code for testing and it works but the
term name is harcoded:
$taxonomy = "color";
$term_slug = 'red';
$term = get_term_by('slug', $term_slug, $taxonomy);
echo 'Number of posts: '.$term->count;
so my question is how to get the current slug?
(and sorry for my bad english!)
--
Jimmy | www.jimmyroy.fr
--
More information about the wp-hackers
mailing list