[Resolved] Hide title from category

Home Forums Support [Resolved] Hide title from category

Home Forums Support Hide title from category

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #2370588
    Daniele

    Hi, how can I hide the SEO title from a category?

    Thank you,
    Daniele

    #2370619
    Fernando
    Customer Support

    Hi Daniele,

    For reference, can you provide the link to the site in question?

    You may use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information

    #2370953
    Daniele

    I would like to hide the title at the top, the one above the image. In articles it is possible to do this, but this is one category.

    #2371035
    David
    Staff
    Customer Support

    Hi there,

    are you wanting to remove it just from that Category ? Or ALL categories ?

    #2371053
    Daniele

    Hi, only from that category πŸ™‚

    #2371224
    David
    Staff
    Customer Support

    You can use this PHP Snippet to remove the title:

    
    add_action('wp', function(){
        if ( is_category( 'your-category-slug' ); ) {
            remove_action( 'generate_after_archive_title', 'generate_do_archive_description' );
        }
    });

    You need to update the your-category-slug in the code to match the slug you want it applied to.

    If in the future you want to apply it to multiple categories then you can change

    if ( is_category( 'your-category-slug' ); ) {

    to:

    is_category( array( 'your-category-slug', 'another-category-slug', 'and-another-category-slug' ) );

    #2371323
    Daniele

    Sorry, I don’t understand where you should put it. Can you explain it better?

    Thank you.

    #2371372
    Ying
    Staff
    Customer Support

    Hi Daniele,

    The code David provided is PHP, you can use one of the methods introduced in below article to add PHP code:
    https://docs.generatepress.com/article/adding-php/

    #2371450
    Daniele

    Hi, I installed the code snippets plugin and tried adding the code, with my category slug. But it doesn’t work, because it tells me that the code contains a syntax error!

    This is the code I entered, where I put my category slug:

    add_action(‘wp’, function(){
    if ( is_category( ‘faq-spiritualita-esoterismo-crescita-personale’ ); ) {
    remove_action( ‘generate_after_archive_title’, ‘generate_do_archive_description’ );
    }
    });

    Thanks

    #2371453
    Ying
    Staff
    Customer Support

    Oh I can see the error, try to change it to:

    add_action('wp', function(){
        if ( is_category( 'faq-spiritualita-esoterismo-crescita-personale' )) {
           remove_action( 'generate_after_archive_title', 'generate_do_archive_description' );
        }
    });
    #2371467
    Daniele

    Hi, this is inserted without problems, but I had to remove it because it doesn’t do what it is supposed to do, as it deletes the image under the title, and not the title itself!

    What I want to delete, is the title text above the image πŸ™‚ Is it possible to do this?

    Thanks

    #2371476
    Daniele

    Also keep in mind, that that title is inserted by YOST SEO, and I don’t want to delete it, but just HIDE it.

    #2371484
    Ying
    Staff
    Customer Support

    Do you mean to hide not remove the title: Domande e Risposte su Dio, Spirito, IO ed Anima?

    If so, you can simply use this CSS:

    .category-faq-spiritualita-esoterismo-crescita-personale header.page-header {
        display: none;
    }
    #2371514
    Daniele

    I had to remove this too, because in addition to the title, it removes all the page header! Ie also the image and description under the title .. I also tried replacing the word header with title, but it doesn’t work πŸ™

    Thanks

    #2371519
    Ying
    Staff
    Customer Support

    I see, try this instead:

    .category-faq-spiritualita-esoterismo-crescita-personale .page-header h1.page-title {
        display: none;
    }
Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.