public static function shortcodeFollowed() { if (!get_current_user_id()) { return; } if (CMA_Thread::canBeFollower()) { $postsIds = CMA_FollowersEngine::getFollowed(CMA_Thread::FOLLOWERS_USER_META_PREFIX); } if (!empty($postsIds)) { $posts = get_posts(array('include' => $postsIds, 'post_type' => CMA_Thread::POST_TYPE, 'number' => 100)); } else { $posts = array(); } $threads = array(); foreach ($posts as $post) { $threads[] = CMA_Thread::getInstance($post->ID); } if (CMA_Category::canBeFollower()) { $termsIds = CMA_FollowersEngine::getFollowed(CMA_Category::FOLLOWERS_USER_META_PREFIX); } if (!empty($termsIds)) { $terms = get_terms(CMA_Category::TAXONOMY, array('include' => $termsIds, 'hide_empty' => 0)); } else { $terms = array(); } $categories = array(); foreach ($terms as $term) { $categories[] = CMA_Category::getInstance($term->term_id); } return self::_loadView('answer/widget/followed', compact('threads', 'categories')); }