Skip to content

Category tooltips

Well, if you’re like me, you’ve been dissatisfied with the “View all posts in the [insert name here] category” tool-tip that pops up when people mouse over the categories in your list… and I have a simple fix for you.

It’s really very simple, just open up your template functions file, and find the list_cats function. Right at the top of that there’s a section that reads:

$query  = "
      SELECT cat_ID, cat_name,
      COUNT($tablepost2cat.post_id) AS cat_count,
 

What you want to do is add the category_description to that:

$query  = "
      SELECT cat_ID, cat_name, category_description,
      COUNT($tablepost2cat.post_id) AS cat_count,
 

Then, further down the function change the cration of the link so that it reads like so:


        $link = '<a href="'.get_category_link(0, $category->cat_ID).'" title="' .
                ( ($category->category_description > '') ?
                        $category->category_description :
                         'View all post in the ' . $category->cat_name . ' category' ) . '">';