WordPress.org

Forums

Link Categories Description (9 posts)

  1. line47
    Member
    Posted 6 years ago #

    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=

  2. &after=
  3. '); ?>

    Thanks!
    Scott!

  • MichaelH
    Member
    Posted 6 years ago #

    Did you look at the category_name= parameter of the template tag, wp_list_bookmarks()?

  • line47
    Member
    Posted 6 years ago #

    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.

  • MichaelH
    Member
    Posted 6 years ago #

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

  • leggo-my-eggo
    Member
    Posted 6 years ago #

    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
    Member
    Posted 5 years ago #

    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
    Member
    Posted 5 years ago #

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

  • Mossa
    Member
    Posted 5 years ago #

    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
    Member
    Posted 5 years ago #

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

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.