[Support request] Adding a filter to remove the word category on archived pages

Home Forums Support [Support request] Adding a filter to remove the word category on archived pages

Home Forums Support Adding a filter to remove the word category on archived pages

  • This topic has 7 replies, 4 voices, and was last updated 5 years ago by David.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #358196
    Kris

    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;
    });
    #358439
    Tom
    Lead Developer
    Lead Developer

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

    #358464
    Kris

    Not really! Any thoughts?

    #358635
    Tom
    Lead Developer
    Lead Developer

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

    #863692
    Toni

    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?

    #864157
    David
    Staff
    Customer Support

    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

    #864665
    Toni

    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?

    #864892
    David
    Staff
    Customer Support

    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.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.