| @@ -6,13 +6,12 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace RadiusTheme\SB\Controllers\Hooks; |
| 9 | 9 | |
| 10 | +use RadiusTheme\SB\Elementor\Render\Render; | |
| 10 | 11 | use RadiusTheme\SB\Helpers\Fns; |
| 11 | 12 | use RadiusTheme\SB\Models\GeneralList; |
| 12 | 13 | use RadiusTheme\SB\Helpers\BuilderFns; |
| 13 | -use RadiusTheme\SB\Models\TemplateSettings; | |
| 14 | -use RadiusTheme\SB\Elementor\Render\WCRender; | |
| 15 | 14 | |
| 16 | 15 | defined( 'ABSPATH' ) || exit(); |
| 17 | 16 | |
| 18 | 17 | /** |
| @@ -35,57 +34,10 @@ | ||
| 35 | 34 | function () { |
| 36 | 35 | remove_post_type_support( BuilderFns::$post_type_tb, 'revisions' ); |
| 37 | 36 | } |
| 38 | 37 | ); |
| 39 | - add_action( 'deleted_post', [ __CLASS__, 'deleted_post' ], 10, 2 ); | |
| 40 | - add_action( 'rtsb/elements/render/before_query', [ __CLASS__, 'modify_wc_query_args' ] ); | |
| 41 | - add_action( 'rtsb/elements/render/after_query', [ __CLASS__, 'reset_wc_query_args' ] ); | |
| 42 | 38 | } |
| 43 | - /** | |
| 44 | - * Meta tags for social sharing. | |
| 45 | - * | |
| 46 | - * @return void | |
| 47 | - */ | |
| 48 | - public static function deleted_post( $post_id, $post ) { | |
| 49 | - if ( BuilderFns::$post_type_tb !== $post->post_type ) { | |
| 50 | - return; | |
| 51 | - } | |
| 52 | - $options = BuilderFns::option_name_for_specific_product_set_default( $post_id ); | |
| 53 | 39 | |
| 54 | - if ( TemplateSettings::instance()->get_option( $options ) ) { | |
| 55 | - TemplateSettings::instance()->delete_option( $options ); | |
| 56 | - } | |
| 57 | - | |
| 58 | - $template_options = BuilderFns::option_name_by_template_id( $post_id ); | |
| 59 | - if ( TemplateSettings::instance()->get_option( $template_options ) ) { | |
| 60 | - TemplateSettings::instance()->delete_option( $template_options ); | |
| 61 | - } | |
| 62 | - | |
| 63 | - $archive_options = BuilderFns::archive_option_name_by_template_id( $post_id ); | |
| 64 | - if ( TemplateSettings::instance()->get_option( $archive_options ) ) { | |
| 65 | - TemplateSettings::instance()->delete_option( $archive_options ); | |
| 66 | - } | |
| 67 | - | |
| 68 | - $category_options = BuilderFns::option_name_for_specific_category_set_default( $post_id ); | |
| 69 | - if ( TemplateSettings::instance()->get_option( $category_options ) ) { | |
| 70 | - TemplateSettings::instance()->delete_option( $category_options ); | |
| 71 | - } | |
| 72 | - | |
| 73 | - $selected_category_options = BuilderFns::archive_option_name_by_template_id( $post_id ); | |
| 74 | - if ( TemplateSettings::instance()->get_option( $selected_category_options ) ) { | |
| 75 | - TemplateSettings::instance()->delete_option( $selected_category_options ); | |
| 76 | - } | |
| 77 | - | |
| 78 | - global $wpdb; | |
| 79 | - // Prepare and execute the SQL query. | |
| 80 | - $sql = $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %d", BuilderFns::$view_template_for_products_meta, $post_id ); | |
| 81 | - $wpdb->query( $sql ); | |
| 82 | - | |
| 83 | - // Prepare and execute the SQL query. | |
| 84 | - $sql = $wpdb->prepare( "DELETE FROM $wpdb->termmeta WHERE meta_key = %s AND meta_value = %d", BuilderFns::$view_template_for_archive_meta, $post_id ); | |
| 85 | - $wpdb->query( $sql ); | |
| 86 | - | |
| 87 | - } | |
| 88 | 40 | /** |
| 89 | 41 | * Meta tags for social sharing. |
| 90 | 42 | * |
| 91 | 43 | * @return void |
| @@ -114,9 +66,9 @@ | ||
| 114 | 66 | $settings['layout'] = ! empty( $generalList['social_share']['share_icon_layout'] ) ? $generalList['social_share']['share_icon_layout'] : 1; |
| 115 | 67 | $settings['show_share_icon'] = 1; |
| 116 | 68 | |
| 117 | 69 | // TODO:: Implement Later ! empty( $generalList['social_share']['share_icon_show_to_product_page'] ) && 'on' === $generalList['social_share']['share_icon_show_to_product_page']; |
| 118 | - Fns::print_html( WCRender::instance()->social_share_view( 'elementor/general/social-share', $settings ), true ); | |
| 70 | + Fns::print_html( Render::instance()->social_share_view( 'elementor/general/social-share', $settings ), true ); | |
| 119 | 71 | } |
| 120 | 72 | |
| 121 | 73 | /** |
| 122 | 74 | * Meta tags for social sharing. |
| @@ -175,35 +127,7 @@ | ||
| 175 | 127 | } else { |
| 176 | 128 | echo '<figure class="rtsb-img-link">'; |
| 177 | 129 | Fns::get_product_image( $args['img_html'], $args['hover_img_html'] ); |
| 178 | 130 | echo '</figure>'; |
| 179 | - } | |
| 180 | - } | |
| 181 | - | |
| 182 | - /** | |
| 183 | - * Modify WooCommerce query arguments for product retrieval. | |
| 184 | - * | |
| 185 | - * @param array $settings The settings array. | |
| 186 | - * | |
| 187 | - * @return void | |
| 188 | - */ | |
| 189 | - public static function modify_wc_query_args( $settings ) { | |
| 190 | - if ( ( isset( $settings['tax_relation'] ) && 'OR' === $settings['tax_relation'] ) || | |
| 191 | - ( isset( $settings['relation'] ) && 'OR' === $settings['relation'] ) ) { | |
| 192 | - add_filter( 'woocommerce_product_data_store_cpt_get_products_query', [ FilterHooks::class, 'extra_query_args' ], 10, 2 ); | |
| 193 | - } | |
| 194 | - } | |
| 195 | - | |
| 196 | - /** | |
| 197 | - * Reset WooCommerce query arguments for product retrieval. | |
| 198 | - * | |
| 199 | - * @param array $settings The settings array. | |
| 200 | - * | |
| 201 | - * @return void | |
| 202 | - */ | |
| 203 | - public static function reset_wc_query_args( $settings ) { | |
| 204 | - if ( ( isset( $settings['tax_relation'] ) && 'OR' === $settings['tax_relation'] ) || | |
| 205 | - ( isset( $settings['relation'] ) && 'OR' === $settings['relation'] ) ) { | |
| 206 | - remove_filter( 'woocommerce_product_data_store_cpt_get_products_query', [ FilterHooks::class, 'extra_query_args' ] ); | |
| 207 | 131 | } |
| 208 | 132 | } |
| 209 | 133 | } |