WordPress.org

Ready to get started?Download WordPress

Forums

How display the second last child category (2 posts)

  1. Pete
    Member
    Posted 10 months 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 10 months 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 );

Reply

You must log in to post.

About this Topic