- This topic has 16 replies, 4 voices, and was last updated 5 months, 1 week ago by
Ying.
-
AuthorPosts
-
October 11, 2022 at 9:18 pm #2370588
Daniele
Hi, how can I hide the SEO title from a category?
Thank you,
DanieleOctober 11, 2022 at 10:54 pm #2370619Fernando 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
October 12, 2022 at 6:18 am #2370953Daniele
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.
October 12, 2022 at 7:22 am #2371035David
StaffCustomer SupportHi there,
are you wanting to remove it just from that Category ? Or ALL categories ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 12, 2022 at 7:41 am #2371053Daniele
Hi, only from that category π
October 12, 2022 at 7:56 am #2371224David
StaffCustomer SupportYou 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' ) );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 12, 2022 at 9:16 am #2371323Daniele
Sorry, I don’t understand where you should put it. Can you explain it better?
Thank you.
October 12, 2022 at 10:08 am #2371372Ying
StaffCustomer SupportHi 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/October 12, 2022 at 11:16 am #2371450Daniele
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
October 12, 2022 at 11:21 am #2371453Ying
StaffCustomer SupportOh 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' ); } });
October 12, 2022 at 11:33 am #2371467Daniele
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
October 12, 2022 at 11:49 am #2371476Daniele
Also keep in mind, that that title is inserted by YOST SEO, and I don’t want to delete it, but just HIDE it.
October 12, 2022 at 11:55 am #2371484Ying
StaffCustomer SupportDo 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; }
October 12, 2022 at 12:32 pm #2371514Daniele
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
October 12, 2022 at 12:40 pm #2371519Ying
StaffCustomer SupportI see, try this instead:
.category-faq-spiritualita-esoterismo-crescita-personale .page-header h1.page-title { display: none; }
-
AuthorPosts
- You must be logged in to reply to this topic.