/** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "") { $output = ""; $meta['el_class']; global $woocommerce, $product; if (!is_object($woocommerce) || !is_object($woocommerce->query) || empty($product)) { return; } $temp = $product->post->post_content; $product->post->post_content = ""; // $product = wc_get_product(); $output .= "<div class='av-woo-product-review av-woo-product-tabs product " . $meta['el_class'] . "'>"; ob_start(); wc_clear_notices(); woocommerce_output_product_data_tabs(); // comments_template('reviews'); $output .= ob_get_clean(); $output .= "</div>"; $product->post->post_content = $temp; return $output; }
<div class="uncont"> <?php if ($show_body_title) { woocommerce_template_single_title(); } woocommerce_template_single_rating(); woocommerce_template_single_price(); woocommerce_template_single_excerpt(); woocommerce_template_single_add_to_cart(); woocommerce_template_single_meta(); woocommerce_template_single_sharing(); ?> </div> </div> </div> </div> </div> </div> </div> </div> <?php ob_start(); woocommerce_output_product_data_tabs(); woocommerce_upsell_display(); $the_content = ob_get_clean(); echo uncode_get_row_template($the_content, '', '', '', ' product', false, false, false); ob_start(); woocommerce_output_related_products(); $the_content = ob_get_clean(); echo uncode_get_row_template($the_content, '', $limit_content_width, '', ' row-related', false, true, false);
public function wpv_woo_display_tabs_func() { global $woocommerce; if (is_object($woocommerce)) { if (is_product()) { global $woocommerce, $WPV_templates, $post; //Check for empty WooCommerce product content, if empty. //Apply the removal of filter for the_content only if content is set if (isset($post->post_content)) { $check_product_has_content = $post->post_content; if (!empty($check_product_has_content)) { //Has content, Remove this filter, run only once -prevent endless loop due to WP core apply_filters on the_content hook remove_filter('the_content', array($WPV_templates, 'the_content'), 1, 1); //https://icanlocalize.basecamphq.com/projects/11629195-toolset-peripheral-work/todo_items/193776982/comments //User adds the tab shortcode itself inside the Edit products in WC, this can cause infinite loop //Lets check if this content has the tab shortcodes itself and handle this. $checked_content = $post->post_content; if (strpos($checked_content, '[wpv-woo-display-tabs]') !== false) { //Has instance of tab shortcode remove_shortcode('wpv-woo-display-tabs'); } } } ob_start(); //Ensure $product is set $this->set_wc_views_products($post); //External WC core function call woocommerce_output_product_data_tabs(); $version_quick_check = $this->wcviews_using_woocommerce_two_point_one_above(); if ($version_quick_check) { //WC 2.1+ add_filter('comments_template', array(&$this, 'wc_views_comments_template_loader'), 999); } elseif (!$version_quick_check) { //Old WC remove_filter('comments_template', array($woocommerce, 'comments_template_loader')); } $content = ob_get_contents(); ob_end_clean(); add_filter('the_content', array($WPV_templates, 'the_content'), 1, 1); return $content; } } }