Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm pulling my hair out over this. In the Links manager, you can enter a description for the category (in addition to the link itself). However, in wp_list_bookmarks, there is no way to call this value anywhere. So how can I get it?

I know it's in the term_taxonomy table, under link_category. So is there a function that could be written to retrieve this value dynamically (i.e. not having to declare each link category independently)

share|improve this question
add comment

3 Answers

Not the best solution for this case, but you can use it for now:

<?php $cat = get_category(YOUR_CATEGORY_ID, 'ARRAY_A'); ?>
<?php echo $cat['description']; ?>

Hope that helps. I am seeking a better solution. ;)

share|improve this answer
    
yeah, this would pull the regular post category descriptions, not the link category descriptions. Thanks though. –  Norcross Oct 23 '10 at 17:19
add comment

use:

get_term_field( $field, $term, $taxonomy, $context = 'display' )

e.g.:

get_term_field('description', 3, 'link_category')

For the bookmarks widget, isn't there an option to show them automatically?

share|improve this answer
1  
I think widget deals with descriptions of individual Links and not their categories. –  Rarst Oct 22 '10 at 5:40
    
Hmmm, almost there. it works, but all I'd need to do is write a function to grab the category ID automatically. What I've done is write a string that'll pull every category that they have for a 'blogroll' page, list them in category order with the appropriate header. All I need now is to make it so it recognizes each category. –  Norcross Oct 23 '10 at 17:25
add comment
up vote 2 down vote accepted

OK, with the help of a friend I was able to get this done. I ditched the wp_list_bookmarks and went with a combination of get_terms and get_bookmarks.

function blogroll_page( $args = array() ) {
    if(is_page('blogroll')) {
        if( $terms = get_terms( 'link_category', $args = array('exclude' => 16) ) )
        {
            foreach( $terms as $c )
            {
                printf( '<h3>%s</h3>', $c->name );
                printf( '<p>%s</p>', $c->description );

                if( $bookmarks = get_bookmarks( array( 'category' => $c->term_id ) ) )
                {
                    printf( '<ul class="xoxo bookmarks">' );
                    foreach( $bookmarks as $bm )
                        printf( '<li><a href="%s" title="%s">%s</a></li>', $bm->link_url, $bm->link_description, $bm->link_name );
                    printf( '</ul>' );

                }
            }
        }
    }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.