problems with <title></title> Help please (6 posts)

  1. elyonline
    Posted 10 years ago #

    Hi there,

    Can anyone tell me what is wrong with my title statement? I had some great help on IRC but alas it still don't wotk.

    Here is the code: http://pastebin.com/549508

    Many thanks if you can see our typo.


  2. elyonline
    Posted 10 years ago #

    Can anyone help please?

    Many thanks

  3. Kafkaesqui

    Posted 10 years ago #

    Yikes! :)

    I can help fix the errors you're obviously hitting, but I can't guarantee the code logic will work as you expect (since I don't know what your expectation is).


    Note on your code: You should always end a PHP statement with a semi-colon:

    if ( is_home() ) {


  4. elyonline
    Posted 10 years ago #

    Yikes indeed :)

    Kafkaesqui, that worked a treat.

    The trouble for me is that I am not good at explaining in writing what I require :)

    I have another problem with that title code. I have a few static pages that pull in wp sidebar items by using this:


    /* Use WP Templating System */

    <?php get_header(); ?>

    pages like: http://www.elyonline.co.uk/contact/ but as you can see it uses the page title of 'Ely Online Archives'

    Could similar code to what I already have be used to say 'Ely Online Contact Information' and 'Ely Online City Guide'. I ask as I am getting somewhat confused :)

    Any further assistance greatly appreciated.


  5. Kafkaesqui

    Posted 10 years ago #

    Is your contact page a WordPress Page, or a separate PHP document residing in an actual directory?

    For the former, look at the information on the is_page() conditional:


    For the latter, you can perform a bit of pattern matching to test on 'contact' in your url. Something like this should do:

    <?php if(preg_match("%contact%", $_SERVER['PHP_SELF'])) { ?> Ely Online Contact Information <?php } ?>

  6. elyonline
    Posted 10 years ago #

    Kaf, I put that in a title tag and it worked just fine but because I use a global header - <?php get_header(); ?> I get 2 <title></title> thats why I was using the long if else but was unable to get it to work for pages in their own directory, i.e. /contact/ or CityGuide/

    Any other suggestions?

    I appreciate the assistance.


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.