0

I probably have an easy issue here: I'm new to php and WordPress template development: in my php I get error 'Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)'

I basically created a page and added content there and want to display dynamically on my home page.

Code below:

 <?php
 /**
template name: Home Page
 */

get_header(); ?>

<!--HERO-->
    <section id="hero">

        <article>

            <div class="container-fluid clearfix">

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


                    <div class="col-lg-3" "hero-text">  
                        <p class="lead newfont"><?php the_content(); ?></p> 
                    </div><!--col-->

<?php endwhile; ?>              

            </div><!--container-->

        </article><!--article-->    

    </section><!--HERO-->

<?php

get_footer();

The error is somewhere in the the_content(); if statement. But not sure whats wrong tried going over the documentation: https://developer.wordpress.org/reference/functions/the_content/

Any tip is appreciated as I'm new to this.

Dhruvin Moradiya
  • 546
  • 2
  • 10
  • 20
Zygimantas
  • 553
  • 8
  • 22

1 Answers1

1

You opened an if statement but you didn't close it at:

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

Just close it after closing the while loop:

<?php endwhile; ?>
<?php endif; ?>

This should solve your problem. Take a look at: http://php.net/manual/en/control-structures.alternative-syntax.php

A.Essam
  • 1,094
  • 8
  • 15
  • Thanks mate you actuully solved this one rookie mistake here, I have another question maybe you know the answer: '

    ' why the_content doesn't receive this class "lead newfont" as if I change the content to title, the page title displayed the right way. What basically happens this creates an new

    element instead of adding content as it where it is in the code.

    – Zygimantas Feb 19 '17 at 20:44
  • That's a CSS question, not PHP. Please post a new question providing the example code – A.Essam Feb 19 '17 at 20:50
  • no worries mate got it working: remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); – Zygimantas Feb 19 '17 at 20:53