cabrerahector / wordpress-popular-posts

WordPress Popular Posts - A highly customizable WordPress widget that displays your most popular posts.
https://wordpress.org/plugins/wordpress-popular-posts/
GNU General Public License v2.0
279 stars 83 forks source link

Allow extra filtering on admin stats screen for categories, tags, custom taxonomy, custom taxonomy tag/category terms. #273

Open chriskostelec opened 4 years ago

chriskostelec commented 4 years ago

I was hoping the stat screen at wp-admin/options-general.php?page=wordpress-popular-posts&tab=stats would only log posts that my wpp_get_mostpopular() template tag was tracking. I know you can only show certain post types by clicking the gear, but it would be great if we could filter further by categories, tags, custom taxonomy, and custom taxonomy tags/categories (not sure if they should be separate inputs or all custom taxonomy things in one input).

Mockup idea:

image

Just to make sure I am not doing something wrong, this is what I'm doing:

if ( function_exists('wpp_get_mostpopular') ) {
  $args = array (
    'limit' => 5,
    'range' => 'last30days',
    'order_by' => 'views',
    'post_type' => 'resources',
    'taxonomy' => 'resource-categories',
    'term_id' => '16',
    'stats_views' => false,
    'wpp_start' => '<ol class="most-read-wrapper">',
    'wpp_end' => '</ol>',
    'post_html' => 
    '<li class="most-read">
      <a href="{url}">
        <h3>{text_title}</h3>
        <span class="article-title-sm">{label}</span>
      </a>
    </li>'
  );
  wpp_get_mostpopular( $args );
}

I know there is a wpp_trackable_post_types filter that would cover it if I only needed to filter by post type, but unfortunately that doesn't cover my situation. Maybe it's not so easy, but it would be nice. Thanks!

cabrerahector commented 4 years ago

Hi @chriskostelec,

Thanks for the suggestions and the mockup! I agree that this may be useful for some people so I'll think about it. This would be super low priority though and you may have to wait for a while so please keep that in mind.

I'll leave a comment here whether I decide to implement this as I'd surely need your help testing this.

Have a nice day!

chriskostelec commented 4 years ago

No worries, just thought I'd mention it!