Site logo

Archived topic

Adding a filter to remove the word category on archived pages

7 replies · Started by Kris on August 1, 2017

Viewing posts 1–8 of 8

Hey Tom, I was looking at the theme and was wondering how to filter out *Category:* on archived category pages with a plugin.

This is what I've found so far.

add_filter( 'generate_archive_title', function ($title) {
  if ( is_category() ) {
    $title = single_cat_title( '', false );
  }
  return $title;
});

That looks like it should work - is it not working for you?

Not really! Any thoughts?

Actually, the word "Category" shouldn't display in your title by default. Can you link me to the page?

I tried the Simple CSS code and the word "Category:" continues to appear in the title. Do you have another solution? I also tried to make a new hook - but can't find where to make a new hook. Appearances/Elements in the instructions - but Elements is not there. My page is still on local. Can you help?

Hi there,

any chance you can raise a new Topic where you can provide a link to your Site using the Site URL Field.

For the missing Elements, make sure you have the Elements module activated in Appearance > GeneratePress

Okay - I found the way to add a new hook. I do not know what to do now. The hook I want is to remove the word "Category:" from the archive title. So far I am on the page called Add New Element. What is the title? Would "Remove word category from title" work? I selected before_archive_title, and checked Execute Shortcodes. I do not know what to do about Execute PHP, and Priority. Also, I do not know the code to enter. And what about the Display Rules...For Location I put "All Archives". Exclude is blank. Users is "All Users". Can you please send a link with these instructions?

Sorry the two things are unrelated. The "Category" should not display by default, its not something that can be removed by using Hooks. I need to be able to see the Site so we can try and ascertain where it is coming from.

This archived topic is closed to new replies.