WordPress.org

Ready to get started?Download WordPress

Forums

Link Library
Patch: Support for Hierarchical Link Categories (2 posts)

  1. sgirard
    Member
    Posted 2 years ago #

    Hi Jack. I threw out the idea of supporting the Hierarchical Link Categories plugin on your site the other day and went ahead with a basic implementation this morning. Feel free to use it if you want or maybe this will be useful for others.

    The basic idea is let's say you have have this link category hierarchy:
    1
    -2
    -3
    --4
    5
    6

    And you want to be able to say:
    [link-library-cats settings=1 categorylistoverride=1]
    and then get 1,2,3,4 to show up in your list (so that as you add child categories you don't have to come back and update your shortcode).

    Anyway, I just added

    // Recursive hooks for Hierarchical Link Categories plugin -sg
    if (in_array('hierarchical-link-categories/heirarchical-links.php', get_option('active_plugins'))) {
        $selectedcategorylist = $this->link_library_cats_recursive_func($selectedcategorylist);
        $excludedcategorylist = $this->link_library_cats_recursive_func($excludedcategorylist);
    }
    // End recursive hooks

    right before:

    $genoptions = get_option('LinkLibraryGeneral'); near the bottom of link_library_cats_func

    and then added this method to the same class:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Oops. Added the method in this here pastebin:

    http://pastebin.com/pUQqvfMH

    Hope it helps. If this post editor blows up the code I'll just put my link-library.php someplace and post a follow-up.

    I haven't tested this with exclusions yet but I think it should work.

    I'm on 4.9.8

    Thanks,
    -sean

    http://wordpress.org/extend/plugins/link-library/

  2. Yannick Lefebvre
    Member
    Plugin Author

    Posted 2 years ago #

    I will consider this for inclusion in future updates. Thanks for sending the code samples.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic