Support » Fixing WordPress » wp_title

  • Hi

    I am trying to set the decription meta tag for each page by adding in the wp_title as follows:

    <meta name="description" content="Continually updated to collate the latest <?php wp_title('',true,'right'); ?>news from across across the accountancy profession.">

    However, if the wp_title is “Contact” or “Link to Us” I would like it to be blank ie so that the the content reads “Continually updated to collate the latest news from across across the accountancy profession.”

    Also, how do I get rid of the extra space which is inserted after wp_title as part of the seg?

    Many thanks
    Mark

    [Please post code snippets between backticks or use the code button.]

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    (@esmi)

    Forum Moderator

    Try:

    <?php $insert = ' ';
    if( !is_page( 'Contact' ) && !is_page( 'Link to Us' ) ) $insert .= wp_title("",false);?>
    <meta name="description" content="Continually updated to collate the latest<?php echo $insert;?>news from across across the accountancy profession.">

    Thank you – that works for Contact and Link to Us.

    However, for a page where for example the wp_title is ‘Tax’ the following is produced:

    <meta name=”description” content=”Continually updated to collate the latest Taxnews from across across the accountancy profession.”>

    There are 3 spaces before wp_title and none afterwards?

    Thanks
    Mark

    esmi

    (@esmi)

    Forum Moderator

    Try:

    <?php $insert = ' ';
    if( !is_page( 'Contact' ) && !is_page( 'Link to Us' ) ) $insert .= wp_title("",false) . ' ';?>
    <meta name="description" content="Continually updated to collate the latest<?php echo $insert;?>news from across across the accountancy profession.">

    Thank you – that adds a space after the wp_title but there are still 3 spaces appearing before the title.

    Thanks
    Mark

    I have reduced it to 2 spaces by changing

    <?php $insert = ' ';

    to

    <?php $insert = '';

    but this still leaves 2 spaces instead of one before the wp_title.

    Thanks
    Mark

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_title’ is closed to new replies.