Is there an easier way of getting the current category ID? (Without having to access the database)
<?php
$cat_rows = $wpdb->get_results("SELECT term_id FROM wp_term_taxonomy WHERE taxonomy = 'category'");
foreach ($cat_rows as $cat_row) {
if( is_category( $cat_row->term_id ) ){
$what_i_am_looking_for = $cat_row->term_id;
echo 'The current category ID is: ' . $what_i_am_looking_for;
}
}
?>
Here I'm getting all the categories from the database and I'm testing whether or not each of them is the current category... not very effective...