/*
Theme Name: Flatsome Child
Description: This is a child theme for Flatsome Theme
Author: UX Themes
Template: flatsome
Version: 3.0
*/

/*************** ADD CUSTOM CSS HERE.   ***************/


@media only screen and (max-width: 48em) {
/*************** ADD MOBILE ONLY CSS HERE  ***************/


}
// bài cùng chuyên mục có hình - flatsome.xyz
add_shortcode( 'baicungchuyenmuc', 'show_baicungchuyenmuc' );
function show_baicungchuyenmuc() { ?> 
<div id="related-posts">
<style>
h3.highlight-event__title {
border-bottom: 2px solid #00adef;
font-size: 130%;
}
.bailienquan img {
height: 180px;
object-fit: cover;
width: auto;
min-width:280px
}
.bailienquan a {
font-weight: bold;
font-size: 17px;
line-height: 17px;
font-style: normal;
text-decoration: none;
color: #515150;
font-family: Arial,Helvetica,sans-serif;
}
.bailienquan a:hover {
color:blueviolet
}
</style>
<?php
$categories = get_the_category(get_the_ID());
if ($categories){
echo '<div class="relatedcat">';
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array(get_the_ID()),
'posts_per_page' => 6,
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ):
echo '<div class="row row-small"><div class="col large-12">
<h3 class="highlight-event__title">BÀI CÙNG CHUYÊN MỤC</h3>
</div>';
while ($my_query->have_posts()):$my_query->the_post();
?>
<div class="col large-4 medium-6 bailienquan small-12"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(''); ?><?php the_title(); ?></a></div>
<?php
endwhile;
echo '</div>';
endif; wp_reset_query();
echo '</div>';
}
?>
</div>
<?php
}