WordPress WordPress Theme Development Adding a Blog to a WordPress Theme Coding the Blog Homepage

Problem with IF / ENDIF

I´m getting this error:

Parse error: syntax error, unexpected 'endif' (T_ENDIF) in /home/vaporiza/public_html/wp-content/themes/VaporizaTheme/home.php on line 24

*** Line 24 is where the IF CONDITIONAL is located.

Please help!

<?php 
/*

Template Name: HomeBlog

*/

 ?>

<?php get_header(); ?>



<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>


    <article class="post">
        <h1><a href="<?php the_permalink(); ?>"><?php the_title();?> </a></h1>
        <h2><a><?php the_excerpt();?></a></h2>
        <span><?php echo get_avatar( get_the_author_meta('ID'),24);?></span>
        <p><?php the_date();?></p>
        <p><?php the_time();?></p>
        <?php if( the_post_thumbnail() ); ?>
            <p><?php echo "hello";?></p>                            
        <?php endif; ?>
    </article>







    <?php endwhile; endif; ?>


<?php get_footer(); ?>

2 Answers

Bob McCarty
PLUS
Bob McCarty
Courses Plus Student 16,616 Points

Hector,

The embedded 'if' conditional needs a colon (:).

<?php if( the_post_thumbnail()  ) : ?>
        <p><?php echo "hello";?></p>
    <?php endif; ?>

Thank you Bob!! That was the problem with my code.