<?php $this_categories = get_the_category(); ?>
<?php $this_id = get_the_ID(); ?>
<?php $query = new WP_Query(array('category__in' => $this_categories, 'post__not_in' => '$this_id', 'posts_per_page' => 5)); ?>
<?php while ($query->have_posts()) : $query->the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
$(document).ready(function() {
if ($(document).width() > 640) {
console.log('1');
}
$(window).resize(function() {
if ($(document).width() > 640) {
console.log('2');
}
})
});