
If you have been given a brief on a way an item could be built, including weight parameters, keeping it safe, strong,versatile and…
function display_related_posts() {
if (is_single()) {
global $post;
$categories = wp_get_post_categories($post->ID);
if ($categories) {
$args = array(
'category__in' => $categories,
'post__not_in' => array($post->ID),
'posts_per_page' => 4,
'orderby' => 'rand'
);
$related_posts = new WP_Query($args);
if ($related_posts->have_posts()) {
echo '
';
}
wp_reset_postdata();
}
}
}
add_action('wp_footer', 'display_related_posts');