WordPress.org

Ready to get started?Download WordPress

Forums

Need a little title help please <title></title> (5 posts)

  1. elyonline
    Member
    Posted 8 years ago #

    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

  2. elyonline
    Member
    Posted 8 years ago #

    Hi,

    does noone know how to incorporate the two?

    Thank you

  3. niziol
    Member
    Posted 8 years ago #

    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.

  4. elyonline
    Member
    Posted 8 years ago #

    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

  5. niziol
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.