ID); } else { $related_type = get_the_category($post->ID); } $amount = get_theme_mod('caeliora_post_related_amount', 3); if ($related_type) { $category_ids = array(); foreach($related_type as $individual_category) $category_ids[] = $individual_category->term_id; if (get_theme_mod('caeliora_post_related_type', 'cat') == 'tag') { $args = array( 'tag__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $amount, 'ignore_sticky_posts' => 1, 'orderby' => 'rand' ); } else { $args = array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $amount, 'ignore_sticky_posts' => 1, 'orderby' => 'rand' ); } $caeliora_related_query = new wp_query( $args ); if( $caeliora_related_query->have_posts() ) { ?>