WordPress.org

Ready to get started?Download WordPress

Forums

wp_title displaying more than the title... (11 posts)

  1. AndrewBanchich
    Member
    Posted 4 years ago #

    I use the Evidens theme on my blog (http://ragnarockmusic.com/). In the header php file it has "<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>" for the titles of pages. As you can see, if you go to a single post it shows the blog name, a "»" tag, and the title of the post. However, I don't want to » tag. How do I remove it?

  2. Matty Cohen
    Member
    Posted 4 years ago #

    Hi AndrewBanchich.

    A straightforward solution would be to replace the contents between the <title> tags with the following:

    <?php if ( is_single() ) { echo get_bloginfo('name') . ' | ' . wp_title(); } else { echo get_bloginfo('name') . ' | ' . get_bloginfo('description'); } ?>

    The above code will print the title as "BLOG NAME | POST TITLE" for single post pages and "BLOG NAME | BLOG DESCRIPTION" for all other pages. This IF statement can be expanded upon using other WordPress conditional tags.

    I hope this helps. :)

  3. AndrewBanchich
    Member
    Posted 4 years ago #

    Wouldn't that still show the »? It seems as though the theme creator put the » sign into the wp_title tag somehow, so it shows up wherever you have the wp_title tag.

  4. Matty Cohen
    Member
    Posted 4 years ago #

    If you look through the functions.php file, is there anything that calls wp_title()? Possibly an add_action() with it in?

    If you search through your theme's functions.php file (an any files linked to it via a require() or include() statement) and comment out any lines with wp_title() in them, that should, as I understand it, resolve this.

    This is the first time I've seen this issue, so I'd imagine it's a customisation within the theme you're using.

    :)

  5. AndrewBanchich
    Member
    Posted 4 years ago #

    I looked there at first and there was nothing about wp_title

  6. nast0
    Member
    Posted 4 years ago #

    Is there any reference to &raquo; at all? Perhaps in single.php as that's where the page is treated differently?

  7. AndrewBanchich
    Member
    Posted 4 years ago #

    None whatsoever. I did a Command+F on it and nothing showed. Is there some deeper file that wp_title pulls the info from? It could be there...

  8. killermanic
    Member
    Posted 4 years ago #

    Hi, try wp_title('',true)

  9. neilwill
    Member
    Posted 4 years ago #

    I managed to get this to work using a combination of mattyza and killermaniac's code.

    For the article title immediately following the blog title:
    <?php if ( is_single() ) { bloginfo('name') ?> <?php wp_title("",true); } else { echo bloginfo('name') ?> <?php bloginfo('description'); } ?>

    To use other separators in place of ยป such as | just place them between the ?> <?php

  10. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    Or use something like wp_title('|',true,'right')

    http://codex.wordpress.org/Template_Tags/wp_title

  11. thinkadrian
    Member
    Posted 4 years ago #

    I'd like these options, how do I get item #2?

    1) on a category page
    Category title | Site Name

    2) on a single page
    Page Name | Category title | Site name

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags