Question

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)

Was it helpful?

Solution

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>' );

                }
            }
        }
    }
}

OTHER TIPS

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?

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. ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top