I have an issue with my website. this is not functioning with my given PHP script to take the Site Title as “H1” tag on the Home page(-home page.php). it seems empty in the source code view.
What is the right script to pull “Site Title” as “H1” tag in action?
So what this tells me is that the_title() returns the title, it doesnt echo it out for you. In which case <?php the_title() ?>
is an empty statement.
<?php "John Smith" ?> doesnt tell PHP to DO anything, it just says “here is a string.”
There are two ways to fix it.
Explicit Echo: <?php echo the_title(); ?>
Implicit Echo: <?= the_title() ?>
How it works: <?= is a special PHP shorthand, called a short_tag, which is equivalent to “echo this”
So either: You’ve removed the loop by removing the while, so the_title now returns nothing because you’re outside the Loop; the post has no title, or… uh… i’m struggling for a third option.
I want to see H1 tag the same as my Site’s title. It’s only for the home page. Other pages are functioning perfectly.
Only the Home page script is not working. I have given the site Name and Title in theme customization. But can’t see H1 tag on the “Source code” of the Home page, while other pages are showing H1 tag.