Missing Titles
-
Generatepress is no longer showing post/page titles.
I haven’t touched the code recently.
Is there a setting I need to check/uncheck?
I have searched and searched to no avail, so I’m turning to you here for help, please.
Thank you.
The page I need help with: [log in to see the link]
-
Hi there,
Can you make sure Content Title is not disabled here? https://docs.generatepress.com/article/disable-elements-overview/
If not can you try disabling all plugins to test?
Thank you, Leo.
I’m a “cheapskate” — I don’t have GP Premium nor do I have the Disable Elements add-on. (And individual posts do not have Content Title checked.)
I renamed the plugins folder. Made no difference.
I guess I can just put content-single and content-page in my child theme with the appropriate line(s) removed or at least commented out.
Unless there’s a way to correct this with less mess.
Thanks again,
MarkDo you already have those custom files (content-page.php and content-single.php) in your child theme?
If so, what about them did you customize?
Nope. I do not have those custom files in my child theme.
And I assume the actual page has a title in the page editor?
Good assumption. π
This isn’t a problem on just one page. As far as I know, it’s on all pages and posts.
For example, http://www.clpcle.com/products/the-work-of-his-hands/ should show The Word of His Hands as the post title. I look at the code and here’s the pertinent portion:
<header class=”entry-header”>
</header><!– .entry-header –>Titles are obviously stripped by default. And apparently just as obviously, there’s no setting to change. So the next obvious thing is the solution: I’ll just use custom content-single and content-page files in my child theme. π
Thank you again for engaging me here on this issue. I really appreciate that.
Unless there’s a fix I can put in the functions.php file…
That’s the thing, the code already exists: https://github.com/tomusborne/generatepress/blob/2.0/content-page.php#L28
So something is altering
the_title()function output on your site. Perhaps it’s a plugin you’re using?Thank you, Leo.
Yeah, I know about the code you mention above.
This line of code is the “culprit”:
if ( generate_show_title() ) : ?>That’s what I intend to comment out in my custom pages. Then it will work. I know that already. I just didn’t want to have to go that route if there was a setting I couldn’t find. There isn’t, so that’s that. π
No, I’m sure it’s not a plugin issue. As I noted yesterday, I disabled all my plugins and it did not resolve the problem.
There’s no need to comment that line out – it’s false by default, and it’s filterable.
You can force it to be false like this:
add_action( 'after_setup_theme', 'tu_force_show_title' ); function tu_force_show_title() { add_filter( 'generate_show_title', '__return_true', 100 ); }However, if that line was the issue, the empty
<header>element wouldn’t be showing up.Thank you, Tom. And my apologies for falling off the grid for a couple of days.
After reading your last line above, I felt very dumb. :/ I don’t know how I missed that! I appreciate your patience and kindness in pointing that out…without being demeaning for my missing that obvious fact. I salute you for that.
Anyway, back to the problem. I hadn’t done anything with my functions.php since January 19. I opened it and found the culprit…
add_action( 'after_setup_theme','tu_after_setup_theme' ); function tu_after_setup_theme() { add_filter( 'generate_show_title', '__return_false' );I have no recollection putting that there, but I don’t doubt I did. I commented it out and the problem was resolved.
So the problem, instead of being a recent development, had been long-standing. And I had no idea. π
I’m very sorry to have wasted your time on this. π Thank you again for sticking through it with me. I hope that by the middle of the year I can afford to buy GP Premium — I owe you that much, at least. π
Grateful but humbled,
MarkNo problem at all! I’m glad you were able to find the issue and fix it π
The topic ‘Missing Titles’ is closed to new replies.
