Top 10 v3.0.0 introduced Top_Ten_Query which works as a wrapper for WP_Query. This brings all the power and flexibility of WP_Query to Top 10. If you’re not familiar with WP_Query, I recommend reading docs.

Standard Loop

get_tptn_posts()

get_tptn_posts() works as a wrapper to Top_Ten_Query and can be used to retrieve an array of the popular posts. It also accepts the same $args as Top_Ten_Query above.

Parameters

In addition to the WP_Query parameters, Top_Ten_Query also takes these additional parameters.

$args

(array) (Optional) Arguments to retrieve posts. See tptn_get_registered_settings()for all available arguments.

  • ‘blog_id’
  • (array|string) An array or comma-separated string of blog IDs.
  • ‘include_cat_ids’
    (array|string) An array or comma-separated string of category IDs. This should be the term_taxonomy_id.
  • ‘include_post_ids’
    (array|string) An array or comma-separated string of post IDs.
  • ‘offset’
    (int) number of post to displace or pass over. Warning: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination. The 'offset' parameter is ignored when 'posts_per_page'=>-1 (show all posts) is used.
  • ‘postid’
    (int) Get popular posts for a specific post ID.
  • ‘strict_limit’
    (bool) If this is set to false, then it will fetch 3x posts.