PDA

View Full Version : Wordpress: How to change post page titles?


Ms Naughty
2006-03-07, 07:11 PM
Hi all
Haven't had much luck in finding info on this so I'm hoping someone here has a quick answer.

I can't find the setting on Wordpress to change what it puts in the <title> tags for each post page. This means that all my individual post pages have a title that says:
Ms Naughty Porn for Women Blog : Blog Archive : <Post name>

I want the post name to appear first.

Any suggestions on how to do this?

Thanks

Karen

RawAlex
2006-03-07, 07:24 PM
It is in the header.php of your template you will find this code:

<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>

The first part bloginfo('name') shows the title of your site as defined. The second part (is_single) checks to see if this is a single post, if it is, it puts up the words Blog Archive followed by the title of the post.

That is where it comes from... you can re-arrange or remove the parts as needed, but remember, the same code is run on the main pages and other pages as well, so you have to be a little inventive, and check out what you doing and how it affects other pages.

Alex

Ms Naughty
2006-03-07, 08:31 PM
Eek!
Thanks for helping Alex! Unfortunately my php skills are exceedingly close to zero, so I'm very hesitant to do any editing.

Have you got a suggestion for rearranging that code so it goes:
Post Title : Blog Title

Would it work if I did this?
<title><?php wp_title(); ?><?php bloginfo('name'); ?></title>

RawAlex
2006-03-08, 12:18 AM
You might want to try:

<title><?php wp_title(); ?><?php if ( is_single() ) { ?> : <?php } ?><?php bloginfo('name'); ?></title>

That should work, and won't give you a blank : at the start of regular pages. As always, keep a backup of the previous version before you start.

Alex

Ms Naughty
2006-03-08, 01:14 AM
Thanks Alex, I'll give it a go :D

Ms Naughty
2006-03-08, 04:33 AM
YAY! I got it to work!!!
And it only took six goes!
Thanks for your help Alex

RawAlex
2006-03-08, 09:30 AM
:)