Title: Remove Parenthesis around widget count
Last modified: August 22, 2016

---

# Remove Parenthesis around widget count

 *  Resolved [WordMonkey25](https://wordpress.org/support/users/wordmonkey25/)
 * (@wordmonkey25)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/)
 * Hi,
 * Very nice plugin. Could you please make it an option to remove the parenthesis(#)
   around the view count in the widget?
 * I removed them myself from line 903 in top-10.php but obviously that will be 
   overwritten next update.
 * [https://wordpress.org/plugins/top-10/](https://wordpress.org/plugins/top-10/)

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/page/2/?output_format=md)

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863540)
 * Hi,
 * I’ll add a filter that will allow you to remove the parenthesis if required. 
   It won’t be an option in the settings page, but you’ll need some code to fix 
   this in the functions.php of your theme.
 *  Thread Starter [WordMonkey25](https://wordpress.org/support/users/wordmonkey25/)
 * (@wordmonkey25)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863567)
 * Thanks for the response, a filter in functions would work just fine.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863676)
 * Hi,
 * v2.1.0 brings this feature. You can use a filter to remove the parenthesis. Check
   out a sample function: [https://gist.github.com/ajaydsouza/9f04c26814414a57fab4](https://gist.github.com/ajaydsouza/9f04c26814414a57fab4)
 *  [hdotyoung](https://wordpress.org/support/users/hdotyoung/)
 * (@hdotyoung)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863700)
 * Hi, Ajay. Thanks a lot for the plugin. I was trying to remove the parentheses
   as well but this function throws an array error. Is there an update or alternate
   method?
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863701)
 * What error are you getting with this function exactly?
 * You may also want to try:
 *     ```
       $tptn_list_count = str_replace(￼ '(', '', $tptn_list_count );
       	$tptn_list_count = str_replace(￼ ')', '', $tptn_list_count );
       ```
   
 *  [hdotyoung](https://wordpress.org/support/users/hdotyoung/)
 * (@hdotyoung)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863702)
 * Hey Ajay, thanks for the response.
 * The error I get using the snippet you posted on github is:
 * `Parse error: syntax error, unexpected 'array' (T_ARRAY) in /home/vsb/public_html/
   wp-content/themes/VSB2014/functions.php on line 45`
 * And the error I get using the second one is:
 * `Parse error: syntax error, unexpected ''('' (T_CONSTANT_ENCAPSED_STRING) in /
   home/vsb/public_html/wp-content/themes/VSB2014/functions.php on line 45`
 * Any ideas? Thanks again.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863703)
 * Hi, it appears to be that the code isn’t finding it’s place in the right location
   in your functions.php
 * In your functions.php, can you please add only the below code. You need to make
   sure that they are before the closing php tag `?>` if this shows up at the end
   of your functions.php file. Some files might not have this at the end.
 *     ```
       function filter_tptn_list_count( $tptn_list_count ) {
       	$tptn_list_count = str_replace(￼ "(", "", $tptn_list_count );
       	$tptn_list_count = str_replace(￼ ")", "", $tptn_list_count );
   
       	return $tptn_list_count;
       }
       add_filter( 'tptn_list_count', 'filter_tptn_list_count' );
       ```
   
 *  [hdotyoung](https://wordpress.org/support/users/hdotyoung/)
 * (@hdotyoung)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863704)
 * Hi Ajay,
 * The php is closed properly; the ?> is in place. I have a few other functions 
   in there I wrote previously and they’re working as expected.
 * I tried the snippet above previous to my response yesterday. Tried it again today
   as the sole function in the file and it still threw that same T_CONSTANT_ENCAPSED_STRING
   syntax error I pasted above. I’m at a loss unfortunately.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863705)
 * It’s rather strange. The T_CONSTANT_ENCAPSED_STRING error is usually when you’re
   mixing quotes. Which you clearly aren’t.
 * can you tell me what happens when you use `preg_replace` instead of `str_replace`
 *  [hdotyoung](https://wordpress.org/support/users/hdotyoung/)
 * (@hdotyoung)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863706)
 * Same error. I again removed every other function but this one and still:
 * `Parse error: syntax error, unexpected ''('' (T_CONSTANT_ENCAPSED_STRING) in /
   home/vsb/public_html/wp-content/themes/VSB2014/functions.php on line 8`
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863707)
 * Hi,
 * What is Line 8 exactly?
 *  [hdotyoung](https://wordpress.org/support/users/hdotyoung/)
 * (@hdotyoung)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863708)
 * This is the entirety of functions.php:
 *     ```
       <?php
       /**
        * @package WordPress
        * @subpackage VSB_Custom_Theme
        */
   
       function filter_tptn_list_count( $tptn_list_count ) {
       	$tptn_list_count = preg_replace(￼ '(', '', $tptn_list_count );
       	$tptn_list_count = preg_replace(￼ ')', '', $tptn_list_count );
   
       	return $tptn_list_count;
       }
       add_filter( 'tptn_list_count', 'filter_tptn_list_count' );
   
       ?>
       ```
   
 * So it looks like line 8 (or line 45 when I don’t delete everything else) is:
 * `$tptn_list_count = preg_replace(￼ '(', '', $tptn_list_count );`
 * or, before your most recent suggestion:
 * `$tptn_list_count = str_replace(￼ '(', '', $tptn_list_count );`
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863709)
 * The file does look fine. Does it make a difference if you use double-quotes instead
   of single-quotes?
 * Also, does it give this error in any other theme?
 *  [hdotyoung](https://wordpress.org/support/users/hdotyoung/)
 * (@hdotyoung)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863710)
 * Yep, errors out on the default twentyeleven theme as well:
 * `Parse error: syntax error, unexpected ''('' (T_CONSTANT_ENCAPSED_STRING) in /
   home/vsb/public_html/wp-content/themes/twentyeleven/functions.php on line 42`
 * And no, double quotes doesn’t make a difference, unfortunately. Still that stubborn
   error.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/#post-5863711)
 * I’m afraid even I’m stumped by the error. For some reason it keeps pointing you
   to `''(''`
 * Can you try
 *     ```
       $tptn_list_count = str_replace(￼ '\(', '', $tptn_list_count );
       ```
   
 * With the \

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/page/2/?output_format=md)

The topic ‘Remove Parenthesis around widget count’ is closed to new replies.

 * ![](https://ps.w.org/top-10/assets/icon-256x256.png?rev=3619994)
 * [WebberZone Top 10 — Popular Posts](https://wordpress.org/plugins/top-10/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/top-10/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/top-10/)
 * [Active Topics](https://wordpress.org/support/plugin/top-10/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/top-10/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/top-10/reviews/)

 * 17 replies
 * 3 participants
 * Last reply from: [Ajay](https://wordpress.org/support/users/ajay/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/remove-parenthesis-around-widget-count/page/2/#post-5863713)
 * Status: resolved