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

Paul Robinson pablorobinson at gmail.com
Wed Dec 10 19:15:05 GMT 2008


Please ignore this message. I've just realized that the theme I am working
on for someone has a category.php file which was overriding archive.php...

Yes, I know. :(

Thanks.
Paul.

2008/12/10 Paul Robinson <pablorobinson at gmail.com>

> 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