category - Wordpress, get ID's of multiple categories from the URL -
I am using WordPress 2.8.4.
My question is, if I have a sub-category ("cat-slug-2" in this example) is there a function to get the Category ID and its parents' category IDs in it?
Here is an example url, where sub-categories of cat-slug-2 cat-slug-1
Thanks, John
Maybe something like this?
& lt ;? Php $ current_category = single_cat_title ("", incorrect); $ Range_id = $ wpdb- & gt; Get_var ("SELECT term_id from $ wpdb-> where slug = '. $ Current_category.' ');); Echo (get_category_parents ($ category_ID, TRUE,' & amp; raquo; '));? & Gt;
For more information on the above WP Functions / Template tags, see and.
Comments
Post a Comment