questiongirl
Member
Posted 3 years ago #
I'm in the Loop and trying to control an echo statement based on the author of the post but the condition is never true. And it prints the ID on the page. What is the correct way to evaluate the_author_login or some other template tag?
<?php
if (the_author_login() == 2) {
echo "<div class=\"entry3\">" ;
}
else { echo "<div class=\"entry\">";
} ?>
I believe you should use the_author_ID instead of the_author_login.
http://codex.wordpress.org/Template_Tags/the_author_ID
questiongirl
Member
Posted 3 years ago #
Hi Michael,
Sorry for the typo in my example. Yes I tried the_author_ID, and it prints the 2 on the page. But the value it returns in PHP is false, not 2, so the statement is never executed. With the_author_login I tried == to "admin" or admin and it is also always false even though it prints admin on the page.
Thanks.