Best Wordpress Title Code Right Here

Discussion in 'WordPress' started by mdvaldosta, May 11, 2006.

  1. #1
    Being the SEO freak that I am (and a reason why I hesitate using content management systems, because I lack complete control) I searched high and low for the best way to code my wordpress titles. The best thing I found was instructions to swap the tags in the title so they blog name 2nd and the page name was first. Then, your stuck with that >> thing... unless you use the optimal title plugin. Well, that sucks to (my apologies to the creator), because the page titles are still not optimized.

    So I dug around the wordpress codex looking at the docs and I ran accross their wordpres conditional tags and put this together, which gives me exactly what I want.

    <title><?php if(is_home()) : ?>11111111111111111111111<?php elseif(is_category()) : ?>2222222222222222222<?php wp_title(''); ?><?php elseif(is_single()) : ?><?php wp_title(''); ?><?php else : ?><?php wp_title(''); ?> - <?php bloginfo('name'); ?><?php endif; ?></title>
    Code (markup):
    Ok, what this will do is replace your homepage with whatever title you want, just replace the 1111111111's for that. Then, for the categories, replace the 2222222's with what you want to appear before the categories. Then, finally, whatever page isn't explicitly expressed how to title it, it will put "that page's name first - your site's title".

    Look at the conditional tags page on wordpress for other conditionals, like for pages, archives, etc. For me this is as far as I had to go. You can see it in action at this Ford Mustang (still working on the wordpress design and seo) Wordpress powered site.

    I'm really suprised nobody else hasn't done this yet (that I've found), since it was pretty easy to come up with.
     
    mdvaldosta, May 11, 2006 IP
    MrSupplier likes this.
  2. MrSupplier

    MrSupplier Peon

    Messages:
    141
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I bet there was some plugin for improving titles, that ">> thing" 's boring indeed
     
    MrSupplier, May 11, 2006 IP
  3. browntwn

    browntwn Illustrious Member

    Messages:
    8,347
    Likes Received:
    848
    Best Answers:
    7
    Trophy Points:
    435
    #3
    Sweet code, and easy to impliment too.

    Thanks!
     
    browntwn, May 11, 2006 IP
  4. jg123

    jg123 Notable Member

    Messages:
    6,006
    Likes Received:
    387
    Best Answers:
    0
    Trophy Points:
    295
    #4
    I noticed you don't use meta keywords or description, how come?
     
    jg123, May 11, 2006 IP
  5. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Haven't gotten that far yet... just now started modding the default install.
     
    mdvaldosta, May 11, 2006 IP
  6. jg123

    jg123 Notable Member

    Messages:
    6,006
    Likes Received:
    387
    Best Answers:
    0
    Trophy Points:
    295
    #6
    ah, so the meta keywords and descritptions won't change for each post, just the title?
     
    jg123, May 11, 2006 IP
  7. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #7
    This is only for the title. You could use conditionals, tailored to your liking, for the description as well (or anything for that matter)...although you should probably look into finding a plugin for it first.
     
    mdvaldosta, May 11, 2006 IP
  8. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I added Meta tags to my WP blog yesterday and the only thing that I accomplished was loosing all my Adsense ads. I don’t know if it was coincidence but now I only have ads on a few of my pages, all the rest have my banners. If you take a look at this page you will see that adding Meta tags isn’t all its cracked up to be.
     
    Emperor, May 12, 2006 IP