Thread Starter
Rys
(@ryn_90)
Ok now I’ve found this: <?php wp_title(); ?>
and it works. How do i remove the “»”
Thread Starter
Rys
(@ryn_90)
Oh thanks missed that, this works for those who would like to know how: <?php wp_title(''); ?>
Thread Starter
Rys
(@ryn_90)
Hi again Chris,
This gives the same result as <?php wp_title(); ?>
because I tried it, I’m not sure which is best
wp_title()
is intended to be output in the <title>
tag in the document head, and is quite often filtered to output considerably more than just the Page/Post Title.
the_title()
is intended to be output in the document body, and will always only be the Page/Post Title.
Thread Starter
Rys
(@ryn_90)
So when I need an <h1> I will use wp_title();
So when I need an <h1>
I will use wp_title();
Generally speaking, wp_title()
should only be used to output the <title>
tag in the document head.
Thread Starter
Rys
(@ryn_90)
so I use the_title() for the h1?
so I use the_title() for the h1?
Exactly!
And you can use it anywhere in the document body (i.e. within the <body>
tags) that you want to output the Page/Post Title, not necessarily only within the <h1>
tags.
Thread Starter
Rys
(@ryn_90)
Yeah I understand, but in this case I need to auto generate all the <h1> in the website.
Gotcha; then the_title()
is the template tag to use!
I want the page name on a title bar I have above the content yet it only gives me the name of the first post?
Thread Starter
Rys
(@ryn_90)
This works to get the page name, I use it in the Meta Title too: <?php wp_title(); ?>