Archived topic
Post Title Not Appearing When Using Page Hero
3 replies · Started by Jennifer on July 12, 2020
Hello,
I have added my own custom breadcrumbs.
/**breadcrumb short code USED THIS FOR BREADCRUMBS, IT RETURENED THE TITLE OF THE PAGE*/
function post_title_shortcode(){
return get_the_title();
}
add_shortcode('post_title','post_title_shortcode');
It works great on all posts except for the posts where I have enabled a page hero. You moved the title from the content page to the page hero section.
https://livinghisword.org/truth-being-unveiled-by-a-virologist-on-covid-19-who-was-there/
<div class="MyBreadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/"><div><a href="https://livinghisword.org/" aria-label="breadcrumb home page">Home</a> / <a href="https://livinghisword.org/daily-biblical-news/" aria-label="breadcrumb daily biblical news home page"> Daily Biblical News</a> / <span aria-current="page">[post_title]</span> </div></div>
For some reason this code is not picking up the post title.
Any ideas on how to fix this?
Here is a page where I am using the same custom breadcrumb and it works great.
https://livinghisword.org/what-life-are-you-exemplifying-light-or-darkness-1-john-15/
<div class="MyBreadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/"><div><a href="https://livinghisword.org/" aria-label="breadcrumb home page">Home</a> / <a href="https://livinghisword.org/bible-teachings/" aria-label="breadcrumb bible teaching home page">Bible Teachings</a> / <span aria-current="page">[post_title]</span> </div></div>
Thank you Jennifer
Okay I turned off the page header and still having the same problem.
Going to trouble shoot this.
I am sorry it has been a long week.
I did not check the activate short code box.
This is resolved.
Again, sorry :)
Hi there,
Glad you've figured out.
You can actually use the template tag if you are using the page hero:
https://docs.generatepress.com/article/header-element-template-tags/#post_title