WordPress.org

Ready to get started?Download WordPress

Forums

remove "View all posts in" from the_category tag (8 posts)

  1. blueyez
    Member
    Posted 4 years ago #

    Theme code:

    City: <?php the_category(' | ') ?>

    Html Code:
    City: <a href="http://sitename.com/category/NY/" title="View all posts in NY" rel="category tag">NY</a>

    i want to remove "View all posts in"
    thank you

  2. blueyez
    Member
    Posted 4 years ago #

    anyone ?

    ps: i want to keep: ... title="NY" ...

  3. mamulea
    Member
    Posted 3 years ago #

    Edit the category-template.php file in wp-includes directory and delete all the "View all posts in" occurences.

  4. Bhawna Garg
    Member
    Posted 3 years ago #

    Go to /wp-includes/classes.php, Edit classes.php file and around line 1332.

    Here is the code you want to change.
    $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';

    If you just want the category name to show simply remove everything before the %s.

    This line should now look like
    $link .= 'title="' . sprintf(__( '%s' ), $cat_name) . '"';

  5. dabempire
    Member
    Posted 3 years ago #

    The solution above removes it from the category list, usually in sidebars. To remove it in posts, remove it from /wp-includes/content-template.php

  6. kalooz
    Member
    Posted 3 years ago #

    Just to clarify, it's actually found in /wp-includes/category-template.php

  7. tommyg73
    Member
    Posted 3 years ago #

    This seems like a good solution,
    however
    when you go to upgrade your WP version, the change gets deleted.
    Can anyone offer a neat theme based solution?

  8. tommyg73
    Member
    Posted 3 years ago #

    Found a workaround here: http://bavotasan.com/tutorials/remove-the-title-attribute-from-wordpress-category-and-page-lists/
    essentially it's using a regular expression to remove the title attribute after it's been created, i.e. in the theme (most likely in either functions.php or header.php)

Topic Closed

This topic has been closed to new replies.

About this Topic