Forums

Use the_title() in header to display text for each page (1 post)

  1. silentdice
    Member
    Posted 8 months ago #

    Hi there, I'm new to using PHP so this might be a very simple problem?

    Basicaly, I've got a banner along the top of my page that should display different text depending on what page the user is on.

    So I've got this, which works fine, but obviously will only display the text "garage services" on every page.

    $seotext["home"] = "garage services";
    $seotext["services"] = "servicing and repairs";
    $seotext["motorsport"] = "rallying and drifting";
    $seotext["contact"] = "contact me";
    
    echo $seotext["home"];

    My intention was to insert the_title() into it, to put the title of the page in (home, services, motorsport or contact) so it will display different text for each page.

    echo $seotext[the_title()];

    The problem is - this is only displaying the page name... rather than the specified text.

    Can anyone help me?

Reply

You must log in to post.

About this Topic