• Resolved rubenortiz

    (@rubenortiz)


    Hi

    I have a doubt about how WP make the titles ( <title> ) in each post.

    Domain: http://www.cooldomain.com
    Post: This is a example

    With this features my WP will make a title like this:

    Cooldomain >> This is a example

    There is some way to obtain a different title? Like this:

    This is a example

    Thanks! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • Very easily. Open your header.php template and look for your

    <title> tag. Replace it with this. <title><?php if ( is_home() ) { ?><?php bloginfo('name'); ?><?php } ?> <?php if ( is_single() ) { ?> <?php } ?> <?php wp_title(); ?></title>

    This will show Cooldomain on the home page.

    And will show This is a example on the article page.

    Thread Starter rubenortiz

    (@rubenortiz)

    Yes, your code works!

    Thanks!

    Thread Starter rubenortiz

    (@rubenortiz)

    Uh oh i think i was mistaken.

    It’s only a little problem. Now in the post page the title is :

    >> Im a example of a title

    The title is show with a >> sign.

    Its posible to remove them? This will be better for Google, Yahoo and anothers.

    Thanks again 🙂

    Sorry about that. Revised code:
    <title><?php if ( is_home() ) { ?><?php bloginfo('name'); ?><?php } ?> <?php if ( is_single() ) { ?> <?php } ?> <?php wp_title(''); ?></title>

    You can read this for a little more help.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I use the Optimal Title plugin on mine. Thus my line looks like this:
    <title><?php optimal_title(); ?><?php bloginfo('name'); ?></title>

    On my homepage, this gives me Blogname.
    On my single pages, this gives me Postname >> Blogname.

    Works quite well and puts the post name in front of other things, while keeping the blogname there. Very nice, IMO.

    You could achieve the same basic result as that without the Optimal Title plugin by doing this:

    <title><?php
    $sep = ' &raquo; ';
    $titlestr = wp_title('',false);
    if (!empty($titlestr)) echo $titlestr.$sep;
    bloginfo('name');
    ?></title>

    Thread Starter rubenortiz

    (@rubenortiz)

    Ok, my title is correct now.

    Thanks a lot. Your information is more hepful 🙂

    Bye!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How can i modify title in WP ?’ is closed to new replies.