Last active
August 29, 2015 14:06
-
-
Save jlengstorf/c6d8afb5909a10eb85c0 to your computer and use it in GitHub Desktop.
A simple way to load related posts using WordPress categories.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Put this inside the loop | |
$categories = wp_get_post_categories(get_the_ID(), array('number'=>1)); | |
$related_posts_id = get_the_ID(); | |
$related_posts_cats = $categories; | |
get_template_part('layouts/related-posts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment