diff --git a/main.php b/main.php index 69d31e8..508a90f 100644 --- a/main.php +++ b/main.php @@ -151,4 +151,11 @@ function bs_swiper_hero() { function bs_swiper_hero_fade() { return bs_swiper_get_template('sc-swiper-hero-fade.php'); } -add_action('wp_head', 'bs_swiper_hero_fade'); \ No newline at end of file +add_action('wp_head', 'bs_swiper_hero_fade'); + + +// Related Posts +function bs_swiper_related_posts() { + return bs_swiper_get_template('related-posts.php'); +} +add_action('wp_head', 'bs_swiper_related_posts'); diff --git a/templates/related-posts.php b/templates/related-posts.php new file mode 100644 index 0000000..73d7f3b --- /dev/null +++ b/templates/related-posts.php @@ -0,0 +1,89 @@ +term_id); + endforeach; + endif; + + $current_post_type = get_post_type($post_id); + + $query_args = array( + 'category__in' => $cat_ids, + 'post_type' => $current_post_type, + 'post__not_in' => array($post_id), + 'posts_per_page' => '12', + ); + + $related_cats_post = new WP_Query($query_args); +?> + +
+