• Hi all,

    I have written this code and I am confused at the outcome:

    https://pastebin.com/kwjM3BX7

    When run, it outputs:

    Product categories
      Chairs
        Metal
          Metal chair
        Wooden
          Wooden chair
        Wooden chair
      Tables
        Wooden
          Wooden table
        Wooden table

    It is suppose to output the product_category taxonomy terms:

    “Chairs” with its children:
    “Metal” and “Wooden”

    and

    “Tables” with its children:
    “Wooden”

    Then for each sub term, it should output the posts that belong to it:

    Wooden chair
    Metal chair
    Wooden table

    But instead it cycles through the posts:

    “Wooden chair” for example

    and then ends the ul and then does Wooden chair as if it’s a term when infact its just a post.

    Any ideas?

    [ Please be patient and do not bump. That’s not permitted here. ]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jimmyt1988

    (@jimmyt1988)

    EDIT::::::::::

    On further inspection. It is not a data issue at all. If I order by DESC on the initial list, it outputs the Metal as a double up.

    EDIT::::::::::

    If I make hierarchical false on the first list function, the parent terms disappear but there are no duplicate entries..

    Thread Starter jimmyt1988

    (@jimmyt1988)

    I’m still stuck on this. Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting my walker class to output term posts using wp_list_categories();’ is closed to new replies.