Title: $wp_title help &#8211; conditional problem
Last modified: August 19, 2016

---

# $wp_title help – conditional problem

 *  [saganaki](https://wordpress.org/support/users/saganaki/)
 * (@saganaki)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/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)

 *  Thread Starter [saganaki](https://wordpress.org/support/users/saganaki/)
 * (@saganaki)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp_title-help-conditional-problem/#post-845552)
 * bump
 *  Thread Starter [saganaki](https://wordpress.org/support/users/saganaki/)
 * (@saganaki)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp_title-help-conditional-problem/#post-845575)
 * bump – third time’s the charm?
 *  Thread Starter [saganaki](https://wordpress.org/support/users/saganaki/)
 * (@saganaki)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wp_title-help-conditional-problem/#post-845584)
 * Pretty quiet. Have I’ve offended the forum rules somehow – please let me know!
 *  [themeseo](https://wordpress.org/support/users/themeseo/)
 * (@themeseo)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/wp_title-help-conditional-problem/#post-845623)
 * Hi Saganaki,
 * Thank you for your code, I modifies is
 * > <?= wp_title(”, false); ?>
 * you can replace in **<title><?= wp_title(”, false); ?></title>** on header.php
 * Sekr.
 *  Thread Starter [saganaki](https://wordpress.org/support/users/saganaki/)
 * (@saganaki)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/wp_title-help-conditional-problem/#post-845627)
 * Hi Sekr
 * Thanks for the response. Not sure I really understand. Trying to get wp_title(”,
   false); to return a value that can be compared against another string.
 * Tks
 *  [funkboybilly](https://wordpress.org/support/users/funkboybilly/)
 * (@funkboybilly)
 * [17 years ago](https://wordpress.org/support/topic/wp_title-help-conditional-problem/#post-845695)
 * Trying to output wp_title(); to string also for a variable use in query_posts();
 *  [thinkarchimedes](https://wordpress.org/support/users/thinkarchimedes/)
 * (@thinkarchimedes)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/wp_title-help-conditional-problem/#post-845699)
 * Did you ever solve this problem? I am experiencing the same difficulty now. Much
   thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘$wp_title help – conditional problem’ is closed to new replies.

## Tags

 * [wp_title](https://wordpress.org/support/topic-tag/wp_title/)

 * 7 replies
 * 4 participants
 * Last reply from: [thinkarchimedes](https://wordpress.org/support/users/thinkarchimedes/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/wp_title-help-conditional-problem/#post-845699)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
