'; echo '
'; } } elseif ( 'type' == $template_type ) { global $post; $content_type = get_post_meta( $post->ID, 'content_type', true ); $post_content = $post->post_content; $object = apply_filters( 'alpus_builder_get_current_object', get_the_ID(), array( 'content_type' => $content_type ) ); if ( $object ) { // backup global data $original_query = $GLOBALS['wp_query']; $original_queried_object = $GLOBALS['wp_query']->queried_object; if ( 'term' == $content_type ) { $original_is_tax = $GLOBALS['wp_query']->is_tax; $original_is_archive = $GLOBALS['wp_query']->is_archive; $GLOBALS['wp_query']->queried_object = $object; $GLOBALS['wp_query']->is_tax = true; $GLOBALS['wp_query']->is_archive = true; } else { $original_post = $GLOBALS['post']; $GLOBALS['post'] = $object; setup_postdata( $GLOBALS['post'] ); $GLOBALS['wp_query']->queried_object = $GLOBALS['post']; if ( 'product' == $content_type && class_exists( 'Woocommerce' ) ) { $GLOBALS['product'] = wc_get_product( $object->ID ); } } // render echo do_blocks( $post_content ); // restore global data $GLOBALS['wp_query'] = $original_query; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $GLOBALS['wp_query']->queried_object = $original_queried_object; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited if ( 'term' == $content_type ) { $GLOBALS['wp_query']->is_tax = $original_is_tax; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $GLOBALS['wp_query']->is_archive = $original_is_archive; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited } else { $GLOBALS['post'] = $original_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited if ( 'product' == $content_type ) { unset( $GLOBALS['product'] ); } } } } else { global $product; if ( $product ) { /** * Single Product Template */ wc_get_template( 'single-product.php' ); } else { /** * Block Template */ if ( have_posts() ) : the_post(); the_content(); wp_reset_postdata(); endif; } /** * Fires after redering single template. * * @since 1.0 */ do_action( 'alpus_after_template' ); } get_footer();