How to display the term_ID in archive page
-
<?php $current_category = single_cat_title("", false); ?> <span class="category-title"><?php echo $current_category; ?></span>
This is what i’m using to display the Category Name in archive, but i need some code to display it’s term_ID. I’m Using Custom Post Type and this a custom taxonomy. I seriously don’t know what it’s called.. but I know it’s a Custom Post Type Category.
I tried the getCurrentCatID() function not working.
Also tried this $cat = get_category( get_query_var( ‘cat’ ) );. But also not working.<?php global $wp_query; $category = $wp_query->get_queried_object(); ?>
Tried everything. But NOTHING worked.
*Hope you guys can help me with this. Stuck here forever.
By the way, i’m trying to get the ID so i can get the child categories and display them in DROPDOWN BOX. Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to display the term_ID in archive page’ is closed to new replies.