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.

I am trying to remove the title from all my category and tags page.

So far, I have been using this code http://pastebin.com/xxmyw7BP. It works but not perfectly. The title of my category and tag page is removed. However, on my sidebar, the content in my recent posts widget also lose their titles.

What other qualifier should I add other than is_archive() so that it strictly targets only the title on the category and tag pages?

Thanks.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

I agree that editing the loop would be the best way to do this as it keep the changes local to that php template. Simply go into category.php (or archive.php) and tag.php, look for <?php the_title(); ?> and delete it or change it to <?php //the_title(); ?> to comment it out.

share|improve this answer

It might be better to edit those specific loops to remove the titles, that way it won't affect the lists in the widget areas.

share|improve this answer

If you want to go the filter route, I would use is_category() || is_tag() instead of is_archive(). Also, you probably want to use is_main_query(), so that your filter doesn't impact other queries (such as the recent posts query).

But the better approach would probably be just to create category.php and tag.php template files, in which you omit the call to <?php the_title(); ?> inside the Loop.

share|improve this answer

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.