devsaredead
Forum Replies Created
-
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?Sure, thank you very much indeed for trying. I will let you know if I find a solution… ??
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?…unfortunately it’s still not able to detect the product category and the custom tab is visible in every product. We must try a different syntax…
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?don’t put AND but OR, you have to display it for noleggio OR rents
yes but I have no idea how to do this, I’m no coder ?? sorry. Something like this, maybe?
if ( has_term( ['noleggio','rents'], 'product_cat' ) ) {
if (class_exists( 'Falang' ))Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?…yes the content is correct, but it was also in the original code ??
I guess we just need to insert the 2 categories IF statements:
if ( has_term( 'noleggio', 'product_cat' ) )
andif ( has_term( 'rents', 'product_cat' ) )
but they must go outside
if (class_exists( 'Falang' ))
, right?Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?I can spot the small difference in the code but it doesn’t work. I mean, it changes the tab content as per language, but the tab is visible for all categories. As a matter of fact, I don’t see anything that could recall a logic like “check if the product is from category X and: show custom tab if it is, hide the tab if it isn’t”.
It looks like you removed/forgot the
if ( has_term( 'noleggio|rents', 'product_cat' ) )
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?hello again. You can read the full code hereby:
/* New Product Tab @ WooCommerce Single Product */
if (class_exists( 'Falang' )) {
$current_locale = Falang()->get_current_language()->locale;
if ($current_locale == 'it_IT') {
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab', 9999 );
function woo_new_product_tab( $tabs ) {
$tabs['docs'] = array(
'title' => __( 'Preventivo', 'woocommerce' ), // TAB TITLE
'priority' => 50, // TAB SORTING (DESC 10, ADD INFO 20, REVIEWS 30)
'callback' => 'woo_new_product_tab_content', // TAB CONTENT CALLBACK
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
global $product;
echo 'richiesta noleggio volo per ' . $product->get_name();
echo do_shortcode( '[forminator_form id="1046"]' );
}
}
if ($current_locale == 'en_US') {
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab', 9999 );
function woo_new_product_tab( $tabs ) {
$tabs['docs'] = array(
'title' => __( 'Quotation', 'woocommerce' ), // TAB TITLE
'priority' => 50, // TAB SORTING (DESC 10, ADD INFO 20, REVIEWS 30)
'callback' => 'woo_new_product_tab_content', // TAB CONTENT CALLBACK
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
global $product;
echo 'rent request for ' . $product->get_name();
echo do_shortcode( '[forminator_form id="1059"]' );
}
}
}This is the category where the code appears (just open a product and see the custom tab “Preventivo/Quotation”), whereas it should not appear in all other categories. Looking forward to your kind help ??
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?Thank you for your time anyway. It looked like we were close to the solution ??
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?hello, I’m catching up because you left me without a solution. Can you look at this again? thanks
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ??? that is the code that works showing the custom tab to every product. I could not understand where to include the changes you proposed in order to filter out all product_cat except noleggio/rents, I have made many attempts but either I modify it wrong or maybe it doesn’t work. Please be so kind to amend the code as it really should be, because I’m really lost, I’d appreciate a lot ??
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?sure, thank you for your time. The actual code is this:
if (class_exists( 'Falang' )) {
$current_locale = Falang()->get_current_language()->locale;
if ($current_locale == 'it_IT') {
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab', 9999 );
function woo_new_product_tab( $tabs ) {
$tabs['docs'] = array(
'title' => ( 'Preventivo', 'woocommerce' ), // TAB TITLE
'priority' => 50, // TAB SORTING (DESC 10, ADD INFO 20, REVIEWS 30)
'callback' => 'woo_new_product_tab_content', // TAB CONTENT CALLBACK
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
global $product; echo 'richiesta noleggio volo per ' . $product->get_name();
echo do_shortcode( '[forminator_form id="1046"]' );
}
}
if ($current_locale == 'en_US') {
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab', 9999 );
function woo_new_product_tab( $tabs ) {
$tabs['docs'] = array(
'title' => ( 'Quotation', 'woocommerce' ), // TAB TITLE
'priority' => 50, // TAB SORTING (DESC 10, ADD INFO 20, REVIEWS 30)
'callback' => 'woo_new_product_tab_content', // TAB CONTENT CALLBACK
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
global $product;
echo 'rent request for ' . $product->get_name();
echo do_shortcode( '[forminator_form id="1059"]' );
}
}
}Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?sorry I understand the logic but not the syntax, I’m not a PHP dev….
If I substitute the callback it gives me an error, so I have to add it ? but it doesn’t work… sorry for the dum question
'callback' => 'woo_new_product_tab_content', // TAB CONTENT CALLBACK
);
}
function woo_new_product_tab_content_us() {
// ENGLISH TAB CONTENT
global $product;
echo 'rent request for ' . $product->get_name();
echo do_shortcode( '[forminator_form id="1059"]' );
}Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?ok it’s 1 parameter but it has 2 echos
function woo_new_product_tab_content() {
// ITALIAN TAB CONTENT
global $product;
echo 'richiesta noleggio volo per ' . $product->get_name();
echo do_shortcode( '[forminator_form id="1046"]' );
}and
function woo_new_product_tab_content() {
// ENGLISH TAB CONTENT
global $product;
echo 'rent request for ' . $product->get_name();
echo do_shortcode( '[forminator_form id="1059"]' );
}Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?I don’t get it. Where does it fetch the $tabs from?
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?I apologize, in the code above I wrote the shortcode [contact form] thinking it was not important to you, but as a matter of fact it’s a different shortcode for the 2 languages (i.e. contactform id=1 and contactform id=2). I can see that it does make a difference, so I do apologize if I have to ask you to adapt the code again (also there was a little error
'title' => ( )
was missing
__(
Besides that, I don’t think it works because I can see the contact form in both product categories
Forum: Plugins
In reply to: [Falang multilanguage for WordPress] translation of functions ?Yes I have the following code in my function.php file. This is an example of the product where the custom tab is visible (/product_cat/noleggio/ (Italian) and /product_cat/rents (English)), and this is an example where the tab is visible but I wish it was hidden (all other product_cat).
/* NEW PRODUCT TAB IN WOOCOMMERCE SINGLE PRODUCT */
if (class_exists( 'Falang' )) {
$current_locale = Falang()->get_current_language()->locale;
if ($current_locale == 'it_IT') {
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab', 9999 );
function woo_new_product_tab( $tabs ) {
$tabs['docs'] = array(
'title' => ( 'Preventivo', 'woocommerce' ), // TAB TITLE
'priority' => 50, // TAB SORTING (DESC 10, ADD INFO 20, REVIEWS 30)
'callback' => 'woo_new_product_tab_content', // TAB CONTENT CALLBACK
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
global $product;
echo 'richiesta noleggio volo per ' . $product->get_name();
echo do_shortcode( '[contact form]' );
}
}
if ($current_locale == 'en_US') {
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab', 9999 );
function woo_new_product_tab( $tabs ) {
$tabs['docs'] = array(
'title' => ( 'Quotation', 'woocommerce' ), // TAB TITLE
'priority' => 50, // TAB SORTING (DESC 10, ADD INFO 20, REVIEWS 30)
'callback' => 'woo_new_product_tab_content', // TAB CONTENT CALLBACK
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
global $product;
echo 'rent request for ' . $product->get_name();
echo do_shortcode( '[contact form]' );
}
}
}