WordPress.org

Forums

How display the second last child category (2 posts)

  1. Please Add Screenshots
    Member
    Posted 1 year ago #

    I've looked everywhere and I can find how to display (linked) the first and last category (in a hierarchy), but I can't find a way how to display the second last child category.

    Any help greatly appreciated.

  2. bcworkz
    Member
    Posted 1 year ago #

    If you can get the last child category object, it's parent's ID (and the second to last category) is available in 'category_parent'. Do something like this if the last category object is $last_cat:
    get_category_link( $last_cat->category_parent );

Topic Closed

This topic has been closed to new replies.

About this Topic