Instantly share code, notes, and snippets.

Embed
What would you like to do?
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