<?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
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;

$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'showposts'=>4,
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '';
while ($my_query->have_posts()) {
$my_query->the_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 } echo ''; } } wp_reset_query();  ?>
</div></div>

<?php }else{ ?>

<div class="polist">
<div class="title">
<h3><?php echo $qaleb['relate-default-title']; ?></h3>
</div>
<?php
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;

$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'showposts'=>3,
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '';
while ($my_query->have_posts()) {
$my_query->the_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 } echo ''; } } wp_reset_query();  ?>
</div>
<?php } ?>