* @copyright Copyright (c) 2021, AeonWP * @link https://aeonwp.com/aeonblog * @license http://www.gnu.org/licenses/gpl-2.0.html * */ /** * Display related posts from same category * * @since AeonMag 1.0.0 * * @param int $post_id * @return void * */ if (!function_exists('aeonmag_related_post')) : function aeonmag_related_post($post_id) { global $aeonmag_theme_options; $title = esc_html($aeonmag_theme_options['aeonmag-single-page-related-posts-title']); if (0 == $aeonmag_theme_options['aeonmag-single-page-related-posts']) { return; } $categories = get_the_category($post_id); if ($categories) { $category_ids = array(); $category = get_category($category_ids); $categories = get_the_category($post_id); foreach ($categories as $category) { $category_ids[] = $category->term_id; } $count = $category->category_count; if ($count > 1) { ?>