
Hector F.
27,464 PointsProblem 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
Courses Plus Student 16,616 PointsHector,
The embedded 'if' conditional needs a colon (:).
<?php if( the_post_thumbnail() ) : ?>
<p><?php echo "hello";?></p>
<?php endif; ?>

Hector F.
27,464 PointsThank you Bob!! That was the problem with my code.