Problems with Divi builder and Yoast
-
Hi there,
i experienced an unstable behaviour while working in backend when using the plugin together with the activated Yoast Plugin when working on pages/post with divi builder. There are randomly new tabs opening and pages can partly not be saved. Divi support sent me a screenshot with a fatal PHP error that was caused by the Plugin: Custom Product Tabs for WooCommerce and recommended to discuss the matter here.
I would share this screenshot but can not attach it here.Tobias
-
Hi @td8000,
Could you use something like https://imgbb.com/ to share the screenshot?
In general though, the compatibility with Divi Builder is not good. You can find several threads on our forums addressing this. Regardless, I’ll do what I can to help.
Thanks,
JonHere’s the screenshot:
https://ibb.co/cYMKKqtHi @td8000,
Divi must be manually triggering the WooCommerce tabs hook without setting up the global variables correctly. The global $product variable should be defined during this callback as per the WooCommerce docs.
Divi is a paid plugin that I do not have a copy of, so I cannot be sure this will help, but in your custom tabs plugin folder can you make the following change on line 39 of
public/class.yikes-woo-tabs-display.phpand let me know if it resolves the issue:Replace
global $product;with the following:$product = wc_get_product(); if ( empty( $product ) ) { return $tabs; }I’m attempting to grab the current product another way, and failing more gracefully if I’m unable to do so. It is possibly that this will resolve the fatal error without addressing the deeper compatibility issues. Please let me know what you find.
Be sure to take a backup before editing your site files.
Jon
Great, i keep this i mind. However the issue is gone since the last update round. I can not tell, which update fixed it… Thanks a lot…
No, it is still opening tabs while working.
And i can’t find the piece of code, you mentionened above. Here the full code of the pgp file:
<?php if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Display' ) ) { class YIKES_Custom_Product_Tabs_Display { public function __construct() { add_action( 'woocommerce_init', array( $this, 'init' ) ); } public function init() { // Add our custom product tabs section to the product page add_filter( 'woocommerce_product_tabs', array( $this, 'add_custom_product_tabs' ) ); // Allow the use of shortcodes within the tab content add_filter( 'yikes_woocommerce_custom_repeatable_product_tabs_content', 'do_shortcode' ); } /** * Add the custom product tab to the front-end single product page * * $tabs structure: * Array( * id => Array( * 'title' => (string) Tab title, * 'priority' => (string) Tab priority, * 'callback' => (mixed) callback function, * ) * ) * * @param array | $tabs | Array representing this product's current tabs * * @return array | Array of this product's current tabs plus our custom tabs */ public function add_custom_product_tabs( $tabs ) { $product = wc_get_product(); if ( empty( $product ) ) { return $tabs; } $product_id = method_exists( $product, 'get_id' ) === true ? $product->get_id() : $product->ID; $product_tabs = maybe_unserialize( get_post_meta( $product_id, 'yikes_woo_products_tabs' , true ) ); if ( is_array( $product_tabs ) && ! empty( $product_tabs ) ) { // Setup priorty to loop over, and render tabs in proper order $i = 25; foreach ( $product_tabs as $tab ) { // Do not show tabs with empty titles on the front end if ( empty( $tab['title'] ) ) { continue; } $tab_key = $tab['id']; $tabs[ $tab_key ] = array( 'title' => $tab['title'], 'priority' => $i++, 'callback' => array( $this, 'custom_product_tabs_panel_content' ), 'content' => $tab['content'] ); } if ( isset( $tabs['reviews'] ) ) { // Make sure the reviews tab remains on the end (if it is set) $tabs['reviews']['priority'] = $i; } } /** * Filter: 'yikes_woo_filter_all_product_tabs' * * Generic filter that passes all of the tab info and the corresponding product. Cheers. * * Note: This passes all of the tabs for the current product, not just the Custom Product Tabs created by this plugin. * * @param array | $tab | Array of $tab data arrays. * @param object | $product | The WooCommerce product these tabs are for */ $tabs = apply_filters( 'yikes_woo_filter_all_product_tabs', $tabs, $product ); return $tabs; } /** * Render the custom product tab panel content for the given $tab * * $tab structure: * Array( * 'title' => (string) Tab title, * 'priority' => (string) Tab priority, * 'callback' => (mixed) callback function, * 'id' => (int) tab post identifier, * 'content' => (sring) tab content, * ) * **/ public function custom_product_tabs_panel_content( $key, $tab ) { $content = ''; $use_the_content_filter = apply_filters( 'yikes_woo_use_the_content_filter', true ); if ( $use_the_content_filter === true ) { $content = apply_filters( 'the_content', $tab['content'] ); } else { $content = apply_filters( 'yikes_woo_filter_main_tab_content', $tab['content'] ); } $tab_title_html = '<h2 class="yikes-custom-woo-tab-title yikes-custom-woo-tab-title-' . urldecode( sanitize_title( $tab['title'] ) ) . '">' . $tab['title'] . '</h2>'; echo apply_filters( 'yikes_woocommerce_custom_repeatable_product_tabs_heading', $tab_title_html, $tab ); echo apply_filters( 'yikes_woocommerce_custom_repeatable_product_tabs_content', $content, $tab ); } } new YIKES_Custom_Product_Tabs_Display(); }-
This reply was modified 3 years, 9 months ago by
Steven Stern (sterndata).
-
This reply was modified 3 years, 9 months ago by
The topic ‘Problems with Divi builder and Yoast’ is closed to new replies.