WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. elyonline
    Member
    Posted 8 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.

    Thanks

  2. elyonline
    Member
    Posted 8 years ago #

    Can anyone help please?

    Many thanks
    Karl

  3. Kafkaesqui

    Posted 8 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).

    http://pastebin.com/549711

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

    if ( is_home() ) {
    bloginfo('name');

    etc...

  4. elyonline
    Member
    Posted 8 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:

    <?php

    /* Use WP Templating System */
    require('../news/wp-blog-header.php');
    ?>

    <?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.

    Karl

  5. Kafkaesqui

    Posted 8 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:

    http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

    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
    Member
    Posted 8 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.

    Karl

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.