Count of links in a specific link category (2 posts)

  1. dherren
    Posted 10 years ago #

    I have (so far) been unable to find anything in the codex or the forums which indicates whether or not there is a (native) way to get the count of the number of links in any particular link category.

    I'm trying to dynamically modify my sidebar menu structure based upon the number of links in a particular category, but I have't found a way to get the count yet.

  2. skeltoac
    Posted 10 years ago #

    Sorry, it's not native. You can make a plugin or a hack to do this. Make a copy of the last function, get_links_list(), from wp-includes/links.php and give the new function a unique name. You'll need to rewrite the MySQL query to accommodate something like ORDER BY count(link_id). This might require the use of GROUP BY instead of DISTINCT, which would break the test for empty categories.
    I'd work out the query for you but I don't have access to my databases from behind the proxy at work. I should cut out of here...

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.