I'm trying to place the default featured image on the blog index page with an image to be determined by who the author of the post is. For some reason I'm getting the image for $author_id=2 even when the $author_id returns 3.
I've echoed my $author_id to make sure that it's returning the correct info, and it is. So something is wrong in the if statement itself.
Here's my code:
$author_id=the_author_meta('ID');
function default_image_fallback() {
if(has_post_thumbnail()) {
the_post_thumbnail();
} else if($author_id = "2") {
echo '<img src="' . trailingslashit( get_stylesheet_directory_uri() ) . 'images/jon-thumb.jpg' . '" alt="Jonathan Warner" />';
} else if($author_id = "3") {
echo '<img src="' . trailingslashit( get_stylesheet_directory_uri() ) . 'images/sam-thumb.jpg' . '" alt="Samuel Warner" />';
}
else {
echo '<img src="' . trailingslashit( get_stylesheet_directory_uri() ) . 'images/default-thumb.jpg' . '" alt="Samuel and Jonathan Warner" />';
}
}
Here's the development site: http://bit.ly/1tMMbpy
I'm grateful for any help on this.