• I refer to the site http://www.futureproofrecords.com who’s site title is ‘Futureproof’.

    I’ve been trying to sort out the page title that appears in the header as I have a specific category that I don’t want to show a title (so it’s less likely to show in google searches)

    I have a very basic knowledge of php but have used the following code:

    <title>
    <?php if ( in_category('reaction-form') ) { echo '';
    }
    else
    { echo bloginfo('name') . '- Radio, TV, Printed Press, Online Press & Club Music Promotions / PR + Digital Music Distribution' . wp_title ();
    } ?>
    </title>

    This shows no title when a single post in the category ‘reaction-form’ is called up but otherwise all page and post header titles SHOULD read as follows:

    Futureproof – Radio, TV, Printed Press, Online Press & Club Music Promotions / PR + Digital Music Distribution » Page or post title

    BUT it actually shows up with the page/post title placed just after the site name (Futurepoof) with separator inbetween, and the text string placed after that – like this (for the news page)

    Futureproof » News- Radio, TV, Printed Press, Online Press & Club Music Promotions / PR + Digital Music Distribution

    As I’ve said before my php coding knkowledge is limited but I’m learning so would appreciate if someone could say what I’m doing wrong.

    HOWEVER. . . . through investigating this issue in the wordpress.org documentation, I have come across various articles mentioning the new need to use the wp_title filter, saying it’s a theme requirement now and stating that:

    “Using the wp_title filter with a custom callback function is the preferred way of changing the title tag and now required for all themes. The common bad practice of putting
    <title><?php bloginfo('name'); ?> « <?php wp_title(); ?></title>
    directly into the header.php file leaves no way for a plugin to modify the whole title.”

    2 pages that describe/mention this issue are:
    http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_title#Best_Practices
    http://shinraholdings.com/59/using-the-wp_title-filter/

    This makes me think that the way I’m trying to do this is not the best practice and that in fact I should be approaching this issue in a totally different way.

    It would be most appreciated if someone could guide me through the correct setting up of this title generation issue that utilises the wp_title Filter as seems to now be necessary?

    Many thanks

    DoubleG
    http://www.futureproofrecords.com

  • The topic ‘Problem displaying title using the wp_title filter’ is closed to new replies.