I'm getting Parse error: syntax error, unexpected end of file

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



I'm getting Parse error: syntax error, unexpected end of file



can some help me figure out why I'm getting the error below, seem to be the end that is giving me the problem?



Parse error: syntax error, unexpected end of file in C:xampphtdocssandboxwpwp-contentthemeswebpromopartsslider.php on line 44




<?php
$slides = array();
$args = array( 'tag' => 'slide', 'nopaging'=>true, 'posts_per_page'=>5 );
$slider_query = new WP_Query( $args );
if ( $slider_query->have_posts() )
while ( $slider_query->have_posts() )
$slider_query->the_post();
if(has_post_thumbnail())
$temp = array();
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full', true);
$thumb_url = $thumb_url_array[0];
$temp['title'] = get_the_title();
$temp['excerpt'] = get_the_excerpt();
$temp['image'] = $thumb_url;
$slides = $temp;



wp_reset_postdata();
?>

<?php if(count($slides) > 0) ?>

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">

<ol class="carousel-indicators">
<?php for($i=0;$i<count($slides);$i++) ?>
<li data-target="#carousel-example-generic" data-slide-to="<?php echo $i ?>" <?php if($i==0) ?>class="active"
<?php ?>></li>
<?php ?>
</ol>

<div class="carousel-inner" role="listbox">
<?php $i=0; foreach($slides as $slide) extract($slide); ?>
<div class="item <?php if($i == 0) ?>active<?php ?>">
<img src="<?php echo $image ?>" alt="<?php echo esc_attr($title); ?>">
<div class="carousel-caption">
<h3>
<?php echo $title; ?>
</h3>
<p>
<?php echo $excerpt; ?>
</p>
</div>
</div>
<?php $i++; ?>
</div>

<a class="left carousel-control" target="_blank" href="#carousel-example-generic" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span><span class="sr-only">Previous</span></a>
<a class="right carousel-control" target="_blank" href="#carousel-example-generic" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span><span class="sr-only">Next</span></a>
</div>




1 Answer
1



You should be a little more careful with your indentations. I cleaned it up a bit for you and it made the answer quite apparent: You're missing a closing brace for your if( count( $slides ) > 0 ) statement:



if( count( $slides ) > 0 ){


<?php
$slides = array();

$args = array( 'tag' => 'slide', 'nopaging'=>true, 'posts_per_page'=>5 );

$slider_query = new WP_Query( $args );

if( $slider_query->have_posts() )
while( $slider_query->have_posts() )
$slider_query->the_post();

if( has_post_thumbnail() )
$temp = array();
$thumb_id = get_post_thumbnail_id();
$thumb_array = wp_get_attachment_image_src( $thumb_id, 'full', true );
$thumb_url = $thumb_array[0];

$temp['title'] = get_the_title();
$temp['excerpt'] = get_the_excerpt();
$temp['image'] = $thumb_url;

$slides = $temp;


wp_reset_postdata();


if( count( $slides ) > 0 ) ?>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<?php for( $i = 0; $i < count( $slides ); $i++ ) ?>
<li data-target="#carousel-example-generic" data-slide-to="<?php echo $i ?>" <?php if( $i==0 ) ?>class="active"<?php ?>></li>
<?php ?>
</ol>

<div class="carousel-inner" role="listbox">
<?php $i = 0 ; foreach( $slides as $slide ) extract( $slide ); ?>
<div class="item <?php if( $i == 0 ) ?>active<?php ?>">
<img src="<?php echo $image; ?>" alt="<?php echo esc_attr( $title ); ?>">
<div class="carousel-caption">
<h3><?php echo $title; ?></h3>
<p><?php echo $excerpt; ?></p>
</div>
</div>
<?php $i++; ?>
</div>

<a class="left carousel-control" target="_blank" href="#carousel-example-generic" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span><span class="sr-only">Previous</span></a>
<a class="right carousel-control" target="_blank" href="#carousel-example-generic" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span><span class="sr-only">Next</span></a>
</div>
<?php
?>






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard