Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Brecht

    (@brechtvds)

    The filters are generated in the cache.php file. Ideally you’d do it using the wpupg_grid_cache_filter plugin hook without directly changing our plugin files as you’ll lose those changes on updating.

    It is already possible to exclude/include only specific terms from the grid edit page. But this doesn’t select on term count at the moment.

    Thread Starter Gerald

    (@gerital)

    Thanks for your reply. To use wpupg_grid_cache_filter plugin hook I would need the number of related posts in $filter, or not? So to make that work I would need this code added to line 239 of helpers/grid-cache.php:

    'posts_per_term' => count($posts_per_term[$taxonomy][$slug])

    Meanwhile I use a temporary solution with the not recommended method of editing your plugin. I added an IF to line 236 of helpers/grid-cache.php:

    // Filter terms
    if ($taxonomy != "musico" || $taxonomy == "musico" && count($posts_per_term[$taxonomy][$slug]) > 1) {
      $filter_terms[$slug] = array(
        'taxonomy' => $taxonomy,
        'name' => $term->name,
        'posts_per_term' => count($posts_per_term[$taxonomy][$slug])
      );
    }

    This only shows terms for taxonomy “musico” which have at least two related posts.

    Plugin Author Brecht

    (@brechtvds)

    With the wpupg_grid_cache_filter plugin hook you’d actually have to construct the entire filter yourself. Basically it’s just copying a bunch of code used in the plugin to construct the $filter variable, and just do it yourself in the functions.php file with the changes you want.

    Brecht

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Suggestion – Limit terms by post count’ is closed to new replies.