WordPress.org

Support

Support » How-To and Troubleshooting » Link Categories Description

Link Categories Description

  • How can a get and display a link category description.

    Here is what I have now to display links and I am wondering if there is something I am missing?

    <?php wp_list_bookmarks('category=12&show_description=1&before=

  • &after=
  • '); ?>

    Thanks!
    Scott!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Did you look at the category_name= parameter of the template tag, wp_list_bookmarks()?

    Im actually looking to display the description of the category and show_description is not working for the description of the category but instead for the links inside the category.

    This causes the Category name followed by the link in that category to display:
    <?php wp_list_bookmarks('category=12'); ?>

    What I think line47 is looking for is not displayed by that code. He’s looking for the information contained in the Link Category description, not the Link description.

    If you use

    wp_list_bookmarks('show_description=1')

    you get the Link descriptions, but there is seemingly no equivalent parameter to show the Link Category description. (I tried show_category_description just in case, but no dice).

    Does anyone know how to do this?

    Amanda

    @ohamanda-1

    It’s in the suggested features area, maybe it’s not possible… seems like there’s ALWAYS a work-a-round in wp though.

    Did anyone figure it out?

    nedsferatu

    @nedsferatu

    is there seriously no way to pull out the link category descriptions?

    Yes there is (of course) a way to get the link category description since it is saved in the database. But you can’t do it from the template tag, you have to edit the function(s) yourself.

    Under the directory wp-includes you’ll find the file bookmark-template.php with the corresponding functions. If you want to include the description in the wp_list_bookmarks-function you can use the tag $cat->description in the array loop. For example, at line 227 you could change this line:

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

    … to this line:

    $output .= "$title_before$catname$title_after\n\t<p>$cat->description</p>\n\t<ul class='xoxo blogroll'>\n";

    You could obviously change the formating to whatever suits you, or even build it up with dynamic “before” and “after” tags for the function if you need the flexibility.

    Good luck!

    leggo-my-eggo

    @leggo-my-eggo

    @mossa, I love when people answer like this! Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Link Categories Description’ is closed to new replies.