Notifications
Clear all

Paid Addons Support Forum Only

Please note, that here we only support Paid Addons issues and questions.

gVectors Support staff works from 6am to 6pm (GMT+0)

All questions related to wpForo and wpDiscuz free plugins should be asked in the corresponding plugin support forum:

 

wpDiscuz Support Forum wpForo Support Forum

[Solved] Comments Count


yoannc
(@yoannc)
Active Member
Joined: 8 months ago
Posts: 5
Topic starter  

Hi there,

By default, there is a space between the title and the number of comments in the tab label. Since the installation of the WooDiscuz plugin, this space has been deleted, both in the "Reviews" tab and in the "Discussions" tab. How to restore it?

Thank you

tabs

 


Astghik
(@astgh)
Support Team Admin
Joined: 4 years ago
Posts: 5000
 

@yoannc,

Could you please leave some example URL? Also please leave a screenshot of how it looks before the WooDiscuz plugin installed. 


yoannc
(@yoannc)
Active Member
Joined: 8 months ago
Posts: 5
Topic starter  

@astghik

I corrected the Discussions tab of the plugin by leaving a last space after the name of the Disscussion Tab Title field: "Discussions "

Regarding the Reviews tab, it's your plugin that removes the space. I noticed it after deactivating / reactivating WooDiscuz.

There is a hook to change the name of this tab:

add_filter( 'woocommerce_product_tabs', 'rename_reviews_tab' );

function rename_reviews_tab( $tabs ) {
global $product;
$tabs['reviews']['title'] = 'Customer Reviews (' . $product->get_review_count() . ') ';
return $tabs;
}

This snippets works as normal, but not when your plugin is activated.

screen tabs

 


yoannc
(@yoannc)
Active Member
Joined: 8 months ago
Posts: 5
Topic starter  

I found a temporary solution, not the cleanest, but functional:

/**
* Remove product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {

// unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab

return $tabs;
}

/**
* Add a custom product data tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {

// Adds the new tab

$tabs['test_tab'] = array(
'title' => __( 'Reviews (' . $product->get_review_count() . ')', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);

return $tabs;

}
function woo_new_product_tab_content() {

// The new tab content

echo do_shortcode('[cusrev_reviews]');

}

I am waiting if you have a better solution.


yoannc
(@yoannc)
Active Member
Joined: 8 months ago
Posts: 5
Topic starter  

@astghik

After some tests, it is possible to rename the "Description" and "Additional Information" tabs with the hooks provided by WooCommerce but not with the "Reviews" tab.

add_filter( 'woocommerce_product_tabs', 'rename_description_tab' );
function rename_description_tab( $tabs ) {
$tabs['description']['title'] = 'About';
return $tabs;
}

Renaming "Description" works in all cases.

add_filter( 'woocommerce_product_tabs', 'rename_additional_info_tab' );
function rename_additional_info_tab( $tabs ) {
$tabs['additional_information']['title'] = 'More Info';
return $tabs;
}

Renaming "Additional Info" works in all cases.

add_filter( 'woocommerce_product_tabs', 'rename_reviews_tab' );
function rename_reviews_tab( $tabs ) {
global $product;
$tabs['reviews']['title'] = 'Customer Reviews (' . $product->get_review_count() . ')';
return $tabs;
}

Renaming "Reviews (x)" only works when WooDiscuz is disabled.

add_filter( 'woocommerce_product_tabs', 'replace_reviews_tab' );
function replace_reviews_tab( $tabs ) {
$tabs['reviews']['title'] = str_replace( 'Reviews', 'Customer Reviews', $tabs['reviews']['title'] );
return $tabs;
}

Replace "Reviews" only works when WooDiscuz is disabled.

I can't use the method described in my previous post because I am getting new issues.

I need a solution urgently enough.

Thanks.


Astghik
(@astgh)
Support Team Admin
Joined: 4 years ago
Posts: 5000
 

@yoannc,

Please follow the steps below:

1. Open the wp-content/plugins/woodiscuz/wpc.php file

2. Find the 219 line

3. Replace the code in the line with this one:

return _e('Reviews', 'woocommerce') . ' (' . $this->reviews_count . ')';

yoannc
(@yoannc)
Active Member
Joined: 8 months ago
Posts: 5
Topic starter  

Great, that fixes the problem. Thanks!

It would be nice to fix it in a future update.

Thank you again!


Astghik
(@astgh)
Support Team Admin
Joined: 4 years ago
Posts: 5000
 

Yes, the changes will be included in the next version. 


Share:
Scroll to top