Viewing 11 replies - 1 through 11 (of 11 total)
  • Check within the <title /> tags. It’ll most likely have something like <?php bloginfo(‘name’) – bloginfo(‘description’); ?>. Remove what you feel is necessary.

    Paul

    Thread Starter thedopesteez

    (@thedopesteez)

    thanks for the response!
    my programming skills are weak at best, i’m in the header.php editor and i’ve removed everything but the following:

    <title><?php bloginfo(‘name’); ?></title>

    so there’s nothing else but that… there used to be an if, then clause with a hyphen inserted so i just deleted that whole bit.
    unfortunately the hyphen is still there! i’m wondering if i’m editing the right thing?

    Change line 8 in header.php to this:

    <title><?php bloginfo('name'); if(is_home() || is_front_page()) { echo ' '; bloginfo('description'); } else { wp_title(' '); } ?></title>
    Thread Starter thedopesteez

    (@thedopesteez)

    i had tried to simply remove the hyphen from the quotation like in that line of code, but it’s still there!
    haha thanks for the reply though

    That’s because there’s two places you need to edit. The code I posted is working on my copy of the theme.

    The changes from the original are here: { echo ' '; and here: wp_title(' ')

    Compare the code above to the original code that was on line 8. Note the (addition of) and space between, the single quotation marks in wp_title().

    Thread Starter thedopesteez

    (@thedopesteez)

    ah well i still copied the code you had pasted into the title line and it still doesn’t work! i’m wondering if i’m pasting it into the wrong place… check it out:

    http://i494.photobucket.com/albums/rr306/ryannorthcott84/code-1.png

    It looks okay to me. I can’t explain it. I made the same edits on two different sites using the same theme, with positive results on both.

    Removing the hyphen from here: { echo ' - '; should probably be enough to remove the hyphen on the front/home page.

    I think changing wp_title() to wp_title(' ') should cause this: >> to be replaced by just a space, effectively removing any separators between title and page name on all other pages (if that’s a concern as well).

    Some reference material: Function Reference/wp title

    I might just be missing something I can’t see, but the example I used seems to work okay with that theme. Maybe someone with a sharper eye will spot whatever it is I’m missing.

    Just a thought… I noticed that you are using an SEO plugin. Could anything in those settings be preventing your changes?

    Thread Starter thedopesteez

    (@thedopesteez)

    hmm… possibly… i don’t know what setting it would be or where to look though?

    My best guess would be that if you go to Dashboard > Settings > SEO > Titles & Metas > Title Settings: the box next to “Force rewrite titles” is probably checked. My gut tells me that un-checking that box and saving the changes might allow your edit in header.php (removing the hyphen) to take affect. If someone else is managing your SEO for you, you might want to get them involved, but I think that’s probably what’s causing your edits to not show.

    Thread Starter thedopesteez

    (@thedopesteez)

    you are right, unchecking that box fixes the problem… although it gives me a bigger one, my individual post titles are now messed up. How do i edit these now?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘can't get rid of hyphen after site title’ is closed to new replies.