/** * Instance function * * @since 1.0 * @author Modern Tribe * @return object the instance of the class. */ public static function instance() { if (!isset(self::$instance)) { $className = __CLASS__; self::$instance = new $className(); } return self::$instance; }
/** * Common library plugins have been activated. Functions that need to be applied afterwards can be added here. * * @return void */ public function helpersLoaded() { remove_action('widgets_init', 'tribe_related_posts_register_widget'); if (class_exists('TribeRelatedPosts')) { TribeRelatedPosts::instance(); require_once $this->pluginPath . 'vendor/tribe-related-posts/template-tags.php'; } }
<?php /* Plugin Name: Tribe Related Posts Description: Template tags and shortcode to display related posts by taxonomy. Author: Modern Tribe, Inc., Paul Hughes Version: 1.1 Author URI: http://tri.be */ // Include plugin files. include 'tribe-related-posts.class.php'; include 'tribe-related-posts-widget.php'; include 'template-tags.php'; TribeRelatedPosts::instance();
/** * Template Tag to display related posts. * * @since 1.1 * @author Paul Hughes * @param string $tags comma-separated list of tags. * @param int $count number of related posts to return. * @param string $blog the blog from which to fetch the related posts. * @param bool $only_display_related whether to display only related posts or others as well. * @param bool $thumbnails whether to display thumbnails or not. * @param string $post_type the type of post to return. * @return void */ function tribe_related_posts($tag = false, $category = false, $count = 5, $blog = false, $only_display_related = false, $thumbnails = false, $post_type = 'post') { apply_filters('tribe-related-posts', TribeRelatedPosts::displayPosts($tag, $category, $count, $blog, $only_display_related, $thumbnails, $post_type)); }