Created
February 13, 2014 05:23
-
-
Save trepmal/8970181 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Plugin Name: Min Post Count for Category List | |
| * Plugin URI: trepmal.com | |
| * Description: | |
| * Version: | |
| * Author: Kailey Lampert | |
| * Author URI: kaileylampert.com | |
| * License: GPLv2 or later | |
| * License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
| * TextDomain: | |
| * DomainPath: | |
| * Network: | |
| */ | |
| add_filter( 'get_the_categories', 'min_post_count_for_category_list' ); | |
| function min_post_count_for_category_list( $list ) { | |
| foreach( $list as $k => $term_obj ) { | |
| if ( $term_obj->count < apply_filters( 'min_post_count', 3 ) ) | |
| unset( $list[ $k ] ); | |
| } | |
| return $list; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment