PHP help needed – echo HMTL based on Author ID
-
I need some help troubleshooting a snippet of PHP code (I’m not a trained coder, but trying to learn)…..
I’m trying to echo some HTML based on the author of a post being viewed, so I am using this statement, but it’s not working correctly:
~
<?php
$exp = the_author_meta(‘ID’);
if($exp = 4) {
echo ‘(the html I want echoed goes here)’;
} elseif($exp = 3) {
echo ‘(some different html I want echoed goes here)’;
}
?>~I also tried it with the ID number in single quotes like this ($exp = ‘4’)
It only ever echoes the first html, regardless of what the author ID is, even if it is neither of the two I have shown (I have more than a dozen authors, but just want this HTML code echoed if it is one of these two)
Can anyone spot what I’m doing wrong? Thanks for any help!
- The topic ‘PHP help needed – echo HMTL based on Author ID’ is closed to new replies.