This will only work inside the Loop
Fanx for the pointer…. But what’s the workaround?
Should I write my own function, that extracts the title from the open socket within the page, strips out text, and works out where the title is?!
Surely there is an easy peasy way?
thanks again
ok,
sou you want a ready code…
you are lucky today:
global $wp_query;
$curcat = $wp_query->get_queried_object();
$curcat = $curcat->cat_ID;
Then use this ID to get what you wanto from the category. The name, link.. etc.. with functions like:
get_cat_name
get_category_link
etc…
cheers
Leo,,
Dude
It IS my lucky day. That is most appreciated. You are a legend.
THANK YOU
Ah no… I spoke to soon!
thanks for trying.. Appreciated
Maybe your solution only works on the category page, not within the single.php theme template?
I will paypal you a beer, if you can solve. thanks!
cmon
global $wp_query;
$curObj = $wp_query->get_queried_object();
$curObj = $curObj->ID; //or maybe post_ID .. post_id
$categories = array();
foreach(wp_get_post_categories($curObj) as $cat_id) {
$categories[] = get_cat_name($cat_id);
}
ps – .. Im not testing this ok.. it might not be exactly it, but this is the way…
Leo,,
Much thanks.. that works like a baby.
my email address is at a well known gmail email provider, with paolodit as my name… Let me know your paypal address by email.
thanks!