WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. olorf
    Member
    Posted 4 years 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. nolongeractive
    Member
    Posted 4 years 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.

Topic Closed

This topic has been closed to new replies.

About this Topic