Support » Fixing WordPress » Possible bug with category[0]->cat_name

  • Hi,

    I have a webshop and I’m trying to get the current category for a certain item displayed within the loop.
    This works fine for the most part.. But with some categories the parent seems to be displayed instead.

    Since I use YAK I have to put the item in both the category and it’s parent.

    The code I use is
    <?php$category = get_the_category(); echo $category[0]->cat_name;?>

    Please help

Viewing 1 replies (of 1 total)
  • You don’t have to put it in both category and parent. Not quite sure what you’re trying to do, but you should have a “products” category and a “default” child (as an example). You only need to put the item in “default”. Not in “products” as well.

Viewing 1 replies (of 1 total)
  • The topic ‘Possible bug with category[0]->cat_name’ is closed to new replies.