Last active
August 11, 2023 14:39
-
-
Save matadorjobs/f42d64f940becb6b21eef376de6ac3a6 to your computer and use it in GitHub Desktop.
Display count of jobs per term in a Matador taxonomy term list
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 //omit opening tag | |
add_filter( 'matador_taxonomy_terms_term_label', 'matador_docs_matador_taxonomy_terms_term_label', 10, 2 ); | |
/** | |
* Matador Docs Example: Add Term Count to Taxonomy Term Label | |
* | |
* In this example, display count of jobs per term in a Matador taxonomy term list. | |
* | |
* @since 2023-05-01 | |
* | |
* @author Matador US, LP | |
* | |
* @param string $label | |
* @param \WP_Term $term | |
* | |
* @return string | |
**/ | |
function matador_docs_matador_taxonomy_terms_term_label( $label, $term ) { | |
return '(' . $term->count . ') ' . $label; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment