We help IT Professionals succeed at work.
Get Started

Wordpress PHP if Statement not working correctly

techvagabond
techvagabond asked
on
330 Views
Last Modified: 2012-05-10
Below I have a piece of code in which I'm certain I'm doing something very stupid, as does come with working on a Saturday.
I have in my functions.php a declared true/false variable. If the drop down is set to yes, or true, then it does display the text "Test" and then input the code for the wordpress comment engine (The comment section does not appear)

The second part, if it is not equal to 'yes', then it returns a seperate DIV tag. This also works.

So the IF statement seems to be working, but it just does not seem to be working with the <?php comments_template(); ?> WordPress hook.

Any Ideas?

<?php if (get_option('console_engine') <> 'yes')
	{
	echo "Test <?php comments_template(); ?>";
	}else{
		echo "<div id='test-root'></div>";
	}?>

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE