I want to repeat the title of my Wordpress page in a copyright statement in the footer, like
© 2020 "Review: Winter's Sunshine": The Berlin Review Magazine
The snippet I simply used in the past was:
© <?php echo date("Y"); ?> "<?php echo get_the_title(); ?>": [Website Name]
It worked exactly as I needed it.
Unfortunately - due to an exotic page builder - the website I'm currently working on doesn't always use the_title for the h1 headline. Sometimes the_title is ignored and there's a h1-headline somewhere in the html text below.
So, I think I need a function which checks if the_title is empty - if not empty, echoes the_title, and that's it.
But if the_title is empty or non-existing,
2. a. it should hide the complete empty <h1></h1>
tag of the title (if it exists),
b. look for another, non-empty h1-tag in the html text of the page,
c. then echo that tag-content.
I came thus far:
$newtitle = h1 -> outercontent;
if (the_title()){ echo get_the_title(); }
else { echo $newtitle; }
Not very impressive, I'm afraid. Every help would be appreciated.