<?php global $qaleb;?>
<?php if($qaleb['title-imge'] == '1'){?>
<div class="polist">
<div class="title">
<h3><?php echo $qaleb['relate-default-title']; ?></h3>
</div>
<div class="lisp">
<?php
$related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 4, 'post__not_in' => array($post->ID) ) );
if( $related ) foreach( $related as $post ) {
setup_postdata($post); ?>
<h2><i class="fa fa-joomla" aria-hidden="true"></i> <a href="<?php the_permalink(); ?>" alt="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php } wp_reset_postdata(); ?>
</div></div>

<?php }else{ ?>

<div class="polist">
<div class="title">
<h3><?php echo $qaleb['relate-default-title']; ?></h3>
</div>
<?php
$related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 3, 'post__not_in' => array($post->ID) ) );
if( $related ) foreach( $related as $post ) {
setup_postdata($post); ?>
<div class="grid">
<div class="thumbnail">
<?php if(has_post_thumbnail()){?>
<a href="<?php the_permalink(); ?>"><img src="<?php the_post_thumbnail_url('loop1'); ?>" alt="<?php the_title(); ?>"></a>
<?php }else{ ?>
<img src="<?php bloginfo("template_url"); ?>/img/none.png">
<?php } ?>
<a href="<?php the_permalink(); ?>" class="overlayy"><div class="textt"><i class="fa fa-file-text-o" aria-hidden="true"></i></div></a>
 </div>
<div class="det">
<?php if(get_post_meta( get_the_ID(), 'meta-text-1', true )!=null){ ?><div class="rotitr"><?php echo get_post_meta( get_the_ID(), 'meta-text-1', true ); ?></div><?php } ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
</div>
</div>
<?php } wp_reset_postdata(); ?>
</div>
<?php } ?>