Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Dante › PHP error tabs.php line 49
New Landing › How can we help? › Themeforest Theme Support › Dante › PHP error tabs.php line 49
- This topic has 43 replies, 6 voices, and was last updated 9 years by Swift Ideas – Ed.
-
Posted in: Dante
-
November 20, 2014 at 6:01 pm #129797
I am getting this error in my error_log:
PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /home/langleyd/public_html/wp-content/themes/dante/woocommerce/single-product/tabs/tabs.php on line 49
any ideas whats causing it?
This is line 49:
<?php call_user_func( $tab[‘callback’], $key, $tab ) ?>
November 21, 2014 at 7:09 am #129888Hi,
The developer of theme will assist you shortly.
Thanks
MohammadNovember 24, 2014 at 1:42 am #130323Hi @crease
That’s odd. Not getting the issue here. Have you tried disabling any active plugins? What version of the theme/WooCommerce are you using?
– Ed
November 25, 2014 at 8:52 am #130775I am using the latest version on both.
I have added this content to my functions.php file to add an additional tab:
add_filter( ‘woocommerce_product_tabs’, ‘woo_new_product_tab’ );
function woo_new_product_tab( $tabs ) {// Adds the new tab
$tabs[‘custom_tab’] = array(
‘title’ => __( ‘Tab Title’, ‘woocommerce’ ),
‘priority’ => 50,
‘callback’ => ‘woo_new_product_tab_content’
);
return $tabs;}function woo_new_product_tab_content() {
// The new tab content
echo ‘<p>Additional copy for tab here</p>’;
}add_filter( ‘woocommerce_product_tabs’, ‘woo_reorder_tabs’, 98 );
function woo_reorder_tabs( $tabs ) {
$tabs[‘tab-downloads’][‘priority’] = 5; // first
return $tabs;
}Not sure if that would cause a conflict. I will disable it for now and see. But why is the error within the tabs file of the dante theme and not in the changes I have made?
November 25, 2014 at 8:59 am #130780The error would show there because that is where the tabs code is run. Let me know if it is because of that code – I can’t see anything wrong first glance.
– Ed
November 25, 2014 at 9:21 am #130798Yes I remove this code and the error vanished put it back in and pop its there again.
I only displays front end for a second though while the content loads in, if that makes a difference.
November 26, 2014 at 12:10 am #131133Hi,
I think, you create a tab called custom_tab and try to order the priority of another tab with some other name like tab-downloads? That didn’t registered yet??
Try this code.
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' ); function woo_new_product_tab( $tabs ) { // Adds the new tab $tabs['custom_tab'] = array( 'title' => __( 'Tab Title', 'woocommerce' ), 'priority' => 50, 'callback' => 'woo_new_product_tab_content' ); return $tabs;} function woo_new_product_tab_content() { // The new tab content echo '<p>Additional copy for tab here</p>'; } add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); function woo_reorder_tabs( $tabs ) { $tabs['custom_tab']['priority'] = 5; // first return $tabs; }
Let us know,
Thanks,
laranz.November 26, 2014 at 9:11 am #131243Thanks I think that has sorted it. I will keep and eye on the error log and let you know. Thanks for your help.
November 26, 2014 at 9:12 am #131244Hi,
I glad that issue resolved. Great, thanks Laranz.
MohammadJanuary 4, 2015 at 9:44 am #138828Hi Ed and his guys.
I have little trouble I’d like you to help me fix.I added the following in functions.php:
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); function woo_reorder_tabs( $tabs ) { $tabs['reviews']['priority'] = 15; $tabs['description']['priority'] = 10; $tabs['additional_information']['priority'] = 5; return $tabs; } add_filter( 'woocommerce_product_tabs', 'description_tab', 99 ); function description_tab( $tabs ) { global $post, $product; $exists = sf_get_post_meta($post->ID, 'sf_product_description', true); if (empty($exists)) { unset($tabs['description']); } return $tabs; }
With those lines I reached two goals:
1) to order tabs
2) hide tabs “description” if its content is voidUnfortunately, it seems to be in conflict with your code because I noticed the following error in error.log:
[Sun Jan 04 10:24:10 2015] [warn] [client 207.46.13.11] mod_fcgid: stderr: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /data/vhosts/puntobianco.net/httpdocs/assets/themes/dante/woocommerce/single-product/tabs/tabs.php on line 49
which is the same of this topic.___
Strange thing is that I’m pretty sure that before yesterday there was also “Reviews” tab visible. Today… after noticing error in error.log I cannot see it anymore…
___Is there a way for me to use my snippet in a compatible way with your tabs.php?
I hope so. 🙂January 4, 2015 at 10:01 am #138829Maybe I should add some other additional info about this error:
you may see in the attached screenshots the following:
– duvet named “Canadese” has no content for “Description”, Reviews tab is visible;
– duvet named “Caldapiuma” has content for “Description”, Reviews tab is… not visible.
The following what appears in error.log
[Sun Jan 04 11:02:07 2015] [warn] [client 151.49.194.140] mod_fcgid: stderr: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /data/vhosts/puntobianco.net/httpdocs/assets/themes/dante/woocommerce/single-product/tabs/tabs.php on line 49, referer: http://www.puntobianco.net/categoria-prodotto/letto/piumini-oca/
Please, note that at the time I was writing that I commented the snippet
/*add_filter( ‘woocommerce_product_tabs’, ‘description_tab’, 99 );
function description_tab( $tabs ) {
global $post, $product;
$exists = sf_get_post_meta($post->ID, ‘sf_product_description’, true);
if (empty($exists)) {
unset($tabs[‘description’]);
}
return $tabs;
}*/Hope you can help me finding what’s happening with your tabs.php.
Thanks in advance.Attachments:
You must be logged in to view attached files.January 4, 2015 at 10:28 am #138832My final draft is the following:
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); function woo_reorder_tabs( $tabs ) { $tabs['additional_information']['priority'] = 5; return $tabs; } add_filter( 'woocommerce_product_tabs', 'description_tab', 99 ); function description_tab( $tabs ) { global $post; $exists = sf_get_post_meta($post->ID, 'sf_product_description', true); if ($exists == "") { unset($tabs['description']); } return $tabs; }
error.log seems to be register any other incompatibility with your tabs.php
In regards to the two products as in the examples above, now they’re looking as expected.What do you think about this snippet consistency?
And in addition, is it possible to join my two functions in only one?January 5, 2015 at 5:32 pm #139134You can join the function like so:
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); function woo_reorder_tabs( $tabs ) { global $post; $tabs['additional_information']['priority'] = 5; $exists = sf_get_post_meta($post->ID, 'sf_product_description', true); if ($exists == "") { unset($tabs['description']); } return $tabs; }
Hope that helps.
– Ed
January 10, 2015 at 8:31 am #140555Hi Ed!
Thanks for your reply.
Joining functions like suggested works well.Even though I’m sorry to bother you again, but since I transferred my Dante featured ecommerce in a new dedicated server the only (!) error in error.log that I see is the following:
Sat Jan 10 08:53:07 2015] [warn] [client 66.249.64.149] mod_fcgid: stderr: PHP Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /................/themes/dante/woocommerce/single-product/tabs/tabs.php on line 49
Is it possible to investigate what may cause this issue?
Waiting for your prompt reply, many thanks.January 11, 2015 at 6:32 pm #140630Is that after the code change? Do you still get it if you remove that function?
– Ed
-
Posted in: Dante
You must be logged in and have valid license to reply to this topic.