Commit ce1e130a authored by Isaque Melo's avatar Isaque Melo

Add support to arbitrary taxonomy insted of category

parent 232612e3
......@@ -56,7 +56,7 @@ class related_posts {
}
static function get_posts($post_id = null, $num = 6, $post_types = ['post']){
static function get_posts($post_id = null, $num = 6, $post_types = ['post'], $taxonomy = 'category'){
global $wpdb;
$post_types = implode("','", $post_types);
......@@ -69,7 +69,7 @@ class related_posts {
$categories_multiplier = get_option('related_posts__categories_weight', 1.5);
$categories = self::get_post_taxonomy_terms($post_id, 'category');
$categories = self::get_post_taxonomy_terms($post_id, $taxonomy);
$tags = self::get_post_taxonomy_terms($post_id, 'post_tag');
$tags_sql = "((SELECT COUNT(t1.term_taxonomy_id) * $tags_multiplier FROM $wpdb->term_relationships t1 WHERE t1.object_id = p.ID AND t1.term_taxonomy_id IN ($tags)))";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment