WordPress.org

Ready to get started?Download WordPress

Forums

Make a list with categories over a specific number of post (2 posts)

  1. Andrés Sanhueza
    Member
    Posted 6 years ago #

    Is there a way to make a category list (like with wp_list_categories) that only displays categories that contains a specific number of posts and beyond?

  2. MichaelH
    Member
    Posted 6 years ago #

    Didn't test this much but this would get categories that had more than 7 posts:

    <?php
    $min_post_cats = $wpdb->get_col("SELECT term_id
    FROM $wpdb->term_taxonomy
    WHERE taxonomy = 'category'
    AND count > 7");
    $cats = implode(",", $min_post_cats);
    $wlc_param_list='hide_empty=0&show_count=1&title_li=&include=' . $cats;
    wp_list_categories($wlc_param_list);
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags