• Resolved Re4DeR

    (@re4der)


    Hi, when I am using function wp_list_categories it generates something like

    <li class="cat-item cat-item-%id%"><a href="" title="View all posts in %category%">%category%</a>
    </li>

    I would like to change text “View all posts in %category%” but I dont know how. There is no title in “wp-includes/category-template.php”

    It should be possible to make some regular expretion to replace title in but it seem slow to me.

Viewing 4 replies - 1 through 4 (of 4 total)
  • possibly use a filter function;

    example (to be added into functions.php of your theme, or to be made into a plugin):

    add_filter( 'wp_list_categories', 'custom_title_attribute_wp_list_categories' );
    function custom_title_attribute_wp_list_categories( $list ) {
    
    $list = str_replace( 'View all posts filed under', 'Something else in ', $list );
    
    return $list;
    }
    Thread Starter Re4DeR

    (@re4der)

    Yeap, it is solution (not exactly like this, but trough regular expression delete all title and add new – I am pulling new one from database), but it seems to me neefective. – create one default title, delete this title, add new title.

    Moderator bcworkz

    (@bcworkz)

    wp_list_categories() is not that efficient in any case, it is a very flexible function. With flexibility comes complexity and loss of efficiency.

    If you want efficiency, write your own targeted function for your specific needs using get_categories() as the initial data source.

    Thread Starter Re4DeR

    (@re4der)

    good point! I didnt get this idea. It is ok now :-). Thank you! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘category link title’ is closed to new replies.