Skip to content

Instantly share code, notes, and snippets.

@ajaydsouza
Last active July 22, 2017 22:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajaydsouza/9f04c26814414a57fab4 to your computer and use it in GitHub Desktop.
Save ajaydsouza/9f04c26814414a57fab4 to your computer and use it in GitHub Desktop.
Top 10 - tptn_list_count filter examples
<?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 );
<?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