← All changes
|
app/Controllers/ThemesSupport/Astra/ThemeSupport.php
+57
-67
2.1.11
→
1.1.4
View file →
| @@ -1,67 +1,57 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Main AstraSupport class Only Work for astra theme. | |
| 5 | - * | |
| 6 | - * @package RadiusTheme\SB | |
| 7 | - */ | |
| 8 | - | |
| 9 | -namespace RadiusTheme\SB\Controllers\ThemesSupport\Astra; | |
| 10 | - | |
| 11 | -use Astra_Woocommerce; | |
| 12 | -use RadiusTheme\SB\Helpers\BuilderFns; | |
| 13 | -use RadiusTheme\SB\Traits\SingletonTrait; | |
| 14 | - | |
| 15 | -// Do not allow directly accessing this file. | |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 17 | - exit( 'This script cannot be accessed directly.' ); | |
| 18 | -} | |
| 19 | - | |
| 20 | -/** | |
| 21 | - * Product Description class | |
| 22 | - */ | |
| 23 | -class ThemeSupport { | |
| 24 | - /** | |
| 25 | - * Singleton | |
| 26 | - */ | |
| 27 | - use SingletonTrait; | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * Construct function | |
| 31 | - */ | |
| 32 | - private function __construct() { | |
| 33 | - add_filter( 'astra_dynamic_post_structure_posttypes', [ __CLASS__, 'astra_post_types' ], 15 ); | |
| 34 | - add_filter( 'rtsb/elementor/archive/products_per_page', [ __CLASS__, 'astra_products_per_page' ] ); | |
| 35 | - remove_filter( 'woocommerce_get_stock_html', 'astra_woo_product_in_stock' ); | |
| 36 | - } | |
| 37 | - /** | |
| 38 | - * Get class instance. | |
| 39 | - * | |
| 40 | - * @return object Instance. | |
| 41 | - */ | |
| 42 | - public static function init() { | |
| 43 | - if ( ! self::$instance ) { | |
| 44 | - self::$instance = new self(); | |
| 45 | - } | |
| 46 | - return self::$instance; | |
| 47 | - } | |
| 48 | - | |
| 49 | - public static function astra_post_types( $post_types ) { | |
| 50 | - $position = array_search( 'rtsb_builder', $post_types ); | |
| 51 | - unset( $post_types[ $position ] ); | |
| 52 | - return $post_types; | |
| 53 | - } | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * Astra products per page. | |
| 57 | - * | |
| 58 | - * @return int | |
| 59 | - */ | |
| 60 | - public static function astra_products_per_page() { | |
| 61 | - if ( function_exists( 'astra_get_option' ) ) { | |
| 62 | - $per_page = astra_get_option( 'shop-no-of-products' ); | |
| 63 | - | |
| 64 | - return ! empty( $per_page ) ? absint( $per_page ) : 12; | |
| 65 | - } | |
| 66 | - } | |
| 67 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Main AstraSupport class Only Work for astra theme. | |
| 5 | + * | |
| 6 | + * @package RadiusTheme\SB | |
| 7 | + */ | |
| 8 | + | |
| 9 | +namespace RadiusTheme\SB\Controllers\ThemesSupport\Astra; | |
| 10 | + | |
| 11 | +use Astra_Woocommerce; | |
| 12 | +use RadiusTheme\SB\Helpers\BuilderFns; | |
| 13 | +use RadiusTheme\SB\Traits\SingletonTrait; | |
| 14 | + | |
| 15 | +// Do not allow directly accessing this file. | |
| 16 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 17 | + exit( 'This script cannot be accessed directly.' ); | |
| 18 | +} | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * Product Description class | |
| 22 | + */ | |
| 23 | +class ThemeSupport { | |
| 24 | + /** | |
| 25 | + * Singleton | |
| 26 | + */ | |
| 27 | + use SingletonTrait; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * Construct function | |
| 31 | + */ | |
| 32 | + private function __construct() { | |
| 33 | + | |
| 34 | + add_filter('astra_dynamic_post_structure_posttypes',[__CLASS__,'astra_post_types'],15); | |
| 35 | + | |
| 36 | + } | |
| 37 | + /** | |
| 38 | + * Get class instance. | |
| 39 | + * | |
| 40 | + * @return object Instance. | |
| 41 | + */ | |
| 42 | + public static function init() { | |
| 43 | + if ( ! self::$instance ) { | |
| 44 | + self::$instance = new self(); | |
| 45 | + } | |
| 46 | + return self::$instance; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public static function astra_post_types( $post_types ) | |
| 50 | + { | |
| 51 | + $position = array_search('rtsb_builder', $post_types ); | |
| 52 | + unset( $post_types[$position] ); | |
| 53 | + return $post_types; | |
| 54 | + } | |
| 55 | + | |
| 56 | + | |
| 57 | +} | |