Maybe, a solution… This works for me. It gives the ID of the Category… just put this in the “functions.php” in your themes folder. It works inside and outside the Loop, and even in the single.php.
function gib_kategorie_ID()
{
global $wpdb;
$diekat = get_query_var(‘cat’);
if ($diekat < 1)
{
$name = get_query_var(‘name’);
$id = $wpdb->get_var(“SELECT ID FROM $wpdb->posts WHERE post_name = ‘$name'”);
$kategorie = mysql_query(“SELECT category_id FROM $wpdb->post2cat WHERE post_id = ‘$id’ ORDER BY category_id ASC LIMIT 1”);
$diekat = @mysql_result($kategorie, 0);
}
return $diekat;
}