Forums

How do I set title to "Post Title >> Blog Name" (5 posts)

  1. osu9400
    Member
    Posted 5 years ago #

    In 2.5, how do I set the page title to display the name of the post first then the blog name? Currently, it is the other way around with blog name first, then post title.

    Thanks.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    I use the Optimal Title plugin:
    http://elasticdog.com/2004/09/optimal-title/

    With this code in my theme:

    <title><?php
    if ( function_exists('optimal_title') ) {
    optimal_title('|'); bloginfo('name');
    } else {
    bloginfo('name'); wp_title('|');
    }
    if ( is_home() ) {
    echo ' | ';
    bloginfo('description');
    } ?></title>
  3. hakre
    Member
    Posted 5 years ago #

    The codex offers some background infos as well: http://codex.wordpress.org/Template_Tags/wp_title scroll down for Separator with Blog Name and Title Reversed.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Ah hah! I had not seen that new $seplocation parameter in 2.5.

    My new code (no plugin needed):

    <title><?php
    wp_title('|', true, 'right');
    bloginfo('name');
    if ( is_home() ) {
    echo ' | ';
    bloginfo('description');
    } ?></title>
  5. hakre
    Member
    Posted 5 years ago #

    It is ever a good Idea to keep the amount of plugins as low as possible.

Topic Closed

This topic has been closed to new replies.

About this Topic