Parse error: Syntax error unexpected endif [duplicate]

This question already has an answer here:

I got the parse error: syntax error, unexpected end of file

Here is my code:

if ( $post_ids ) {
    $loop = new WP_Query( array(
        'posts_per_page'      => -1, // display all favorited posts. Perhaps limit?
        'ignore_sticky_posts' => true,
        'post__in'            => $post_ids
    ) );
while ( $loop->have_posts() ) : $loop->the_post();
                                        if ( has_post_thumbnail() ) : // thumbnail check 
                                        $image   = wp_get_attachment_image_src( get_post_thumbnail_id());                                     
?>   
<div>
                                <img src="<?php echo esc_url($image[0]); ?>" />
                            </div>
                       <?php

                            endif; 
                            endwhile;
                            endif;
                            wp_reset_query();
                        ?>

What could be wrong?

Read more here: Parse error: Syntax error unexpected endif [duplicate]

Leave a Reply

Your email address will not be published. Required fields are marked *