public function result_page() {
if ( ! empty( $_POST['wpf_ct'] ) ) {
$option = WPF_Options_CT::get_option( $this->plugin_name, $this->version );
$forms = $option->get();
if ( !empty( $forms[ $_REQUEST['wpf_ct'] ] ) ) {
self::$result_page = WPF_Utils_CT::get_current_page();
$data = $forms[ $_REQUEST['wpf_ct'] ]['data'];
if ( ( !empty( $data['result_type'] ) && $data['result_type'] === 'same_page' ) || self::$result_page == $data['page'] ) {
self::load_wc_scripts();
add_filter( 'body_class', array( $this, 'body_class' ), 10, 1 );
self::$result = $this->get_result( $_REQUEST, $forms[ $_REQUEST['wpf_ct'] ] );
if ( is_singular( 'product' ) ) {
add_filter( 'wc_get_template', array( $this, 'filter_not_found' ), 30, 5 );
} elseif ( is_woocommerce() ) {
global $wp_query;
$this->post_count = $wp_query->post_count;
$wp_query->post_count = 0;
add_action( 'woocommerce_after_main_content', array( $this, 'refresh_post_count' ), 1 );
add_filter( 'wc_get_template', array( $this, 'filter_not_found' ), 30, 5 );
}
}
}
}
if ( is_woocommerce() ) {
add_action( 'woocommerce_before_main_content', array( $this, 'result_container' ), 100 );
add_action( 'woocommerce_after_main_content', array( $this, 'close_div' ), 1 );
}
}