Parsing errors & if statements not working.
-
Hello,
Before I throw my computer out of the window could somebody help me with the following code that I wrote (the if and else statement was provided by another kind user here). For some reason when I try to output HTML I am confronted with a parsing error. This happens inside the if and else statements:
<?php get_header('topbar'); ?> <div class="blog_container"> <h2 class="blog-title"> Latest News </h2> <p> News information and much more. </p> </div> <?php $posts_query = new WP_Query( $query_args ); if ( $posts_query->have_posts()) { $first_post = true; while ( $posts_query->have_posts() ) { $posts_query->the_post(); if ( $first_post ) { <h2>This is where my latest post will appear</h2> } else { <h2>This is where all subsequent posts should appear</h2> } $first_post = false; } } wp_reset_postdata(); ?> <?php ?> <?php get_footer(); ?>
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Parsing errors & if statements not working.’ is closed to new replies.