Title: wp_title help
Last modified: August 18, 2016

---

# wp_title help

 *  Resolved [stanu5](https://wordpress.org/support/users/stanu5/)
 * (@stanu5)
 * [19 years ago](https://wordpress.org/support/topic/wp_title-help/)
 * Hi,
 * I am new to WordPress and PHP but have a lot of experience with ASP. I seemed
   to be stuck on the simplest thing but can’t see what I am doing wrong.
 * I am trying to change the layout based on the page that is being displayed. For
   example I created “About” page through WordPress Admin Pannel and now am trying
   to get the following code to work. For some (unknown to me) reason the code does
   not like the condition in my _if_ statement.
 * _<?php
    $pagetitle = wp\_title(‘ ‘, false); if ($pagetitle == “About”) : ?>
 * …code…
 * <?php endif; ?>
 * Please help.
 * Thanks.

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

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years ago](https://wordpress.org/support/topic/wp_title-help/#post-572929)
 * If you are putting your code in the content area of a Page or post – that will
   not work, unless you use a plugin like phpexec, execphp and some similar plugins.
   
   If we want a different layout for a Page – we ususally go by creating a new Page
   template and create the new Page by using that template. See more: [http://codex.wordpress.org/Pages#Page_Templates](http://codex.wordpress.org/Pages#Page_Templates)
 *  Thread Starter [stanu5](https://wordpress.org/support/users/stanu5/)
 * (@stanu5)
 * [19 years ago](https://wordpress.org/support/topic/wp_title-help/#post-572942)
 * Hi Moshu,
 * Thank you for your response. I am actually creating it within the page template
   and not in the content area. For some reason the condition within the _if_ statement
   is not recognized properly. For example if I change it to _if ($pagetitle != “
   About”)_ it steps into the if loop for every page including my “About” page. 
   When I try to put the _echo_ inside the _if_ it prints the titles correctly. 
   For my “About” page it in fact prints the word About. I really can’t figure out
   why it doesn’t work.
 * Thanks in advance for any ideas.
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years ago](https://wordpress.org/support/topic/wp_title-help/#post-572943)
 * Hmm… Maybe this is what you need: [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 *  Thread Starter [stanu5](https://wordpress.org/support/users/stanu5/)
 * (@stanu5)
 * [19 years ago](https://wordpress.org/support/topic/wp_title-help/#post-572947)
 * This worked perfectly!!! THANK YOU VERY MUCH!!!
 * (I am still confused though why my other code is incorrect :))

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

The topic ‘wp_title help’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [stanu5](https://wordpress.org/support/users/stanu5/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/wp_title-help/#post-572947)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
