WordPress.org

Ready to get started?Download WordPress

Forums

En dash not displaying in title tag using conditional tags (7 posts)

  1. Calicosun
    Member
    Posted 4 years ago #

    Hi there

    The en dash is displaying as – in my title when I switch the title with conditional tags to get more information. I have tried replacing the - with – but I still get the same problem. I can't post a link as working locally sorry but here is the example code:

    <title><?php
    if(is_home()) {
    echo bloginfo('name').' ’ Home';
    } elseif(is_category()) {
    echo 'Browsing the Category ';
    wp_title(' ', true, '');
    } elseif(is_archive()){
    echo 'Browsing Archives of';
    wp_title(' ', true, '');
    } elseif(is_search()) {
    echo 'Search Results for "'.$s.'"';
    } elseif(is_404()) {
    echo '404 - Page got lost!';
    } else {
    bloginfo(ënameí); wp_title('-', true, '');
    }
    ?></title>

    and here is what the title looks like:

    <title>rockstar – testing, one two three.</title>

    Can anyone shed some light on why this is happening? I use MAMP.

    Thanks so much in advance - a reply would be much appreciated, have posted around 6 questions in the past 7 or so months and not one post has been answered! I managed to solve or do work arounds for all questions but only after HOURS of research.

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

    Try using wp_title('ndash;', true, '')

  3. Calicosun
    Member
    Posted 4 years ago #

    Thanks so much for answering my question. I have tried that and it didn't work. What is strange is the the en dash displays fine on the home page.

    I haven noticed the code I posted has some of the actual en dashes missing by mistake. I must have copied the code I was playing around with. The actual code does have the end dashes in the code for the title, archives and home. Is there a way to edit a post so I can fix this? Can see any edit buttons for older posts.

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

    Try using & #150; or & #8211 (removing the spaces between & and # - which I had to add to circumvent the forum's auto formatting)

  5. Calicosun
    Member
    Posted 4 years ago #

    Thanks once again for taking the time to answer but unfortunately those options don't work either. I wonder if it is a bug? Is anyone else having this problem?

  6. Calicosun
    Member
    Posted 4 years ago #

    Ok I have done some more testing and this is happening on all my websites. Unfortunately I don't have any live yet so can't provide links.

    It is only happening on post pages, not pages and I always set permalinks set to custom, /%category%/%postname%/ due to SEO.

    There is a change I am doing something wrong but can't see what. Please can someone help me out with this?

    Thanks.

  7. Calicosun
    Member
    Posted 4 years ago #

    Hi. Can someone please help me out with this please? I am not sure how to get help on these forums from a moderator but I would really like some help or even just confirmation that this is a bug or not so I don't waste even more hours (yes, hours!) trying to figure out what I am doing wrong.

    I have just had a look at another website (live, not mine) and it appears to have the same problem: http://educhalk.org/blog/how-to-copy-your-online-wordpress-blog-to-xampp-on-your-local-computer-or-usb-drive/ so to me it looks like a bug.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic