A syntax error I'm scratching my head over SOLVED

Hi there,

I can’t understand what is wrong. my }elseif{ keeps throwing a syntax error and telling me that the ‘{’ is unexpected and it is expecting a’(’, but this can’t be right surely. If anyone can spare a few minutes to look over my code snippet and let me know what I’m doing wrong, I would really appreciate it as I am ready to pull my hair out!

<div id="post-<?php the_ID(); ?>" <?php post_class('blogpost-entry'); ?>
	<a href="<?php the_permalink(); ?>"><img class="SearchImage" src="<?php 
		if (get_the_post_thumbnail_url()) {
				the_post_thumbnail_url();
        	echo "/wp-content/themes/total-p/assets/images/newsrectangle.png";
		 }elseif{
			(get_field_url()) {
				get_field_url();
			echo "*PUT THE CORRECT URL HERE*";	
			}
		}

Many thanks!

Vicky

Not to worry, I’ve fixed it thank you :slight_smile:

<div id="post-<?php the_ID(); ?>" <?php post_class('blogpost-entry'); ?>>
	<a href="<?php the_permalink(); ?>"><img class="SearchImage" src="<?php 
		if (get_the_post_thumbnail_url()) {
				the_post_thumbnail_url();
		 }else if
			(get_field('listing_image')){
				get_field('listing_image');
			}else{
				echo "/wp-content/themes/total-p/assets/images/newsrectangle.png";
			}
        ?>
     "></a>
Sponsor our Newsletter | Privacy Policy | Terms of Service