Archived topic
Disable 'Content Title' in all posts from a category
3 replies · Started by Rui on August 5, 2018
Viewing posts 1–4 of 4
Hi!
I'm trying to disable the 'Content Title' element in all posts from a specific category using the code below:
add_action( 'after_setup_theme', 'tu_remove_title' );
function tu_remove_title() {
if ( in_category('news') ) {
add_filter( 'generate_show_title', '__return_false' );
}
}
I put this code in a plugin following the instructions in: https://docs.generatepress.com/article/adding-php/#create-a-plugin
Also, I'm pretty sure 'news' is the correct slug (and also tried with the category ID) but it´s not working.
Please, help!
Hi there,
Can you try this:
add_action( 'wp', 'tu_remove_title' );
function tu_remove_title() {
if ( in_category('news') ) {
add_filter( 'generate_show_title', '__return_false' );
}
}
Now it's perfect. Thanks a lot!!!
No problem :)
This archived topic is closed to new replies.