0

My use of the_category works fine, but I want to change the tooltip, which says "View all posts in (category name)".

How can I change this tooltip?

I guess this might be something similar to this.

Thank you

2

I used this solution instead, within my single.php file:

<?php
//categories loop

$categories = get_the_category();
$separator = ', ';
$output = '';
if($categories){
    foreach($categories as $category) {
        $output .= '<a href="'.get_category_link( $category->term_id ).'" title="' .     esc_attr( sprintf( __( "%s" ), $category->name ) ) . '">'.$category-    >cat_name.'</a>'.$separator;
    }
echo trim($output, $separator);
}
?>
| improve this answer | |
2

You want to change the tooltip... but to what? Sorry my crystal ball isn't quite working today.

Here are some options you have:

  • Change it in wp-includes/category-template.php but that's far from ideal since an update will overwrite this.
  • You can add a function to your function.php file. For example if you want to remove it completely (since you didn't write how you want to change it):

    function categories_without_title_attribute() {
        $categories = wp_list_categories('echo=0');
        $categories = preg_replace('/title=\"(.*?)\"/','',$categories);
        echo $categories;
    }
    

Then of course use the fn to output your (modified) categories.

| improve this answer | |
  • Thank you, I opted for the solution proposed below, which allows me to set the title I want without modifying master files. – p.a. Jan 20 '14 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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