Skip to content

Instantly share code, notes, and snippets.

@kamalinfo
Created November 30, 2017 04:43
Show Gist options
  • Save kamalinfo/693de8d40944ee75586b3747e772d634 to your computer and use it in GitHub Desktop.
Save kamalinfo/693de8d40944ee75586b3747e772d634 to your computer and use it in GitHub Desktop.
<?php
//for another category addd
$facility = get_terms('hotel_category',true);
$post_terms = wp_get_post_terms(get_the_id(),'hotel_category');
$post_terms_ids = array();
foreach( $post_terms as $item ){
$post_terms_ids[] = $item->term_id;
}
$i = 1;
foreach( $facility as $item ):
if(in_array($item->term_id, $post_terms_ids)){
$class = 'check';
} else {
$class = 'close';
}
?>
<span><i class="zmdi zmdi-<?php echo esc_attr( $class ); ?>"></i><?php echo esc_html( $item->name ); ?></span>
<?php
if($i % 4 == 0){
echo '</div><!-- ./single-facility inner --><div class="single-facility">';
}
?>
<?php
$i++;
endforeach;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment