Archived topic
How to add post title
5 replies · Started by Amit Nair on June 26, 2018
Hello,
I want to add post titles in all posts. I dont want any title on pages though.
Currently only the home page with thumbnails shows the post title. Please help.
How can I do it?
Hi there,
Post title should be added by default unless you are using this snippet:
https://docs.generatepress.com/article/generate_show_title/
Can you double check?
Hi Leo,
I am not sure if I added that code. I dont even remember how to check it.
But I remember, I was seeing the titles even for pages which I never wanted.
Now I don't see titles for anything. I actually want titles only for posts and not pages.
Regards,
If you did then I think it would've been one of these methods:
https://docs.generatepress.com/article/adding-php/
Hi Leo,
That's right. I have used the snippets plugin and inserted the below code.
add_action( 'after_setup_theme', 'tu_remove_all_titles' );
function tu_remove_all_titles() {
add_filter( 'generate_show_title', '__return_false' );
}
I had done this to remove titles from pages. But I need the titles for posts. How can we achieve this?
Hi there, the simplest method would be to remove the code and use the Disable Elements meta to remove the title on your pages:
https://docs.generatepress.com/article/disable-elements-overview/