How To Fix Title In Header.Php?

3 replies
  • WEB DESIGN
  • |
I currently have the following in my site header which doesnt seem to be the best format.

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

What should be the best format for SEO purposes that i should replace the above html code?

thanks
T
#fix #headerphp #title
  • Profile picture of the author peoplespaul
    Sorry can you go abit more in depth about the problem. This may or may not be above your technical knowledge, but what the <?php tages are doing is calling the content from the database regarding (I'm assuming a wordpress website looking at the code) Which will be the site name defined in your admin. then does a check on the if it is a single post or an archived post eg

    Sample website | "if topic or not dispay the archive name" | title

    Wordpress is quite on the ball about website titles, their are alot of geeks and internet marketers behind the platform pushing it to the next level.

    Personally, I think that format is fine. Although if it reads abit strange to a user because of your topic area I would change it. imo I would be content with that and concentrate your efforts in creating strong sales copy on the site in question. :-)
    {{ DiscussionBoard.errors[4745888].message }}
  • Profile picture of the author andy25i
    Originally Posted by warriorspirit786 View Post

    I currently have the following in my site header which doesnt seem to be the best format.

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

    What should be the best format for SEO purposes that i should replace the above html code?

    thanks
    T

    <?php if ( is_front_page()) { ?><title>Home | <?php bloginfo('name'); ?></title><?php }

    else { ?><title><?php wp_title(' | ',true,'right'); ?><?php bloginfo('name'); ?></title><?php } ?>


    you can also find help from the below link

    "php.net/manual/en/function.header.php"
    Signature

    ........

    {{ DiscussionBoard.errors[4760640].message }}
  • Profile picture of the author midnightdonkey
    Straight out of Twenty Eleven.

    <title><?php
    /*
    * Print the <title> tag based on what is being viewed.
    */
    global $page, $paged;

    wp_title( '|', true, 'right' );

    // Add the blog name.
    bloginfo( 'name' );

    // Add the blog description for the home/front page.
    $site_description = get_bloginfo( 'description', 'display' );
    if ( $site_description && ( is_home() || is_front_page() ) )
    echo " | $site_description";

    // Add a page number if necessary:
    if ( $paged >= 2 || $page >= 2 )
    echo ' | ' . sprintf( __( 'Page %s' ), max( $paged, $page ) );

    ?></title>
    {{ DiscussionBoard.errors[4764359].message }}

Trending Topics