Showing the Category
-
Hi all. I’ve been wondering around these forums for the last few days just trying to figure out how I could display the category title before getting into the loop. I’ve seen a lot of posts about this with no solutions…So I finally thought about it and came to a conclusion. This has worked for me (so far) so I figured I would post it here for everyone.
<?php $category_id = $wp_query->query_vars[‘product_category’];
if($category_id){
$category_name = $wpdb->get_var(“SELECTname
FROM".$wpdb->prefix."product_categories
WHEREid
='”.$category_id.”‘”);
}
echo $category_name; ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Showing the Category’ is closed to new replies.