WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_bookmarks will not show category description (5 posts)

  1. majestictreefrog
    Member
    Posted 2 years ago #

    In my theme I have:

    wp_list_bookmarks('show_description=1');

    this shows the title, the links, but NOT the category descriptions as I hoped. Indeed, outside of this function I can't find any way to access category descriptions.

  2. majestictreefrog
    Member
    Posted 2 years ago #

    oh, and I should note that no images for the category have been defined.

  3. majestictreefrog
    Member
    Posted 2 years ago #

    anybody?

  4. Steve Pye
    Member
    Posted 2 years ago #

    I know this is an old post, but I was looking for the solution myself, and found a way to do this. All you need to do is copy the wp_list_bookmarks() function from wp-includes/bookmark-template.php into your functions.php file, calling the new function wp_list_bookmarks2() or something like that.

    Then, in the first block of the if() {...} structure, just under $catname = apply_filters... add the following line:

    $catdescr = apply_filters("link_category", $cat->description);

    And in the line below that which has:

    $output .= "$title_before$catname$title_after\n\t<ul class='xoxo blogroll'>\n";

    change it to something like this:

    $output .= "$title_before$catname<span>$catdescr</span>$title_after\n\t<ul class='xoxo blogroll'>\n";

    Or something to that effect so that your description is appearing somewhere. The <span> around it should allow you to style it based on the surrounding classes from whatever's in the $title_before tag.

  5. johnnyriss
    Member
    Posted 2 years ago #

    Very helpful. Much thanks.
    Here is a link to my full code for this function in case others want to use it.
    http://pastebin.com/9AeikRpu
    I put the description within p tags under the category title.

Topic Closed

This topic has been closed to new replies.

About this Topic