Can someone help me with a PHP line in Wordpress.
I just add the PHP else condition after the if in case that the site owner did not post a feature image. Please don't correct it but point me a hint so I can find the syntax error myself.
<a class="main_img" href="<?php the_permalink();?>">
<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>
<?php if($feat_image){?>
<img src="<?php echo $feat_image; ?>" alt="">
<?php } ?>
<?php else() {?>
<img src="http://website.com/if_no_feat_image.jpg" alt="">
<?php } ?>
</a>
elsestatement does have a requirement, it just does whatever theifstatement doesn't do. You need to remove the()after theelsestatement in order for it to work. If you however want theelsestatement to have a condition change it toelseifthen you can have the()to put the condition in.