Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Ajay

    (@ajay)

    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

    (@wordmonkey25)

    Thanks for the response, a filter in functions would work just fine.

    Plugin Author Ajay

    (@ajay)

    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

    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

    (@ajay)

    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 );

    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

    (@ajay)

    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' );

    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

    (@ajay)

    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

    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

    (@ajay)

    Hi,

    What is Line 8 exactly?

    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

    (@ajay)

    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?

    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

    (@ajay)

    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)
  • The topic ‘Remove Parenthesis around widget count’ is closed to new replies.