Show related tags and subcategories for each main category Used on category.php to display a list of related terms
Since: 0.5.5 Returns: String $TML ‘’ if there are no related topics or a UL if there are related topics
Provides topics (categories and tags) related to the current post in The Loop.
- $max (int) – The maximum number of topics to return.
array $f term objects.
Provides the recent posts for a term object (category, post_tag, etc).
- $term (object) – A term object.
- $max (int) – Maximum number of posts to return.
- $min (int) – Minimum number of posts. If not met, returns false.
array|false $f post objects.
Determine if a post has either categories or tags
Returns: bool $rue is a post has categories or tags Since: 1.0
Returns (and optionally echoes) the ‘top term’ for a post, falling back to a category if one wasn’t specified
- $options (array|string) – Settings for post id, echo, link, use icon, wrapper and exclude
Add the post’s top term to the post’s post_class array
- $classes (array) – An array of classes on the post
- class Largo_Related¶
- The Largo Related class. Used to dig through posts to find IDs related to the current post
Constructor. Sets up essential parameters for retrieving related posts
- $number (integer) – optional The number of post IDs to fetch. Defaults to 1
- $post_id (integer) – optional The ID of the post to get related posts about. If not provided, defaults to global $post
Array sorter for organizing terms by # of posts they have
- $a (object) – First WP term object
- $b (object) – Second WP term object
Performs cleanup of IDs list prior to returning it. Also applies a filter.
Access: protected Returns: array $he final array of related post IDs
Fetches posts contained within the series(es) this post resides in. Feeds them into $this->post_ids array
Access: protected See: largo_series_custom_order
Fetches posts contained within the categories and tags this post has. Feeds them into $this->post_ids array
Fetches recent posts. Used as a fallback when other methods have failed to fill post_ids to requested length
Loops through series, terms and recent to fill array of related post IDs. Primary means of using this class.
Access: public Returns: array $n array of post ids related to the given post
Takes a WP_Query result and adds the IDs to $this->post_ids
- $ (object) – WP_Query object
- $ptional (boolean) – whether the query post order has been reversed yet. If not, this will loop through in both directions.
Counts to see if enough posts have been found