Title of a page outside the loop (2 posts)

  1. tirussell
    Posted 4 years ago #

    I am trying to accomplish the following outside the loop (in my header, in fact):

    Sub-site name | Page Name

    Simple right? Note that I don't want the tag line anywhere.

    Here's what I tried first:

    echo get_bloginfo('name');
    if (!is_front_page()) {
       echo(" | ") . wp_title('', false, '');

    but that outputs:

    Sub-site Name | Page TitleSub-site NameTagline

    I've tried using str_replace to remove the superfluous 'Sub-site TitleTagline' part of that string, but it's tricky because wp_title is texturizing the whole thing and get_bloginfo() doesn't, so... is there an easier way to do this than fiddling with something like htmlentities()?

    I realize that I should probably use the separator argument of wp_title, but that's also problematice since I actually want that pipe to be
    <span class=\"titledivider\">|</span>
    and wp_title() converts all the code to htmlentities, which is not at all what I want.

  2. tirussell
    Posted 4 years ago #

    Aha! Twenty Ten applies a filter in its functions.php that makes it NOT behave as defined in the Codex. Getting there...

Topic Closed

This topic has been closed to new replies.

About this Topic