If-Then Statement with the_author_ID()
-
I’m setting up my blog so that an author-specific image will appear in each author’s post. I figured I would have to use an if-then statement to do it, but most of the coding I’ve tried so far just displays the author ID instead of using it as the terms of a condition. I’ve tried two different types of coding so far (I replaced the img coding for just the text “img” in this example to make it easier to read):
<?php
$atr=the_author_ID();
if ($atr==1)
echo “img1”;
elseif ($atr==4)
echo “img2”;
?>(the above only posts the ID numbers)
and
<?php
if (the_author_ID(‘1’))
echo “img1”;
elseif (the_author_ID(‘4’))
echo “img2”;
?>(the above posts the ID numbers twice, like 11 or 44)
Help? Any advice would be really appreciated! ??
- The topic ‘If-Then Statement with the_author_ID()’ is closed to new replies.