Changeset 3297135
- Timestamp:
- 05/20/2025 09:12:57 AM (11 months ago)
- Location:
- wpshare247-elementor-addons/trunk
- Files:
-
- 5 edited
-
assets/css/styles.css (modified) (1 diff)
-
inc/helper.php (modified) (2 diffs)
-
includes/widgets/wpshare247_posts_widget.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
wpshare247-elementor-addon.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wpshare247-elementor-addons/trunk/assets/css/styles.css
r2856412 r3297135 1 1 .elementor-section .elementor-container.wpshare247-flex-wrap{ 2 2 flex-wrap: wrap; 3 } 4 .elementor-container.wpshare247-flex-wrap{ 5 display: flex; 6 flex-wrap: wrap; 3 7 } 4 8 -
wpshare247-elementor-addons/trunk/inc/helper.php
r3297038 r3297135 11 11 12 12 static function get_public_post_type(){ 13 $args = []; 13 14 $objects = get_post_types( $args, 'objects' ); 14 15 if(!$objects) return array(); … … 32 33 $arr_labels = $object->labels; 33 34 $arr[$type] = esc_html__( $arr_labels->singular_name, 'wpshare247-elementor-addon' ); 35 } 36 return $arr; 37 } 38 } 39 40 41 static function get_public_terms_by_post_type(){ 42 $post_types = self::get_public_post_type(); 43 $arr = []; 44 if($post_types){ 45 foreach( $post_types as $post_type => $object ) { 46 $taxonomies = get_object_taxonomies($post_type, 'objects'); 47 if (!empty($taxonomies)) { 48 foreach ($taxonomies as $taxonomy_slug => $taxonomy_obj) { 49 $arr[$taxonomy_slug] = $taxonomy_obj->labels->name; 50 } 51 } 52 } 53 } 54 return $arr; 55 } 56 57 static function get_terms_options(){ 58 $arr = self::get_public_terms_by_post_type(); 59 if(empty($arr)){ 60 $arr[''] = esc_html__( 'Not found', 'wpshare247-elementor-addon' ); 61 return $arr; 62 }else{ 63 foreach( $arr as $post_type => $tax_slug ) { 64 $arr[$tax_slug] = esc_html__( $tax_slug, 'wpshare247-elementor-addon' ); 34 65 } 35 66 return $arr; -
wpshare247-elementor-addons/trunk/includes/widgets/wpshare247_posts_widget.php
r3297038 r3297135 31 31 'default' => 'post', 32 32 'options' => Ws247_EA_Helper::get_post_type_options() 33 ] 34 ); 35 36 /* 37 $this->add_control( 38 'post_type_term', 39 [ 40 'label' => esc_html__( 'Terms', 'elementor' ), 41 'type' => \Elementor\Controls_Manager::SELECT, 42 'default' => '', 43 'options' => Ws247_EA_Helper::get_terms_options() 44 ] 45 ); 46 */ 47 48 $this->add_control( 49 'post_type_category', 50 [ 51 'label' => esc_html__( 'Categories', 'elementor' ), 52 'show_label' => true, 53 'type' => \Elementor\Controls_Manager::SELECT2, 54 'label_block' => true, 55 'multiple' => true, 56 'options' => Ws247_EA_Helper::get_term_options('category'), 57 'default' => [], 58 'condition' => [ 59 'post_type' => 'post', 60 ], 61 ] 62 ); 63 64 $this->add_control( 65 'post_type_tags', 66 [ 67 'label' => esc_html__( 'Tag', 'elementor' ), 68 'show_label' => true, 69 'type' => \Elementor\Controls_Manager::SELECT2, 70 'label_block' => true, 71 'multiple' => true, 72 'options' => Ws247_EA_Helper::get_term_options('post_tag'), 73 'default' => [], 74 'condition' => [ 75 'post_type' => 'post', 76 ], 33 77 ] 34 78 ); … … 1138 1182 $settings = $this->get_settings_for_display(); 1139 1183 1140 $post_type = $settings['post_type']; 1184 $post_type = $settings['post_type']; 1141 1185 $post_per_page = $settings['post_per_page']; 1142 1186 $slider_on = ($settings['slider_on']==='yes') ? true : false; … … 1152 1196 'order' => $order 1153 1197 ); 1198 1199 1200 if ( $post_type === 'post' ) { 1201 $post_type_category = $settings['post_type_category']; 1202 $post_type_tags = $settings['post_type_tags']; 1203 1204 $tax_query = array('relation' => 'AND'); 1205 1206 if ( !empty($post_type_category) ) { 1207 $tax_query[] = array( 1208 'taxonomy' => 'category', 1209 'field' => 'slug', 1210 'terms' => $post_type_category, 1211 ); 1212 } 1213 1214 if ( !empty($post_type_tags) ) { 1215 $tax_query[] = array( 1216 'taxonomy' => 'post_tag', 1217 'field' => 'slug', 1218 'terms' => $post_type_tags, 1219 ); 1220 } 1221 1222 if ( count($tax_query) > 1 ) { 1223 $args_filter['tax_query'] = $tax_query; 1224 } 1225 } 1226 1227 1154 1228 $the_query = new WP_query($args_filter); 1155 1229 -
wpshare247-elementor-addons/trunk/readme.txt
r3297048 r3297135 6 6 Tested up to: 6.6.1 7 7 Requires PHP: 7.0 8 Stable tag: 2. 38 Stable tag: 2.4 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 96 96 * Fix: Missing file 2.2 97 97 98 = 2.4 = 99 * Filter post by category, tags 100 * Fix css: wpshare247-flex-wrap, display: flex; 101 98 102 99 103 == Upgrade Notice == -
wpshare247-elementor-addons/trunk/wpshare247-elementor-addon.php
r3297048 r3297135 4 4 * Plugin URI: https://wpshare247.com/ 5 5 * Description: Widgets (Wpshare247 Addons) for Elementor. Wpshare247 Addons for Elementor plugin includes widgets and addons like Blog Post, Products, Post, Page and Custom Post Type Grid or Carousel, Countdown, Contact Form 7, WooCommerce Product Price. 6 * Version: 2. 36 * Version: 2.4 7 7 * Author: Wpshare247.com 8 8 * Author URI: https://wpshare247.com/chuyen-muc/elementor
Note: See TracChangeset
for help on using the changeset viewer.