0

I have problem with this code, whenever I put something after it, it breaks. Is the query closed properly?

  <div class="container">
<div class="col-sm-12 col-xs-12">
<div class="headdark"><h3>Places nearby <?php echo the_title()?> </h3></div>
<div class="condark relbeach bearound row">

$loclat = get_post_meta($post->ID, 'map_lat', true);
$loclng = get_post_meta($post->ID, 'map_lng', true);
$posttype = 'location';
$dist = 10;
$nearbyLocation = get_nearby_loc($loclat, $loclng, $posttype, $dist);
 if ($nearbyLocation):
 global $post;
foreach ($nearbyLocation as $post): 
setup_postdata($post); ?>

<div class="col-md-3">
<div class="aroundbeach">
<?php 

if((round($post->distance,4) * 1000) > 1000) {
    echo '<div class="distt">'.round($post->distance,2).' KM away'.'</div>';
}else{
 echo '<div class="distt">'.(round($post->distance,2) * 1000).' M away'.'</div>';
}
?></div><div class="thumb">
       <header class="thumb-header"><a href="<?php the_permalink(get_the_ID()) ?>" class="hover-img">
                <?php
                   $img = get_the_post_thumbnail( get_the_ID() , array(360,270,'bfi_thumb'=>true)) ;
                   if(!empty($img)){
                       echo balanceTags($img);
                   }else{
                       echo '<img width="360" height="270" alt="no-image" class="wp-post-image" src="'.bfi_thumb(get_template_directory_uri().'/img/no-image.png',array('width'=>360,'height'=>270)) .'">';
                   }
                   ?>
</a></header>
        <div class="thumb-caption">
            <h5 itemprop="name" class="thumb-title"><a class="text-darken" href="<?php the_permalink() ?>"><?php the_title();?></a></h5>
<div class="text-darken"></div>
            <p class="mb0 text-darken">
            </p></div></div></div>
 <?php endforeach; ?>
 <?php else : ?>
    <h3 class="center">It seems like there are no places around</h3>
 <?php endif;  ?>
</div></div></div>
2
  • Can you indent your code? It's super difficult to read and understand, your editor should have auto-indented it for you ( PHPStorm, Sublime Text, Coda, Netbeans, etc )
    – Tom J Nowell
    Nov 3 '16 at 0:28
  • Do you have debugging on?
    – ngearing
    Nov 3 '16 at 0:42
1

i think you are missing semicolons on flowing code. i have added semicolons.

    <div class="headdark"><h3>Places nearby <?php echo the_title();?> </h3></div>


<header class="thumb-header"><a href="<?php the_permalink(get_the_ID()); ?>" class="hover-img">



<div class="thumb-caption">
            <h5 itemprop="name" class="thumb-title"><a class="text-darken" href="<?php the_permalink() ;?>"><?php the_title();?></a></h5>

and

you have used {} but in flowing code you use ** : ** in closing logic

<?php else : ?
    <h3 class="center">It seems like there are no places around</h3>
 <?php endif;  ?>
1
  • Shame on me, but simple ";" were the cause. Thank you
    – Rafal
    Nov 3 '16 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.