Last active
July 22, 2017 22:11
-
-
Save ajaydsouza/9f04c26814414a57fab4 to your computer and use it in GitHub Desktop.
Top 10 - tptn_list_count filter examples
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 | |
/** | |
* Display the formatted list count. | |
* | |
* Add this code to your theme's functions.php file. | |
* | |
* @param $string $tptn_list_count Formatted list count | |
*/ | |
function tptn_display_formatted_count( $tptn_list_count, $sum_count, $result ) { | |
$tptn_list_count = get_tptn_post_count( $result->ID ); | |
return $tptn_list_count; | |
} | |
add_filter( 'tptn_list_count', 'tptn_display_formatted_count', 10, 3 ); | |
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 | |
/** | |
* Remove brackets from the count. | |
* | |
* Add this code to your theme's functions.php file. | |
* | |
* @param $string $tptn_list_count Formatted list count | |
*/ | |
function tptn_remove_brackets( $tptn_list_count ) { | |
$tptn_list_count = str_replace( array( '(', ')', ), '', $tptn_list_count ); | |
return $tptn_list_count; | |
} | |
add_filter( 'tptn_list_count', 'tptn_remove_brackets' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment