How is it possible to add a particular tab (in language 1), using “append”, on the page of a product in language 1, and add a tab in language 2 for this same product in language 2 ?
I'm not sure I'm making myself clear...
Example: I'd like a “color” tab for the “car” product. And the “couleur” tab for the “voiture” product.
Of course, the “car” product is the same product in English as the “voiture” product in French.
With the global tab, you can choose precisely the product (car or voiture), and create the translated tab, but in the product page, it will be the same tab for both products...
Do you have a solution for this problem? Because otherwise the “global tabs” won't be very “global” anymore...
If we keep Polylang configuration as "custom fields" synchronized, and we want to exclude synchronization of tabs we just have added for a product in language 1, into product in language 2 ...
I'm testing this, in functions.php:
// filter to exclude specified post_meta from Polylang Sync ## add_filter( 'pll_copy_post_metas', 'q_pll_copy_post_metas' );
/** * Remove defined custom fields from Polylang Sync * * @since 0.1 * @param Array $metas * @return Array Array of meta fields */ function q_pll_copy_post_metas( $metas ) {
// this needs to be added to the PolyLang Settings page as an option ## $unsync = array ( 'woost_tabs', 'woost_overwrite' );
#var_dump( $unsync ); #var_dump( $metas );
if ( is_array( $metas ) && is_array( $unsync ) ) {
// loop over all passed metas ## foreach ( $metas as $key => $value ) {
// loop over each unsynch item ## foreach ( $unsync as $find ) {
if ( strpos( $value, $find ) !== false ) {
unset( $metas[$key] );
}
}
}
}
#wp_die( var_dump( $metas ) );
// kick back the array ## return $metas;
}
Could confirm me that 'woost_tabs' and 'woost_overwrite' are the only custom fields we have to exclude from synchronization ?
Ok, I confirm it works very well with this code; in order to let Polylang synchronizing all other custom fields except the ones for creating custom tabs.
With this, it's possible to have different tabs for the same product, according its language.
Thank you so much for taking the time to investigate and fix that problem. I have noted it down for other customers to follow if they encounter the same issue.
Regarding the snippet, you can try the shortened version below:
Hi,
How is it possible to add a particular tab (in language 1), using “append”, on the page of a product in language 1, and add a tab in language 2 for this same product in language 2 ?
I'm not sure I'm making myself clear...
Example:
I'd like a “color” tab for the “car” product.
And the “couleur” tab for the “voiture” product.
Of course, the “car” product is the same product in English as the “voiture” product in French.
With the global tab, you can choose precisely the product (car or voiture), and create the translated tab, but in the product page, it will be the same tab for both products...
Do you have a solution for this problem? Because otherwise the “global tabs” won't be very “global” anymore...
Thank you very much
Best regards
Hi,
Perhaps I found a solution:
If we keep Polylang configuration as "custom fields" synchronized, and we want to exclude synchronization of tabs we just have added for a product in language 1, into product in language 2 ...
I'm testing this, in functions.php:
Could confirm me that 'woost_tabs' and 'woost_overwrite' are the only custom fields we have to exclude from synchronization ?
Thanks in advance for your answer.
Best regards
Ok, I confirm it works very well with this code; in order to let Polylang synchronizing all other custom fields except the ones for creating custom tabs.
With this, it's possible to have different tabs for the same product, according its language.
I hope it will be useful for other users.
Best regards
Hi BM,
Thank you so much for taking the time to investigate and fix that problem. I have noted it down for other customers to follow if they encounter the same issue.
Regarding the snippet, you can try the shortened version below:
Best regards,
Dustin
Hi Dustin,
Yes, shortened indeed !
Thanks a lot.
Best regards.
PS:I think you can close this ticket, but leaving it visible for people concerned by this need