[wp-testers] Having a problem with get_the_category()

Paul Robinson pablorobinson at gmail.com
Wed Dec 10 19:07:28 GMT 2008


Hi,

I'm having a problem getting get_the_category() to work, but the problem is
only on my archive.php template. It works fine everywhere else. I always
though it would work, but am I missing something. Here is the code I have.

while (have_posts()) : the_post();
$cat = get_the_category();
$cat = cat_to_img($cat[0]->name);

Yes I do end the while loop eventually. :P

Can anyone help? Again this code works great on index.php & single.php but
not on archive.php.

Thanks,
Paul.


More information about the wp-testers mailing list