I have zero experience with PHP. I run a wordpress site, and am trying to make one simple modification to the code. This is what I have:
<?php
if(<?php the_author() ?> == "Joe Man")
{
<?php the_author() ?>
}
?>
I believe all variables start with a $, so what I have above in my if statement is not a variable. What do I do? I also tried creating a variable, as below:
<?php
$author = <?php the_author() ?>
if($author == "Joe Man")
{
<?php the_author() ?>
}
?>
Neither of the above worked. So my question is how can I get that if statement to evaluate? What I need is if the_author is “Joe Man”, for the string “Joe Man” to display on my page.
This is the error I get btw:
Parse error: syntax error, unexpected ‘<‘
Thanks!
You may not nest
<?php ?>tags. The correct code would be:Actually, the variable could be skipped altogether, shortening the code to:
Note the echo to print out the author.