WordPress.org

Support

Support » Plugins and Hacks » $wp_title help – conditional problem

$wp_title help – conditional problem

  • Hi

    I’m writing a template that applies to several pages. The idea is to perform different actions based on the value of wp_title('',false).

    But I’m stuck because I can’t seem to compare the page name generated by wp_title with other strings

    Code:

    <?php
    $pagetitle = wp_title('', false);
    if ($pagetitle == "About") :
    ?>
    etc
    <?php endif; ?>

    I’m actually using a switch statement but the problem is the exactly the same in if.

    The only thing I can think of is that perhaps the value returned in $pagetitle is not really a text string? (Although I can echo it as one perfectly well!) If it isn’t text, is there a way of converting it into text?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘$wp_title help – conditional problem’ is closed to new replies.
Skip to toolbar