Support » Plugin: Show Post Categories » How to show most top(above) parent category name?

  • Resolved imjinoh

    (@imjinoh)


    Hello!

    Thanks for your awesome plugin which made my life so much easier!

    I was wondering if there is a way to show most top located parent category name?

    As current setting, I can only show parent category of the post but I would also want to show most top parent..

    As for example, I have categories named,

    Book
    – kid book
    — MY POST
    – comic book
    — MY POST

    if my category was as above, it would only show MY POST’s parent category but I want the plugin to show “Book”.

    Because I like to show my categories as

    (most above category : post’s category)
    Book : kid book
    Movie : SF

    I tried
    Book : [show_post_categories show=”category” hyperlink=”yes” parent=”yes” parentcategory=”book”]

    Movie : [show_post_categories show=”category” hyperlink=”yes” parent=”yes” parentcategory=”movie”]

    but it does not allow two code to be used at same page.

    Any help?

    of could you help me what I should do to make this happen in includ>category.php?

    Thank you

    • This topic was modified 1 year, 4 months ago by imjinoh.

    The page I need help with: [log in to see the link]

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

    (@imjinoh)

    I applied above code
    Movie : [show_post_categories show=”category” hyperlink=”yes” parent=”yes” parentcategory=”movie”]

    to my custom page and applied that to sidebar.

    Thanks.

    Plugin Author willemso

    (@willemso)

    Hello imjinoh

    Thank you for your kind words.
    I can not see something wrong with your shortcode. Although I have never experienced an issue of using multiple ones on one page.

    The behavior is as expected. Looping through the code you arrive at:
    includes/category.php
    linenumber: 79

    There, the script, it looks at what value is present in the array for the Parent. Its looking for the available value for: [parent] However when using multiple nested values there´s an issue. It only shows its direct Parent. So for you to work, it should order all categories, and then output the data.

    This is a function on my to do list, but due to limited time (it´s a free plugin : ) I did not yet have the time to implement a fix for it.

    If you know a bit of coding, this would be a good starting place:
    https://wordpress.stackexchange.com/questions/37285/custom-taxonomy-get-the-terms-listing-in-order-of-parent-child

    This describes the issue you have, in the original poster his topic.
    47 is child of 46 is child of 39. You can see the array only outputs its direct Parent at [parent].

    If one would add the suggested order scripts, before building the output in my script it should be fixed for your issue?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to show most top(above) parent category name?’ is closed to new replies.