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.

My category descriptions are extremely long, so I don't want the descriptions to be used in the title attribute of my category lists. However, WP does this automatically when it outputs the default category widget in the markup.

Is it possible to add a filter in functions.php that assigns the default value for 'use_desc_for_title' to 0? (The default is 1)?

share|improve this question
add comment

2 Answers

I came looking for solution to the same problem. Eventually discovered a very easy solution rather than modifying the function as suggested by Scott B.

It can simply be achieved by using &use_desc_for_title=0in the appropriate place where you want to hide the long description of category.

It would look something like

<?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0'); ?>
share|improve this answer
1  
I think his particular use case was changing the categories widget settings, rather than a custom call to wp_list_categories(); –  Stephen Harris Nov 8 '12 at 16:31
add comment
up vote 0 down vote accepted

I was finally able to figure this out. Much easier than I thought...

function my_categories_filter($cat_args){
    $cat_args['title_li'] = '';
    $cat_args['exclude_tree'] = 1;
    $cat_args['exclude'] = 1;
    $cat_args['use_desc_for_title'] = 0;
    return $cat_args;
}

add_filter('widget_categories_args', 'my_categories_filter', 10, 2);
share|improve this answer
    
Note that this will only change arguments for widget, not for all wp_list_category() calls. I don't see fitting filter for function itself. –  Rarst Jan 12 '11 at 20:43
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.