Forums

Possible bug with category[0]->cat_name (2 posts)

  1. olorf
    Member
    Posted 2 months ago #

    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

  2. jrbriggs
    Member
    Posted 2 weeks ago #

    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.

Reply

You must log in to post.

About this Topic