inc/related-content.php¶
-
largo_get_related_topics_for_category
()¶ 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
-
largo_get_post_related_topics
()¶ Provides topics (categories and tags) related to the current post in The Loop.
Parameters: - $max (int) – The maximum number of topics to return.
Returns: array $f term objects.
Since: 1.0
-
largo_get_recent_posts_for_term
()¶ Provides the recent posts for a term object (category, post_tag, etc).
Uses: global $post
Parameters: - $term (object) – A term object.
- $max (int) – Maximum number of posts to return.
- $min (int) – Minimum number of posts. If not met, returns false.
- $post__not_in (Array) – Array of integer post IDs to be excluded from the query
Returns: array|false $f post objects.
Since: 1.0
-
largo_has_categories_or_tags
()¶ Determine if a post has either categories or tags
Returns: bool $rue is a post has categories or tags Since: 1.0
-
largo_top_term
()¶ Returns (and optionally echoes) the ‘top term’ for a post, falling back to a category if one wasn’t specified
Parameters: - $options (array|string) – Settings for post id, echo, link, use icon, wrapper and exclude
-
largo_post_class_top_term
()¶ Add the post’s top term to the post’s post_class array
Link: Since: 0.5.5
Filter: post_class
Parameters: - $classes (array) – An array of classes on the post
Returns: array
-
class
Largo_Related
¶ - The Largo Related class. Used to dig through posts to find IDs related to the current post
-
__construct
()¶ Constructor. Sets up essential parameters for retrieving related posts
Access: public
Parameters: - $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
Returns: null
-
popularity_sort
()¶ Array sorter for organizing terms by # of posts they have
Parameters: - $a (object) – First WP term object
- $b (object) – Second WP term object
Returns: integer
-
cleanup_ids
()¶ Performs cleanup of IDs list prior to returning it. Also applies a filter.
Access: protected Returns: array $he final array of related post IDs
-
get_series_posts
()¶ 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
-
get_term_posts
()¶ Fetches posts contained within the categories and tags this post has. Feeds them into $this->post_ids array
Access: protected
-
get_recent_posts
()¶ Fetches recent posts. Used as a fallback when other methods have failed to fill post_ids to requested length
Access: protected
-
ids
()¶ 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
-
add_from_query
()¶ Takes a WP_Query result and adds the IDs to $this->post_ids
Access: protected
Parameters: - $ (object) – WP_Query object
- $ptional (boolean) – whether the query post order has been reversed yet. If not, this will loop through in both directions.
-
have_enough_posts
()¶ Counts to see if enough posts have been found
-