0

Ok, so am doing some Wordpress edits, and I writ a if statement.

<?php $title = the_title();
if ($title != 'Designer'){ ?>
<body>
<?php }else{ ?>
<body class="noresponce">
<?php } ?>

As you can see though, this uses a function call as a variable. This is because the function call will call the name of the current page. This is good.

However it also tends to echo the title on page as well when I do this, which makes sense. I may be trying to do something that isn't correct. Can anyone tell me if its possible though?

Basically I want to use the function call in an if statement without it being echoed on page.

1
  • side note: you've misspelled "responce" Commented Jan 22, 2013 at 16:47

1 Answer 1

2

Use get_the_title() instead of the_title().

Source: http://codex.wordpress.org/Function_Reference/get_the_title

Sign up to request clarification or add additional context in comments.

1 Comment

Legend, simple effective answers always make my day. Thank you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.