Remove parentheses around list counts

Remove opening and closing parentheses from the count displayed in Top 10 list items.

What it changes

The function removes every ( and ) from the formatted count string passed through Top 10’s tptn_list_count filter.

Scope

It changes the formatted list count, not the stored view count. If your count format contains parentheses elsewhere in its text, those are removed too.

Requirements

  • Top 10
  • Top 10 must be active and display counts in its list output.

Source

top-10/outputs/tptn-remove-brackets.php
<?php
/**
 * Plugin Name: Top 10 - Remove brackets
 * Plugin URI:  https://webberzone.com/plugins/top-10/
 * Description: Remove brackets from the list count in the list items.
 * Author: Ajay D'Souza
 * Author URI: https://webberzone.com
 * Version: 1.0
 *
 * @package Top_Ten
 * @license GPL-2.0+
 */

/**
 * Remove brackets from the count.
 *
 * @param  string $tptn_list_count Formatted list count.
 * @return string Updated list count without brackets.
 */
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' );

Details

Type
Plugin
Last updated
GitHub
Source · Edit companion · History

Developer references