Forum Moderators: coopster

Message Too Old, No Replies

Trying to change the title on a home page

using a blog

         

DavidBain

3:53 pm on Feb 8, 2007 (gmt 0)

10+ Year Member



Hi

I'm trying to change the title on just my home page.
Can anyone help me where I should insert it and how I should insert it in this code...

<title><?php if ( get_bloginfo('version') < '2' ) : echo wp_title('',false); if (!is_home() ) : echo ' - '; endif;
elseif ( is_search() ) : echo wp_specialchars($s).' - ';
elseif ( is_category() ) : single_cat_title(''); echo ' - ';
elseif ( is_year() ) : echo get_the_time('F').' - ';
elseif ( is_month() ) : echo get_the_time('F Y').' - ';
elseif ( is_day() ) : echo get_the_time('F jS, Y').' - ';
elseif ( is_404() ) : echo "Not found - ";
elseif (!is_home() ) : if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; }; echo " - ";
endif // is_search()?>
<?php bloginfo('name')?></title>

Thanks!

bomburmusicmallet

5:04 pm on Feb 8, 2007 (gmt 0)

10+ Year Member



Hi David,

Is this WordPress? I was able to change mine through their admin interface, not the actual code. Is that not available to you?

DavidBain

5:14 pm on Feb 8, 2007 (gmt 0)

10+ Year Member



Hi

Yes, it's wordpress.
But the problem is I want to have the title
"Homepage Keyword phrase - DomainName.com" on the home page
and
"Post title - Domain name" on the post pages.

If I do it through the back office then I can only make the page title on the home page
"Post title - Blog title"
So in other words I want a phrase just to appear on the home page title.

bomburmusicmallet

7:47 pm on Feb 8, 2007 (gmt 0)

10+ Year Member



Hi David,

Try adding this line:

elseif (is_home() ) { echo "Homepage Keyword phrase"; echo " - "; }

Put it above the line:

elseif (!is_home() ) : if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; }; echo " - ";

Does that work?

cmarshall

8:37 pm on Feb 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



WordPress allows access to all that stuff in their Template API [codex.wordpress.org].

You may be looking for this [codex.wordpress.org].

You can overload most of the tags and put whatever you want in there.

I'm going to upgrade my blog to WP 2.1 sooner or later, but I just had a scare when I upgraded my gallery to Gallery 2, so I won't make it a sooper priority.

DavidBain

3:00 pm on Feb 9, 2007 (gmt 0)

10+ Year Member



Hi bomburmusicmallet

Thanks for your help!

elseif (is_home() ) { echo "Homepage Keyword phrase"; echo " - "; }

didn't quite work, but all I had to do was amend it to
elseif (is_home() ) : echo "Homepage Keyword phrase"; echo " - ";

and then it worked perfectly
Thanks again!

[edited by: DavidBain at 3:01 pm (utc) on Feb. 9, 2007]