WordPress.org

Support

Support » How-To and Troubleshooting » Need a little title help please <title></title>

Need a little title help please <title></title>

  • Hi there,

    Is there a way that I can incorporate the following:

    <title><?php if(preg_match(“%cityguide%”, $_SERVER[‘PHP_SELF’])) { ?> Ely Online | Ely City Guide <?php } ?></title>

    with this:
    <title><?php
    if ( is_home() ) {
    bloginfo(‘name’);
    } else {
    if ( is_single() || is_page() ) {
    single_post_title(‘Ely Online | ‘);
    }
    } ?></title>

    so this will allow me to show non-wp pages that use:

    <?php

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

    Just wondered if anyone has any suggestions for dynamically showing titles for non-wp pages really.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    does noone know how to incorporate the two?

    Thank you

    I use this code to generate better titles for my page (I’m retentive about certain things). You could do your action first and then encase the rest of the code (for WP) in the else statement, or do it the other way around. I’ve posted my title code before and I think someone modified it to use compare the URI’s, similar to what you’d like I imagine.

    Anyway good luck and post back if you need more help or let us know what you did to get it working.

    Cheers,
    Michael.

    Niziol

    Thanks for the reply.

    Your code looks interesting but I wondered how I would incorporate non-wp pages using Use WP Templating System as I mentioned above. Any ideas?

    Many thanks

    You could easily alter it, you’ll just need to make up a list of URI’s and the title you want to go with it and then compare the requested URI with one of those to get a match. It would do the trick, though you would probably need to hard-code the information in, which is fine unless you have lots of pages.

    Give it a try and let me know if you get stuck.

    Cheers,
    Michael.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Need a little title help please <title></title>’ is closed to new replies.