Support » Themes and Templates » Display link category description???

  • Resolved wmburke

    (@wmburke)


    I am trying to display the link category description in a theme I’m working on and cannot seem to find any way to do it.

    wp_list_bookmarks only references the description of the links themselves.

    category_description returns no information, I assume because I’m not trying to access a post category description.

    I would love to use it in the following way:
    <?php echo category_description(89); ?>

    Thank you in advance,
    Wayne

Viewing 6 replies - 1 through 6 (of 6 total)
  • <?php if ( !(''== category_description()) ) : echo apply_filters('archive_meta', category_description()); endif; ?>

    ^^ from the Sandbox theme

    Hey SmallPotato,

    Thanks for the quick reply. Maybe I’m just missing something obvious, but I get no results from this code – just as I didn’t from what I was trying before.

    I’m not putting this in the loop, so my actual code is:

    <?php if ( !(”== category_description(89)) ) : echo apply_filters(‘archive_meta’, category_description(89)); endif; ?>

    Just in case I wasn’t clear, I’m trying to display the description from a link category – not from a post category.

    Maybe it just can’t be done???

    SmallPotato

    (@smallpotato)

    my mistake, i was thinking post category. i’ve never done it before, but have you tried turning on link description and exclude all but one link?

    http://codex.wordpress.org/wp_list_bookmarks

    wmburke

    (@wmburke)

    Yeah, actually I did try that — the difficulty is that the description that they’re talking about there is for the links, and not for the category. It seems that the link category description is a casualty of the changes that occurred in categories during the switch to 2.3 (if I’ve understood some of the other posts I’ve read).

    I think I’m just going to use the Improved Include Plugin and put the text that I was hoping to house in the link category description in a separate page — this will no doubt simplify it for the authors of the site content, anyway.

    Thanks for your help — I imagine that there is a way with PHP to call any data out of the database, but I’m not sufficiently sophisticated, so I’ll save that battle for another day.

    Wayne

    wmburke

    (@wmburke)

    Just in case anyone’s looking for this, the following calls the link category description text from the database:

    <?php $link_cat_desc = $wpdb->get_var("SELECT wp_term_taxonomy.description FROM wp_term_taxonomy WHERE wp_term_taxonomy.term_id=107") ?>

    Of course, you should change the term_id at the end to whatever category ID from the Blogroll>Category page that you want to use.

    And then where ever you want to use it, just call it like this:
    <?php echo $link_cat_desc; ?>

    That’s all I’ve got. Happy WordPressing!

    Very useful, thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display link category description???’ is closed to new replies.