Support » Fixing WordPress » different text at top of page on different page

  • down vote favorite

    I have at the very top of my page a line of text within a h1 tag thet i use for seo reasons. the text and html around it is written in my header.php. but i would like to write differnet txt so it appears different on each page for seo reasons. for example:

    • homepage- line of text reads builders in lancaster, builders in morecambe etc
    • plastereing page- line of text reads plasterers in lancaster, plasterers in morecambe etc
    • roofing page – line of text reads roofing in lancaster, roofing in morecambe etc

    i know theirs a widget logic but thats for widgets and not the main header.php. is their a line o of code i can write in the header.php to do what the widget logic would do.

Viewing 1 replies (of 1 total)
  • Code similar to this should do what you want:

    <?php if ( is_page('Entries') ) {
       $text = 'This is the Entries page';
    } elseif ( is_page( 'Blog') ) {
       $text = 'This is the Blog page';
    } else {
       $text = '';
    if ($text) {
       echo "<div class='page_message'>$text</div>";
Viewing 1 replies (of 1 total)
  • The topic ‘different text at top of page on different page’ is closed to new replies.