| @@ -1,7 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace UiCoreElements\Utils; |
| 4 | + | |
| 3 | 5 | use Elementor\Controls_Manager; |
| 6 | +use Elementor\Icons_Manager; | |
| 4 | 7 | use Elementor\Plugin; |
| 5 | 8 | |
| 6 | 9 | use UiCoreElements\Helper; |
| 7 | 10 | use UiCoreElements\Controls\Query; |
| @@ -21,9 +24,10 @@ | ||
| 21 | 24 | * |
| 22 | 25 | * @since 1.0.4 |
| 23 | 26 | */ |
| 24 | 27 | |
| 25 | -trait Post_Trait { | |
| 28 | +trait Post_Trait | |
| 29 | +{ | |
| 26 | 30 | |
| 27 | 31 | use Button_Trait, |
| 28 | 32 | Meta_Trait; |
| 29 | 33 | |
| @@ -29,9 +33,9 @@ | ||
| 29 | 33 | |
| 30 | 34 | // Control Register Content functions |
| 31 | 35 | function TRAIT_register_post_item_controls($section = true) |
| 32 | 36 | { |
| 33 | - if($section) { | |
| 37 | + if ($section) { | |
| 34 | 38 | $this->start_controls_section( |
| 35 | 39 | 'section_item_content', |
| 36 | 40 | [ |
| 37 | 41 | 'label' => esc_html__('Item', 'uicore-elements'), |
| @@ -37,114 +41,129 @@ | ||
| 37 | 41 | 'label' => esc_html__('Item', 'uicore-elements'), |
| 38 | 42 | ] |
| 39 | 43 | ); |
| 40 | 44 | } |
| 41 | - $this->add_control( | |
| 42 | - 'box_style', | |
| 43 | - [ | |
| 44 | - 'label' => __('Item Style', 'uicore-elements'), | |
| 45 | - 'type' => Controls_Manager::SELECT, | |
| 46 | - 'default' => 'classic', | |
| 47 | - 'options' => [ | |
| 48 | - 'classic' => __('Classic', 'uicore-elements'), | |
| 49 | - 'split' => __('Split', 'uicore-elements'), | |
| 50 | - 'overlay' => __('Overlay', 'uicore-elements'), | |
| 51 | - ], | |
| 52 | - 'render_type' => 'template', | |
| 53 | - 'prefix_class' => 'ui-e-apg-', | |
| 45 | + $this->add_control( | |
| 46 | + 'box_style', | |
| 47 | + [ | |
| 48 | + 'label' => __('Item Style', 'uicore-elements'), | |
| 49 | + 'type' => Controls_Manager::SELECT, | |
| 50 | + 'default' => 'classic', | |
| 51 | + 'options' => [ | |
| 52 | + 'classic' => __('Classic', 'uicore-elements'), | |
| 53 | + 'split' => __('Split', 'uicore-elements'), | |
| 54 | + 'overlay' => __('Overlay', 'uicore-elements'), | |
| 55 | + ], | |
| 56 | + 'render_type' => 'template', | |
| 57 | + 'prefix_class' => 'ui-e-apg-', | |
| 58 | + ] | |
| 59 | + ); | |
| 60 | + $this->add_control( | |
| 61 | + 'split_mobile', | |
| 62 | + [ | |
| 63 | + 'label' => __('Use Classic Layout on Mobile' . UICORE_ELEMENTS_NEW_OPTION, 'uicore-elements'), // TODO: remove badge, at least 2, releases after 1.3.15 | |
| 64 | + 'type' => Controls_Manager::SWITCHER, | |
| 65 | + 'default' => 'ui-e-apg-split-not-phone', | |
| 66 | + 'return_value' => 'ui-e-apg-split-not-phone', | |
| 67 | + 'prefix_class' => '', | |
| 68 | + 'condition' => [ | |
| 69 | + 'box_style' => 'split', | |
| 70 | + ], | |
| 71 | + ] | |
| 72 | + ); | |
| 73 | + $this->add_control( | |
| 74 | + 'image', | |
| 75 | + [ | |
| 76 | + 'label' => __('Image', 'uicore-elements'), | |
| 77 | + 'type' => Controls_Manager::SWITCHER, | |
| 78 | + 'separator' => 'before', | |
| 79 | + 'default' => 'yes' | |
| 80 | + ] | |
| 81 | + ); | |
| 82 | + $this->add_control( | |
| 83 | + 'image_size_select', | |
| 84 | + [ | |
| 85 | + 'label' => __('Image Size', 'uicore-elements'), | |
| 86 | + 'type' => Controls_Manager::SELECT, | |
| 87 | + 'default' => 'uicore-medium', | |
| 88 | + 'options' => Helper::get_images_sizes(), | |
| 89 | + 'separator' => 'after', | |
| 90 | + 'condition' => [ | |
| 91 | + 'image' => 'yes', | |
| 54 | 92 | ] |
| 55 | - ); | |
| 56 | - $this->add_control( | |
| 57 | - 'image', | |
| 58 | - [ | |
| 59 | - 'label' => __('Image', 'uicore-elements'), | |
| 60 | - 'type' => Controls_Manager::SWITCHER, | |
| 61 | - 'separator' => 'before', | |
| 62 | - 'default' => 'yes' | |
| 93 | + ] | |
| 94 | + ); | |
| 95 | + $this->add_control( | |
| 96 | + 'title', | |
| 97 | + [ | |
| 98 | + 'label' => __('Title', 'uicore-elements'), | |
| 99 | + 'type' => Controls_Manager::SWITCHER, | |
| 100 | + 'default' => 'yes' | |
| 101 | + ] | |
| 102 | + ); | |
| 103 | + $this->add_control( | |
| 104 | + 'title_tag', | |
| 105 | + [ | |
| 106 | + 'label' => __('HTML Tag', 'uicore-elements'), | |
| 107 | + 'type' => Controls_Manager::SELECT, | |
| 108 | + 'default' => 'h4', | |
| 109 | + 'options' => Helper::get_title_tags(), | |
| 110 | + 'separator' => 'after', | |
| 111 | + 'condition' => [ | |
| 112 | + 'title' => 'yes', | |
| 63 | 113 | ] |
| 64 | - ); | |
| 65 | - $this->add_control( | |
| 66 | - 'image_size_select', | |
| 67 | - [ | |
| 68 | - 'label' => __('Image Size', 'uicore-elements'), | |
| 69 | - 'type' => Controls_Manager::SELECT, | |
| 70 | - 'default' => 'uicore-medium', | |
| 71 | - 'options' => Helper::get_images_sizes(), | |
| 72 | - 'condition' => [ | |
| 73 | - 'image' => 'yes', | |
| 74 | - ] | |
| 114 | + ] | |
| 115 | + ); | |
| 116 | + $this->add_control( | |
| 117 | + 'excerpt', | |
| 118 | + [ | |
| 119 | + 'label' => __('Excerpt', 'uicore-elements'), | |
| 120 | + 'type' => Controls_Manager::SWITCHER, | |
| 121 | + 'default' => 'yes' | |
| 122 | + ] | |
| 123 | + ); | |
| 124 | + $this->add_control( | |
| 125 | + 'excerpt_trim', | |
| 126 | + [ | |
| 127 | + 'label' => __('Excerpt Length (words)', 'uicore-elements'), | |
| 128 | + 'type' => Controls_Manager::NUMBER, | |
| 129 | + 'min' => 5, | |
| 130 | + 'max' => 100, | |
| 131 | + 'step' => 1, | |
| 132 | + 'default' => 55, | |
| 133 | + 'separator' => 'after', | |
| 134 | + 'condition' => array( | |
| 135 | + 'excerpt' => 'yes', | |
| 136 | + ), | |
| 137 | + ] | |
| 138 | + ); | |
| 139 | + $this->add_control( | |
| 140 | + 'show_button', | |
| 141 | + [ | |
| 142 | + 'label' => __('Read More Button', 'uicore-elements'), | |
| 143 | + 'type' => Controls_Manager::SWITCHER, | |
| 144 | + 'default' => 'no' | |
| 145 | + ] | |
| 146 | + ); | |
| 147 | + $this->add_control( | |
| 148 | + 'global_link', | |
| 149 | + [ | |
| 150 | + 'label' => __('Global Wrapper Link', 'uicore-elements'), | |
| 151 | + 'type' => Controls_Manager::SWITCHER, | |
| 152 | + 'default' => 'no', | |
| 153 | + 'condition' => [ | |
| 154 | + 'box_style' => 'overlay' | |
| 75 | 155 | ] |
| 76 | - ); | |
| 77 | - // $this->add_control('cat_type',[ | |
| 78 | - // 'label' => __( 'Cat Type', 'uicore-elements' ), | |
| 79 | - // 'type' => Controls_Manager::SELECT, | |
| 80 | - // 'default' => 'category', | |
| 81 | - // 'options' => [ | |
| 82 | - // 'category' => __( 'Category', 'uicore-elements' ), | |
| 83 | - // 'custom' => __( 'Custom Taxonomy', 'uicore-elements' ), | |
| 84 | - // ], | |
| 85 | - // 'condition' => array( | |
| 86 | - // 'category' => 'yes', | |
| 87 | - // ), | |
| 88 | - // ] | |
| 89 | - // ); | |
| 90 | - // $this->add_control('cat_type_name',[ | |
| 91 | - // 'label' => __( 'Taxonomy', 'uicore-elements' ), | |
| 92 | - // 'type' => Controls_Manager::TEXT, | |
| 93 | - // 'placeholder' => __( 'my_custom_tax', 'uicore-elements' ), | |
| 94 | - // 'condition' => array( | |
| 95 | - // 'cat_type' => 'custom', | |
| 96 | - // ), | |
| 97 | - // ] | |
| 98 | - // ); | |
| 99 | - $this->add_control( | |
| 100 | - 'title', | |
| 101 | - [ | |
| 102 | - 'label' => __('Title', 'uicore-elements'), | |
| 103 | - 'type' => Controls_Manager::SWITCHER, | |
| 104 | - 'separator' => 'before', | |
| 105 | - 'default' => 'yes' | |
| 106 | - ] | |
| 107 | - ); | |
| 108 | - $this->add_control( | |
| 109 | - 'excerpt', | |
| 110 | - [ | |
| 111 | - 'label' => __('Excerpt', 'uicore-elements'), | |
| 112 | - 'type' => Controls_Manager::SWITCHER, | |
| 113 | - 'separator' => 'before', | |
| 114 | - 'default' => 'yes' | |
| 115 | - ] | |
| 116 | - ); | |
| 117 | - $this->add_control( | |
| 118 | - 'excerpt_trim', | |
| 119 | - [ | |
| 120 | - 'label' => __('Excerpt Length (words)', 'uicore-elements'), | |
| 121 | - 'type' => Controls_Manager::NUMBER, | |
| 122 | - 'min' => 5, | |
| 123 | - 'max' => 100, | |
| 124 | - 'step' => 1, | |
| 125 | - 'default' => 55, | |
| 126 | - 'condition' => array( | |
| 127 | - 'excerpt' => 'yes', | |
| 128 | - ), | |
| 129 | - ] | |
| 130 | - ); | |
| 131 | - $this->add_control( | |
| 132 | - 'show_button', | |
| 133 | - [ | |
| 134 | - 'label' => __('Read More Button', 'uicore-elements'), | |
| 135 | - 'type' => Controls_Manager::SWITCHER, | |
| 136 | - 'separator' => 'before', | |
| 137 | - 'default' => 'no' | |
| 138 | - ] | |
| 139 | - ); | |
| 140 | - if($section) { | |
| 156 | + ] | |
| 157 | + ); | |
| 158 | + | |
| 159 | + if ($section) { | |
| 141 | 160 | $this->end_controls_section(); |
| 142 | 161 | } |
| 143 | 162 | } |
| 144 | 163 | function TRAIT_register_post_button_controls($section = true) |
| 145 | 164 | { |
| 146 | - if($section){ | |
| 165 | + if ($section) { | |
| 147 | 166 | $this->start_controls_section( |
| 148 | 167 | 'section_button_content', |
| 149 | 168 | [ |
| 150 | 169 | 'label' => esc_html__('Button', 'uicore-elements'), |
| @@ -154,29 +173,35 @@ | ||
| 154 | 173 | ] |
| 155 | 174 | ); |
| 156 | 175 | } |
| 157 | 176 | |
| 158 | - $this->register_button_content_controls( | |
| 159 | - [ | |
| 160 | - 'section_condition' => [ | |
| 161 | - 'show_button' => 'yes' | |
| 162 | - ], | |
| 163 | - 'button_default_text' => 'Read More' | |
| 164 | - ] | |
| 165 | - ); | |
| 166 | - $this->remove_control('button_type'); | |
| 167 | - $this->remove_control('link'); | |
| 168 | - $this->remove_control('button_css_id'); | |
| 169 | - $this->remove_control('size'); | |
| 170 | - $this->remove_control('align'); | |
| 177 | + $this->register_button_content_controls( | |
| 178 | + [ | |
| 179 | + 'section_condition' => [ | |
| 180 | + 'show_button' => 'yes' | |
| 181 | + ], | |
| 182 | + 'button_default_text' => 'Read More' | |
| 183 | + ] | |
| 184 | + ); | |
| 185 | + $this->remove_control('button_type'); | |
| 186 | + $this->remove_control('link'); | |
| 187 | + $this->remove_control('button_css_id'); | |
| 188 | + $this->remove_control('size'); | |
| 189 | + $this->remove_control('align'); | |
| 171 | 190 | |
| 172 | - if($section){ | |
| 191 | + if ($section) { | |
| 173 | 192 | $this->end_controls_section(); |
| 174 | 193 | } |
| 175 | 194 | } |
| 176 | - function TRAIT_register_post_meta_controls($section = true) | |
| 195 | + /** | |
| 196 | + * Register Post Meta Controls. | |
| 197 | + * | |
| 198 | + * @param bool $section. Print section or not. | |
| 199 | + * @param bool $product_metas. If true, will only print options that relates with products. | |
| 200 | + */ | |
| 201 | + function TRAIT_register_post_meta_controls($section = true, $product_metas = false) | |
| 177 | 202 | { |
| 178 | - if($section){ | |
| 203 | + if ($section) { | |
| 179 | 204 | $this->start_controls_section( |
| 180 | 205 | 'section_extra_item_content', |
| 181 | 206 | [ |
| 182 | 207 | 'label' => esc_html__('Meta', 'uicore-elements'), |
| @@ -183,79 +208,85 @@ | ||
| 183 | 208 | ] |
| 184 | 209 | ); |
| 185 | 210 | } |
| 186 | 211 | |
| 187 | - $this->add_control( | |
| 188 | - 'top_meta', | |
| 189 | - [ | |
| 190 | - 'label' => esc_html__('Top Meta', 'uicore-elements'), | |
| 191 | - 'type' => \Elementor\Controls_Manager::REPEATER, | |
| 192 | - 'fields' => $this->get_meta_content_controls(), | |
| 193 | - 'default' => [ | |
| 194 | - [ | |
| 195 | - 'type' => 'author' | |
| 196 | - ], | |
| 212 | + $this->add_control( | |
| 213 | + 'top_meta', | |
| 214 | + [ | |
| 215 | + 'label' => esc_html__('Top Meta', 'uicore-elements'), | |
| 216 | + 'type' => \Elementor\Controls_Manager::REPEATER, | |
| 217 | + 'fields' => $this->get_meta_content_controls($product_metas), | |
| 218 | + 'default' => [ | |
| 219 | + [ | |
| 220 | + 'type' => $product_metas ? 'product sale' : 'category' | |
| 197 | 221 | ], |
| 198 | - 'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>', | |
| 199 | - 'prevent_empty' => false, | |
| 200 | - 'separator' => 'before' | |
| 201 | - ] | |
| 202 | - ); | |
| 203 | - $this->add_control( | |
| 204 | - 'before_title_meta', | |
| 205 | - [ | |
| 206 | - 'label' => esc_html__('Before Title Meta', 'uicore-elements'), | |
| 207 | - 'type' => \Elementor\Controls_Manager::REPEATER, | |
| 208 | - 'fields' => $this->get_meta_content_controls(), | |
| 209 | - 'default' => [ | |
| 210 | - [ | |
| 211 | - 'type' => 'author' | |
| 212 | - ], | |
| 222 | + ], | |
| 223 | + 'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>', | |
| 224 | + 'prevent_empty' => false, | |
| 225 | + 'separator' => 'before' | |
| 226 | + ] | |
| 227 | + ); | |
| 228 | + $this->add_control( | |
| 229 | + 'before_title_meta', | |
| 230 | + [ | |
| 231 | + 'label' => esc_html__('Before Title Meta', 'uicore-elements'), | |
| 232 | + 'type' => \Elementor\Controls_Manager::REPEATER, | |
| 233 | + 'fields' => $this->get_meta_content_controls($product_metas), | |
| 234 | + 'default' => [ | |
| 235 | + [ | |
| 236 | + 'type' => $product_metas ? 'none' : 'author' | |
| 213 | 237 | ], |
| 214 | - 'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>', | |
| 215 | - 'prevent_empty' => false, | |
| 216 | - 'separator' => 'before', | |
| 217 | - ] | |
| 218 | - ); | |
| 219 | - $this->add_control( | |
| 220 | - 'after_title_meta', | |
| 221 | - [ | |
| 222 | - 'label' => esc_html__('After Title Meta', 'uicore-elements'), | |
| 223 | - 'type' => \Elementor\Controls_Manager::REPEATER, | |
| 224 | - 'fields' => $this->get_meta_content_controls(), | |
| 225 | - 'default' => [ | |
| 226 | - [ | |
| 227 | - 'type' => 'author' | |
| 228 | - ], | |
| 238 | + ], | |
| 239 | + 'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>', | |
| 240 | + 'prevent_empty' => false, | |
| 241 | + 'separator' => 'before', | |
| 242 | + ] | |
| 243 | + ); | |
| 244 | + $this->add_control( | |
| 245 | + 'after_title_meta', | |
| 246 | + [ | |
| 247 | + 'label' => esc_html__('After Title Meta', 'uicore-elements'), | |
| 248 | + 'type' => \Elementor\Controls_Manager::REPEATER, | |
| 249 | + 'fields' => $this->get_meta_content_controls($product_metas), | |
| 250 | + 'default' => [ | |
| 251 | + [ | |
| 252 | + 'type' => $product_metas ? 'product price' : 'date' | |
| 229 | 253 | ], |
| 230 | - 'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>', | |
| 231 | - 'prevent_empty' => false, | |
| 232 | - 'separator' => 'before', | |
| 233 | - ] | |
| 234 | - ); | |
| 235 | - $this->add_control( | |
| 236 | - 'bottom_meta', | |
| 237 | - [ | |
| 238 | - 'label' => esc_html__('Bottom Meta', 'uicore-elements'), | |
| 239 | - 'type' => \Elementor\Controls_Manager::REPEATER, | |
| 240 | - 'fields' => $this->get_meta_content_controls(), | |
| 241 | - 'default' => [ | |
| 242 | - [ | |
| 243 | - 'type' => 'author' | |
| 244 | - ], | |
| 254 | + ], | |
| 255 | + 'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>', | |
| 256 | + 'prevent_empty' => false, | |
| 257 | + 'separator' => 'before', | |
| 258 | + ] | |
| 259 | + ); | |
| 260 | + $this->add_control( | |
| 261 | + 'bottom_meta', | |
| 262 | + [ | |
| 263 | + 'label' => esc_html__('Bottom Meta', 'uicore-elements'), | |
| 264 | + 'type' => \Elementor\Controls_Manager::REPEATER, | |
| 265 | + 'fields' => $this->get_meta_content_controls($product_metas), | |
| 266 | + 'default' => [ | |
| 267 | + [ | |
| 268 | + 'type' => $product_metas ? 'none' : 'none' | |
| 245 | 269 | ], |
| 246 | - 'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>', | |
| 247 | - 'prevent_empty' => false, | |
| 248 | - 'separator' => 'before', | |
| 249 | - ] | |
| 250 | - ); | |
| 251 | - if($section){ | |
| 270 | + ], | |
| 271 | + 'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>', | |
| 272 | + 'prevent_empty' => false, | |
| 273 | + 'separator' => 'before', | |
| 274 | + ] | |
| 275 | + ); | |
| 276 | + if ($section) { | |
| 252 | 277 | $this->end_controls_section(); |
| 253 | 278 | } |
| 254 | 279 | } |
| 255 | 280 | function TRAIT_register_post_query_controls($section = true) |
| 256 | 281 | { |
| 257 | - if($section){ | |
| 282 | + | |
| 283 | + // In some contexts, such as theme-builder, our custom controls are not available | |
| 284 | + if (! class_exists('UiCoreElements\Controls\Post_Filter')) { | |
| 285 | + require_once UICORE_ELEMENTS_INCLUDES . '/controls/class-post-filter-control.php'; | |
| 286 | + } | |
| 287 | + | |
| 288 | + if ($section) { | |
| 258 | 289 | $this->start_controls_section( |
| 259 | 290 | 'section_post_grid_def', |
| 260 | 291 | [ |
| 261 | 292 | 'label' => esc_html__('Query', 'uicore-elements'), |
| @@ -262,95 +293,123 @@ | ||
| 262 | 293 | ] |
| 263 | 294 | ); |
| 264 | 295 | } |
| 265 | 296 | |
| 266 | - $this->add_group_control( | |
| 267 | - Post_Filter::get_type(), | |
| 268 | - [ | |
| 269 | - 'name' => 'posts-filter', | |
| 270 | - 'label' => esc_html__('Posts', 'uicore-elements'), | |
| 271 | - 'description' => esc_html__('Current Query Settings > Reading', 'uicore-elements'), | |
| 272 | - ] | |
| 273 | - ); | |
| 274 | - $this->add_control( | |
| 275 | - 'item_limit', | |
| 276 | - [ | |
| 277 | - 'label' => esc_html__('Item Limit', 'uicore-elements'), | |
| 278 | - 'type' => Controls_Manager::SLIDER, | |
| 279 | - 'reder_type' => 'template', | |
| 280 | - 'range' => [ | |
| 281 | - 'px' => [ | |
| 282 | - 'min' => -1, | |
| 283 | - 'max' => 100, | |
| 284 | - ], | |
| 297 | + $this->add_group_control( | |
| 298 | + Post_Filter::get_type(), | |
| 299 | + [ | |
| 300 | + 'name' => 'posts-filter', | |
| 301 | + 'label' => esc_html__('Posts', 'uicore-elements'), | |
| 302 | + 'description' => esc_html__('Current Query Settings > Reading', 'uicore-elements'), | |
| 303 | + ] | |
| 304 | + ); | |
| 305 | + $this->add_control( | |
| 306 | + 'item_order', | |
| 307 | + [ | |
| 308 | + 'label' => esc_html__('Item Order', 'uicore-elements'), | |
| 309 | + 'type' => Controls_Manager::SELECT, | |
| 310 | + 'options' => [ | |
| 311 | + 'ASC' => esc_html__('Ascending', 'uicore-elements'), | |
| 312 | + 'DESC' => esc_html__('Descending', 'uicore-elements'), | |
| 313 | + ], | |
| 314 | + 'default' => 'DESC', | |
| 315 | + ] | |
| 316 | + ); | |
| 317 | + $this->add_control( | |
| 318 | + 'item_order_by', | |
| 319 | + [ | |
| 320 | + 'label' => esc_html__('Item Order By', 'uicore-elements'), | |
| 321 | + 'type' => Controls_Manager::SELECT, | |
| 322 | + 'options' => [ | |
| 323 | + 'date' => esc_html__('Date', 'uicore-elements'), | |
| 324 | + 'modified' => esc_html__('Modified Date', 'uicore-elements'), | |
| 325 | + 'title' => esc_html__('Title', 'uicore-elements'), | |
| 326 | + 'rand' => esc_html__('Random', 'uicore-elements'), | |
| 327 | + 'comment_count' => esc_html__('Comments Count', 'uicore-elements'), | |
| 328 | + 'menu_order' => esc_html__('Menu Order', 'uicore-elements'), | |
| 329 | + ], | |
| 330 | + 'default' => 'date', | |
| 331 | + ] | |
| 332 | + ); | |
| 333 | + $this->add_control( | |
| 334 | + 'item_limit', | |
| 335 | + [ | |
| 336 | + 'label' => esc_html__('Item Limit', 'uicore-elements'), | |
| 337 | + 'type' => Controls_Manager::SLIDER, | |
| 338 | + 'reder_type' => 'template', | |
| 339 | + 'range' => [ | |
| 340 | + 'px' => [ | |
| 341 | + 'min' => -1, | |
| 342 | + 'max' => 100, | |
| 285 | 343 | ], |
| 286 | - 'default' => [ | |
| 287 | - 'size' => 3, | |
| 288 | - ], | |
| 289 | - 'condition' => array( | |
| 290 | - 'posts-filter_post_type!' => 'current', | |
| 291 | - ), | |
| 292 | - ] | |
| 293 | - ); | |
| 344 | + ], | |
| 345 | + 'default' => [ | |
| 346 | + 'size' => 3, | |
| 347 | + ], | |
| 348 | + 'condition' => array( | |
| 349 | + 'posts-filter_post_type!' => 'current', | |
| 350 | + ), | |
| 351 | + ] | |
| 352 | + ); | |
| 294 | 353 | |
| 295 | - $this->add_control( | |
| 296 | - 'offset', | |
| 297 | - [ | |
| 298 | - 'label' => esc_html__('Query Offset', 'uicore-elements'), | |
| 299 | - 'type' => Controls_Manager::SLIDER, | |
| 300 | - 'render_type' => 'template', | |
| 301 | - 'range' => [ | |
| 302 | - 'px' => [ | |
| 303 | - 'min' => -1, | |
| 304 | - 'max' => 10, | |
| 305 | - ], | |
| 354 | + $this->add_control( | |
| 355 | + 'offset', | |
| 356 | + [ | |
| 357 | + 'label' => esc_html__('Query Offset', 'uicore-elements'), | |
| 358 | + 'type' => Controls_Manager::SLIDER, | |
| 359 | + 'render_type' => 'template', | |
| 360 | + 'range' => [ | |
| 361 | + 'px' => [ | |
| 362 | + 'min' => -1, | |
| 363 | + 'max' => 10, | |
| 306 | 364 | ], |
| 307 | - 'default' => [ | |
| 308 | - 'size' => 0, | |
| 309 | - ], | |
| 310 | - 'condition' => [ | |
| 311 | - 'pagination_type' => 'numbers', | |
| 312 | - ] | |
| 365 | + ], | |
| 366 | + 'default' => [ | |
| 367 | + 'size' => 0, | |
| 368 | + ], | |
| 369 | + 'condition' => [ | |
| 370 | + 'pagination_type' => 'numbers', | |
| 313 | 371 | ] |
| 314 | - ); | |
| 372 | + ] | |
| 373 | + ); | |
| 315 | 374 | |
| 316 | - $this->add_control( | |
| 317 | - 'offset_alert', | |
| 318 | - [ | |
| 319 | - 'type' => Controls_Manager::ALERT, | |
| 320 | - 'alert_type' => 'info', | |
| 321 | - 'content' => esc_html__('Offset is disabled with Load More pagination.', 'uicore-elements'), | |
| 322 | - 'condition' => [ | |
| 323 | - 'pagination_type!' => 'numbers', | |
| 324 | - ] | |
| 375 | + $this->add_control( | |
| 376 | + 'offset_alert', | |
| 377 | + [ | |
| 378 | + 'type' => Controls_Manager::ALERT, | |
| 379 | + 'alert_type' => 'info', | |
| 380 | + 'content' => esc_html__('Offset is disabled with Load More pagination.', 'uicore-elements'), | |
| 381 | + 'condition' => [ | |
| 382 | + 'pagination_type!' => 'numbers', | |
| 325 | 383 | ] |
| 326 | - ); | |
| 384 | + ] | |
| 385 | + ); | |
| 327 | 386 | |
| 328 | - $this->add_control( | |
| 329 | - 'sticky', | |
| 330 | - [ | |
| 331 | - 'label' => esc_html__('Sticky Posts', 'uicore-elements'), | |
| 332 | - 'type' => \Elementor\Controls_Manager::SWITCHER, | |
| 333 | - 'label_on' => esc_html__('Show', 'uicore-elements'), | |
| 334 | - 'label_off' => esc_html__('Hide', 'uicore-elements'), | |
| 335 | - 'description' => esc_html__('Sticky posts works only on the front-end.', 'uicore-elements'), | |
| 336 | - 'return_value' => 1, | |
| 337 | - 'default' => 0, | |
| 338 | - 'condition' => array( | |
| 339 | - 'pagination!' => 'yes', | |
| 340 | - ), | |
| 341 | - ] | |
| 342 | - ); | |
| 387 | + $this->add_control( | |
| 388 | + 'sticky', | |
| 389 | + [ | |
| 390 | + 'label' => esc_html__('Sticky Posts', 'uicore-elements'), | |
| 391 | + 'type' => Controls_Manager::SWITCHER, | |
| 392 | + 'label_on' => esc_html__('Show', 'uicore-elements'), | |
| 393 | + 'label_off' => esc_html__('Hide', 'uicore-elements'), | |
| 394 | + 'description' => esc_html__('Sticky posts works only on the front-end.', 'uicore-elements'), | |
| 395 | + 'return_value' => 1, | |
| 396 | + 'default' => 0, | |
| 397 | + 'condition' => [ | |
| 398 | + 'pagination!' => 'yes', | |
| 399 | + ], | |
| 400 | + ] | |
| 401 | + ); | |
| 343 | 402 | |
| 344 | - if($section){ | |
| 403 | + if ($section) { | |
| 345 | 404 | $this->end_controls_section(); |
| 346 | 405 | } |
| 347 | 406 | } |
| 348 | 407 | |
| 349 | - // Styles | |
| 408 | + // Control Register Styles functions | |
| 350 | 409 | function TRAIT_register_post_item_style_controls($section = true, $active_tab = false) |
| 351 | 410 | { |
| 352 | - if($section){ | |
| 411 | + if ($section) { | |
| 353 | 412 | $this->start_controls_section( |
| 354 | 413 | 'section_style_item', |
| 355 | 414 | [ |
| 356 | 415 | 'label' => __('Item Style', 'uicore-elements'), |
| @@ -358,101 +417,132 @@ | ||
| 358 | 417 | ] |
| 359 | 418 | ); |
| 360 | 419 | } |
| 361 | 420 | |
| 362 | - $this->start_controls_tabs( | |
| 363 | - 'item_border_shadow' | |
| 364 | - ); | |
| 421 | + $this->start_controls_tabs( | |
| 422 | + 'item_border_shadow' | |
| 423 | + ); | |
| 365 | 424 | |
| 366 | - $this->start_controls_tab( | |
| 367 | - 'item_bs_normal_tab', | |
| 368 | - [ | |
| 369 | - 'label' => esc_html__('Normal', 'plugin-name'), | |
| 370 | - ] | |
| 371 | - ); | |
| 372 | - $this->add_group_control( | |
| 373 | - Group_Control_Border::get_type(), | |
| 374 | - [ | |
| 375 | - 'name' => 'item_border', | |
| 376 | - 'selector' => '{{WRAPPER}} .ui-e-item article', | |
| 377 | - ] | |
| 378 | - ); | |
| 379 | - $this->add_group_control( | |
| 380 | - Group_Control_Box_Shadow::get_type(), | |
| 381 | - [ | |
| 382 | - 'name' => 'item_shadow', | |
| 383 | - 'selector' => '{{WRAPPER}} .ui-e-item article', | |
| 384 | - ] | |
| 385 | - ); | |
| 386 | - $this->end_controls_tab(); | |
| 425 | + $this->start_controls_tab( | |
| 426 | + 'item_bs_normal_tab', | |
| 427 | + [ | |
| 428 | + 'label' => esc_html__('Normal', 'uicore-elements'), | |
| 429 | + ] | |
| 430 | + ); | |
| 431 | + $this->add_group_control( | |
| 432 | + Group_Control_Background::get_type(), | |
| 433 | + [ | |
| 434 | + 'name' => 'content_bg', | |
| 435 | + 'types' => ['classic', 'gradient'], | |
| 436 | + 'selector' => '{{WRAPPER}} .ui-e-item article', | |
| 437 | + ] | |
| 438 | + ); | |
| 439 | + $this->add_group_control( | |
| 440 | + Group_Control_Border::get_type(), | |
| 441 | + [ | |
| 442 | + 'name' => 'item_border', | |
| 443 | + 'selector' => '{{WRAPPER}} .ui-e-item article', | |
| 444 | + ] | |
| 445 | + ); | |
| 446 | + $this->add_group_control( | |
| 447 | + Group_Control_Box_Shadow::get_type(), | |
| 448 | + [ | |
| 449 | + 'name' => 'item_shadow', | |
| 450 | + 'selector' => '{{WRAPPER}} .ui-e-item article', | |
| 451 | + ] | |
| 452 | + ); | |
| 453 | + $this->end_controls_tab(); | |
| 387 | 454 | |
| 388 | - $this->start_controls_tab( | |
| 389 | - 'item_bs_hover_tab', | |
| 390 | - [ | |
| 391 | - 'label' => esc_html__('Hover', 'plugin-name'), | |
| 392 | - ] | |
| 393 | - ); | |
| 394 | - $this->add_group_control( | |
| 395 | - Group_Control_Border::get_type(), | |
| 396 | - [ | |
| 397 | - 'name' => 'item_border_hover', | |
| 398 | - 'selector' => '{{WRAPPER}} .ui-e-item:hover article', | |
| 399 | - ] | |
| 400 | - ); | |
| 401 | - $this->add_group_control( | |
| 402 | - Group_Control_Box_Shadow::get_type(), | |
| 403 | - [ | |
| 404 | - 'name' => 'item_shadow_hover', | |
| 405 | - 'selector' => '{{WRAPPER}} .ui-e-item:hover article', | |
| 406 | - ] | |
| 407 | - ); | |
| 408 | - $this->end_controls_tab(); | |
| 455 | + $this->start_controls_tab( | |
| 456 | + 'item_bs_hover_tab', | |
| 457 | + [ | |
| 458 | + 'label' => esc_html__('Hover', 'uicore-elements'), | |
| 459 | + ] | |
| 460 | + ); | |
| 461 | + $this->add_group_control( | |
| 462 | + Group_Control_Background::get_type(), | |
| 463 | + [ | |
| 464 | + 'name' => 'content_bg_hover', | |
| 465 | + 'types' => ['classic', 'gradient'], | |
| 466 | + 'selector' => '{{WRAPPER}} .ui-e-item:hover article', | |
| 467 | + ] | |
| 468 | + ); | |
| 469 | + $this->add_group_control( | |
| 470 | + Group_Control_Border::get_type(), | |
| 471 | + [ | |
| 472 | + 'name' => 'item_border_hover', | |
| 473 | + 'selector' => '{{WRAPPER}} .ui-e-item:hover article', | |
| 474 | + ] | |
| 475 | + ); | |
| 476 | + $this->add_group_control( | |
| 477 | + Group_Control_Box_Shadow::get_type(), | |
| 478 | + [ | |
| 479 | + 'name' => 'item_shadow_hover', | |
| 480 | + 'selector' => '{{WRAPPER}} .ui-e-item:hover article', | |
| 481 | + ] | |
| 482 | + ); | |
| 483 | + $this->end_controls_tab(); | |
| 409 | 484 | |
| 410 | - if($active_tab){ | |
| 411 | - $this->start_controls_tab( | |
| 412 | - 'item_bs_active_tab', | |
| 413 | - [ | |
| 414 | - 'label' => esc_html__('Active', 'plugin-name'), | |
| 415 | - ] | |
| 416 | - ); | |
| 417 | - $this->add_group_control( | |
| 418 | - Group_Control_Border::get_type(), | |
| 419 | - [ | |
| 420 | - 'name' => 'item_border_active', | |
| 421 | - 'selector' => '{{WRAPPER}} .ui-e-item.ui-e-active article', | |
| 422 | - ] | |
| 423 | - ); | |
| 424 | - $this->add_group_control( | |
| 425 | - Group_Control_Box_Shadow::get_type(), | |
| 426 | - [ | |
| 427 | - 'name' => 'item_shadow_active', | |
| 428 | - 'selector' => '{{WRAPPER}} .ui-e-item.ui-e-active article', | |
| 429 | - ] | |
| 430 | - ); | |
| 431 | - $this->end_controls_tab(); | |
| 432 | - } | |
| 433 | - | |
| 434 | - $this->end_controls_tabs(); | |
| 435 | - | |
| 436 | - $this->add_control( | |
| 437 | - 'item_radius', | |
| 485 | + if ($active_tab) { | |
| 486 | + $this->start_controls_tab( | |
| 487 | + 'item_bs_active_tab', | |
| 438 | 488 | [ |
| 439 | - 'label' => esc_html__('Border Radius', 'uicore-elements'), | |
| 440 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 441 | - 'separator' => 'before', | |
| 442 | - 'selectors' => [ | |
| 443 | - '{{WRAPPER}} ' => '--ui-e-border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;' | |
| 444 | - ], | |
| 489 | + 'label' => esc_html__('Active', 'uicore-elements'), | |
| 445 | 490 | ] |
| 446 | 491 | ); |
| 492 | + $this->add_group_control( | |
| 493 | + Group_Control_Border::get_type(), | |
| 494 | + [ | |
| 495 | + 'name' => 'item_border_active', | |
| 496 | + 'selector' => '{{WRAPPER}} .ui-e-item.ui-e-active article', | |
| 497 | + ] | |
| 498 | + ); | |
| 499 | + $this->add_group_control( | |
| 500 | + Group_Control_Box_Shadow::get_type(), | |
| 501 | + [ | |
| 502 | + 'name' => 'item_shadow_active', | |
| 503 | + 'selector' => '{{WRAPPER}} .ui-e-item.ui-e-active article', | |
| 504 | + ] | |
| 505 | + ); | |
| 506 | + $this->end_controls_tab(); | |
| 507 | + } | |
| 447 | 508 | |
| 448 | - if($section){ | |
| 509 | + $this->end_controls_tabs(); | |
| 510 | + | |
| 511 | + $this->add_control( | |
| 512 | + 'item_padding', | |
| 513 | + [ | |
| 514 | + 'label' => esc_html__('Padding', 'uicore-elements'), | |
| 515 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 516 | + 'size_units' => ['px', 'em', 'rem', '%'], | |
| 517 | + 'separator' => 'before', | |
| 518 | + 'selectors' => [ | |
| 519 | + '{{WRAPPER}} .ui-e-item article' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' | |
| 520 | + ], | |
| 521 | + 'condition' => array( | |
| 522 | + 'box_style!' => 'overlay', | |
| 523 | + ), | |
| 524 | + ] | |
| 525 | + | |
| 526 | + ); | |
| 527 | + $this->add_control( | |
| 528 | + 'item_radius', | |
| 529 | + [ | |
| 530 | + 'label' => esc_html__('Border Radius', 'uicore-elements'), | |
| 531 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 532 | + 'selectors' => [ | |
| 533 | + '{{WRAPPER}} ' => '--ui-e-border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;' | |
| 534 | + ], | |
| 535 | + ] | |
| 536 | + ); | |
| 537 | + | |
| 538 | + if ($section) { | |
| 449 | 539 | $this->end_controls_section(); |
| 450 | 540 | } |
| 451 | 541 | } |
| 452 | 542 | function TRAIT_register_post_content_style_controls($section = true) |
| 453 | 543 | { |
| 454 | - if($section){ | |
| 544 | + if ($section) { | |
| 455 | 545 | $this->start_controls_section( |
| 456 | 546 | 'section_style_content', |
| 457 | 547 | [ |
| 458 | 548 | 'label' => __('Content Style', 'uicore-elements'), |
| @@ -459,230 +549,302 @@ | ||
| 459 | 549 | 'tab' => Controls_Manager::TAB_STYLE, |
| 460 | 550 | ] |
| 461 | 551 | ); |
| 462 | 552 | } |
| 463 | - $this->add_control( | |
| 464 | - 'image_size', | |
| 465 | - [ | |
| 466 | - 'label' => __('Image Height (%)', 'uicore-elements'), | |
| 467 | - 'type' => Controls_Manager::NUMBER, | |
| 468 | - 'min' => 1, | |
| 469 | - 'max' => 500, | |
| 470 | - 'step' => 1, | |
| 471 | - 'default' => 57, | |
| 472 | - 'selectors' => [ | |
| 473 | - '{{WRAPPER}} .ui-e-post-top' => '--ui-e-img-size: {{VALUE}}', | |
| 553 | + $this->add_responsive_control( | |
| 554 | + 'image_size', | |
| 555 | + [ | |
| 556 | + 'label' => __('Image Height (%)', 'uicore-elements'), | |
| 557 | + 'type' => Controls_Manager::NUMBER, | |
| 558 | + 'min' => 1, | |
| 559 | + 'max' => 500, | |
| 560 | + 'step' => 1, | |
| 561 | + 'default' => 57, | |
| 562 | + 'selectors' => [ | |
| 563 | + '{{WRAPPER}} .ui-e-post-top' => '--ui-e-img-size: {{VALUE}}', | |
| 564 | + ], | |
| 565 | + 'condition' => [ | |
| 566 | + 'masonry!' => 'ui-e-maso', | |
| 567 | + ], | |
| 568 | + ] | |
| 569 | + ); | |
| 570 | + $this->add_responsive_control( | |
| 571 | + 'image_position', | |
| 572 | + [ | |
| 573 | + 'label' => __('Image Position', 'uicore-elements'), | |
| 574 | + 'type' => Controls_Manager::SELECT, | |
| 575 | + 'default' => 'center center', | |
| 576 | + 'tablet_default' => '', | |
| 577 | + 'mobile_default' => '', | |
| 578 | + 'options' => [ | |
| 579 | + '' => esc_html__('Default', 'uicore-elements'), | |
| 580 | + 'left top' => esc_html__('Left Top', 'uicore-elements'), | |
| 581 | + 'left center' => esc_html__('Left Center', 'uicore-elements'), | |
| 582 | + 'left bottom' => esc_html__('Left Bottom', 'uicore-elements'), | |
| 583 | + 'center top' => esc_html__('Center Top', 'uicore-elements'), | |
| 584 | + 'center center' => esc_html__('Center Center', 'uicore-elements'), | |
| 585 | + 'center bottom' => esc_html__('Center Bottom', 'uicore-elements'), | |
| 586 | + 'right top' => esc_html__('Right Top', 'uicore-elements'), | |
| 587 | + 'right center' => esc_html__('Right Center', 'uicore-elements'), | |
| 588 | + 'right bottom' => esc_html__('Right Bottom', 'uicore-elements'), | |
| 589 | + ], | |
| 590 | + 'selectors' => [ | |
| 591 | + '{{WRAPPER}} .ui-e-post-img' => 'background-position: {{VALUE}}', | |
| 592 | + ], | |
| 593 | + ] | |
| 594 | + ); | |
| 595 | + $this->add_responsive_control( | |
| 596 | + 'image_fit', | |
| 597 | + [ | |
| 598 | + 'label' => __('Image Fit', 'uicore-elements'), | |
| 599 | + 'type' => Controls_Manager::SELECT, | |
| 600 | + 'default' => 'cover', | |
| 601 | + 'tablet_default' => '', | |
| 602 | + 'mobile_default' => '', | |
| 603 | + 'options' => [ | |
| 604 | + '' => esc_html__('Default', 'uicore-elements'), | |
| 605 | + 'cover' => esc_html__('Cover', 'uicore-elements'), | |
| 606 | + 'contain' => esc_html__('Contain', 'uicore-elements'), | |
| 607 | + 'auto' => esc_html__('Auto', 'uicore-elements'), | |
| 608 | + ], | |
| 609 | + 'selectors' => [ | |
| 610 | + '{{WRAPPER}} .ui-e-post-img' => 'background-size: {{VALUE}}', | |
| 611 | + ], | |
| 612 | + ] | |
| 613 | + ); | |
| 614 | + $this->add_control( | |
| 615 | + 'image_radius', | |
| 616 | + [ | |
| 617 | + 'label' => esc_html__('Border Radius', 'uicore-elements'), | |
| 618 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 619 | + 'size_units' => ['px', 'em', '%'], | |
| 620 | + 'selectors' => [ | |
| 621 | + '{{WRAPPER}} .ui-e-post-top' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}px {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' | |
| 622 | + ], | |
| 623 | + 'condition' => array( | |
| 624 | + 'box_style!' => 'overlay', | |
| 625 | + ), | |
| 626 | + ] | |
| 627 | + ); | |
| 628 | + $this->add_group_control( | |
| 629 | + Group_Control_Box_Shadow::get_type(), | |
| 630 | + [ | |
| 631 | + 'name' => 'image_shadow', | |
| 632 | + 'label' => esc_html__('Box Shadow', 'uicore-elements'), | |
| 633 | + 'selector' => '{{WRAPPER}} .ui-e-post-top', | |
| 634 | + 'condition' => array( | |
| 635 | + 'box_style!' => 'overlay', | |
| 636 | + ), | |
| 637 | + ] | |
| 638 | + ); | |
| 639 | + $this->add_responsive_control( | |
| 640 | + 'content_alignment', | |
| 641 | + [ | |
| 642 | + 'label' => esc_html__('Content Alignment', 'uicore-elements'), | |
| 643 | + 'type' => Controls_Manager::CHOOSE, | |
| 644 | + 'options' => [ | |
| 645 | + 'start' => [ | |
| 646 | + 'title' => esc_html__('Left', 'uicore-elements'), | |
| 647 | + 'icon' => 'eicon-text-align-left', | |
| 474 | 648 | ], |
| 475 | - 'condition' => [ | |
| 476 | - 'masonry!' => 'ui-e-maso', | |
| 649 | + 'center' => [ | |
| 650 | + 'title' => esc_html__('Center', 'uicore-elements'), | |
| 651 | + 'icon' => 'eicon-text-align-center', | |
| 477 | 652 | ], |
| 478 | - ] | |
| 479 | - ); | |
| 480 | - $this->add_control( | |
| 481 | - 'image_overflow', | |
| 482 | - [ | |
| 483 | - 'label' => __('Independent Border Radius and Shadow', 'uicore-elements'), | |
| 484 | - 'type' => Controls_Manager::SWITCHER, | |
| 485 | - 'default' => 'no', | |
| 486 | - 'prefix_class' => 'ui-e-post-ovf-', | |
| 487 | - 'condition' => array( | |
| 488 | - 'box_style!' => 'overlay', | |
| 489 | - ), | |
| 490 | - ] | |
| 491 | - ); | |
| 492 | - $this->add_control( | |
| 493 | - 'image_radius', | |
| 494 | - [ | |
| 495 | - 'label' => esc_html__('Border Radius', 'uicore-elements'), | |
| 496 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 497 | - 'selectors' => [ | |
| 498 | - '{{WRAPPER}} .ui-e-post-top' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;' | |
| 653 | + 'end' => [ | |
| 654 | + 'title' => esc_html__('Right', 'uicore-elements'), | |
| 655 | + 'icon' => 'eicon-text-align-right', | |
| 499 | 656 | ], |
| 500 | - 'condition' => array( | |
| 501 | - 'image_overflow' => 'yes', | |
| 502 | - ), | |
| 503 | - ] | |
| 504 | - ); | |
| 505 | - $this->add_group_control( | |
| 506 | - Group_Control_Box_Shadow::get_type(), | |
| 507 | - [ | |
| 508 | - 'name' => 'image_shadow', | |
| 509 | - 'label' => esc_html__('Box Shadow', 'uicore-elements'), | |
| 510 | - 'selector' => '{{WRAPPER}} .ui-e-post-top', | |
| 511 | - 'condition' => array( | |
| 512 | - 'image_overflow' => 'yes', | |
| 513 | - ), | |
| 514 | - ] | |
| 515 | - ); | |
| 516 | - $this->add_responsive_control( | |
| 517 | - 'content_alignment', | |
| 518 | - [ | |
| 519 | - 'label' => esc_html__('Content Alignment', 'uicore-elements'), | |
| 520 | - 'type' => Controls_Manager::CHOOSE, | |
| 521 | - 'options' => [ | |
| 522 | - 'left' => [ | |
| 523 | - 'title' => esc_html__('Left', 'uicore-elements'), | |
| 524 | - 'icon' => 'eicon-text-align-left', | |
| 525 | - ], | |
| 526 | - 'center' => [ | |
| 527 | - 'title' => esc_html__('Center', 'uicore-elements'), | |
| 528 | - 'icon' => 'eicon-text-align-center', | |
| 529 | - ], | |
| 530 | - 'stretch' => [ | |
| 531 | - 'title' => esc_html__('Justified', 'uicore-elements'), | |
| 532 | - 'icon' => 'eicon-text-align-justify', | |
| 533 | - ], | |
| 657 | + 'stretch' => [ | |
| 658 | + 'title' => esc_html__('Justified', 'uicore-elements'), | |
| 659 | + 'icon' => 'eicon-text-align-justify', | |
| 534 | 660 | ], |
| 535 | - 'selectors' => [ | |
| 536 | - '{{WRAPPER}} .ui-e-post-content' => 'align-items: {{VALUE}}; text-align: {{VALUE}};', | |
| 661 | + ], | |
| 662 | + 'selectors_dictionary' => [ | |
| 663 | + 'left' => 'start', | |
| 664 | + ], | |
| 665 | + 'default' => is_rtl() ? 'end' : 'start', | |
| 666 | + 'selectors' => [ | |
| 667 | + '{{WRAPPER}} .ui-e-post-content' => 'align-items: {{VALUE}}; text-align: {{VALUE}};', | |
| 668 | + ], | |
| 669 | + ] | |
| 670 | + ); | |
| 671 | + $this->add_control( | |
| 672 | + 'title_color', | |
| 673 | + [ | |
| 674 | + 'label' => esc_html__('Title Color', 'uicore-elements'), | |
| 675 | + 'type' => Controls_Manager::COLOR, | |
| 676 | + 'default' => '', | |
| 677 | + 'separator' => 'before', | |
| 678 | + 'selectors' => [ | |
| 679 | + '{{WRAPPER}} .ui-e-post-title' => 'color: {{VALUE}};', | |
| 680 | + ], | |
| 681 | + ] | |
| 682 | + ); | |
| 683 | + $this->add_control( | |
| 684 | + 'title_hcolor', | |
| 685 | + [ | |
| 686 | + 'label' => esc_html__('Title Hover Color', 'uicore-elements'), | |
| 687 | + 'type' => Controls_Manager::COLOR, | |
| 688 | + 'default' => '', | |
| 689 | + 'selectors' => [ | |
| 690 | + '{{WRAPPER}} .ui-e-post-title:hover' => 'color: {{VALUE}};', | |
| 691 | + ], | |
| 692 | + ] | |
| 693 | + ); | |
| 694 | + $this->add_group_control( | |
| 695 | + Group_Control_Typography::get_type(), | |
| 696 | + [ | |
| 697 | + 'name' => 'title_typography', | |
| 698 | + 'label' => esc_html__('Title Typography', 'uicore-elements'), | |
| 699 | + 'selector' => '{{WRAPPER}} .ui-e-post-title', | |
| 700 | + ] | |
| 701 | + ); | |
| 702 | + $this->add_responsive_control( | |
| 703 | + 'title_gap', | |
| 704 | + [ | |
| 705 | + 'label' => __('Title Top Space', 'uicore-elements'), | |
| 706 | + 'type' => Controls_Manager::SLIDER, | |
| 707 | + 'size_units' => ['em'], | |
| 708 | + 'separator' => 'after', | |
| 709 | + 'range' => [ | |
| 710 | + 'px' => [ | |
| 711 | + 'min' => 0, | |
| 712 | + 'max' => 3, | |
| 713 | + 'step' => 0.1, | |
| 537 | 714 | ], |
| 538 | - ] | |
| 539 | - ); | |
| 540 | - $this->add_control( | |
| 541 | - 'title_color', | |
| 542 | - [ | |
| 543 | - 'label' => esc_html__('Title Color', 'uicore-elements'), | |
| 544 | - 'type' => Controls_Manager::COLOR, | |
| 545 | - 'default' => '', | |
| 546 | - 'separator' => 'before', | |
| 547 | - 'selectors' => [ | |
| 548 | - '{{WRAPPER}} .ui-e-post-title' => 'color: {{VALUE}};', | |
| 715 | + ], | |
| 716 | + 'default' => [ | |
| 717 | + 'unit' => 'em', | |
| 718 | + 'size' => 1.2, | |
| 719 | + ], | |
| 720 | + 'selectors' => [ | |
| 721 | + '{{WRAPPER}} .ui-e-post-title' => 'margin-top: {{SIZE}}em;', | |
| 722 | + ], | |
| 723 | + ] | |
| 724 | + ); | |
| 725 | + $this->add_control( | |
| 726 | + 'text_color', | |
| 727 | + [ | |
| 728 | + 'label' => esc_html__('Excerpt Color', 'uicore-elements'), | |
| 729 | + 'type' => Controls_Manager::COLOR, | |
| 730 | + 'default' => '', | |
| 731 | + 'selectors' => [ | |
| 732 | + '{{WRAPPER}} .ui-e-post-text' => 'color: {{VALUE}};', | |
| 733 | + ], | |
| 734 | + ] | |
| 735 | + ); | |
| 736 | + $this->add_group_control( | |
| 737 | + Group_Control_Typography::get_type(), | |
| 738 | + [ | |
| 739 | + 'name' => 'text_typography', | |
| 740 | + 'label' => esc_html__('Excerpt Typography', 'uicore-elements'), | |
| 741 | + 'selector' => '{{WRAPPER}} .ui-e-post-text', | |
| 742 | + ] | |
| 743 | + ); | |
| 744 | + $this->add_responsive_control( | |
| 745 | + 'text_gap', | |
| 746 | + [ | |
| 747 | + 'label' => __('Excerpt Top Space', 'uicore-elements'), | |
| 748 | + 'type' => Controls_Manager::SLIDER, | |
| 749 | + 'size_units' => ['em'], | |
| 750 | + 'separator' => 'after', | |
| 751 | + 'range' => [ | |
| 752 | + 'px' => [ | |
| 753 | + 'min' => 0, | |
| 754 | + 'max' => 3, | |
| 755 | + 'step' => 0.1, | |
| 549 | 756 | ], |
| 550 | - ] | |
| 551 | - ); | |
| 552 | - $this->add_control( | |
| 553 | - 'title_hcolor', | |
| 554 | - [ | |
| 555 | - 'label' => esc_html__('Title Hover Color', 'uicore-elements'), | |
| 556 | - 'type' => Controls_Manager::COLOR, | |
| 557 | - 'default' => '', | |
| 558 | - 'selectors' => [ | |
| 559 | - '{{WRAPPER}} .ui-e-post-title:hover' => 'color: {{VALUE}};', | |
| 757 | + ], | |
| 758 | + 'default' => [ | |
| 759 | + 'unit' => 'em', | |
| 760 | + 'size' => 0.8, | |
| 761 | + ], | |
| 762 | + 'selectors' => [ | |
| 763 | + '{{WRAPPER}} .ui-e-post-text' => 'margin-top: {{SIZE}}em;', | |
| 764 | + ], | |
| 765 | + ] | |
| 766 | + ); | |
| 767 | + $this->add_group_control( | |
| 768 | + Group_Control_Background::get_type(), | |
| 769 | + [ | |
| 770 | + 'name' => 'content_background', | |
| 771 | + 'selector' => '{{WRAPPER}} .ui-e-post-content', | |
| 772 | + ] | |
| 773 | + ); | |
| 774 | + $this->add_group_control( | |
| 775 | + Group_Control_Background::get_type(), | |
| 776 | + [ | |
| 777 | + 'name' => 'content_background_hover', | |
| 778 | + 'selector' => '{{WRAPPER}} .ui-e-item:hover .ui-e-post-content', | |
| 779 | + 'fields_options' => [ | |
| 780 | + 'background' => [ | |
| 781 | + 'label' => esc_html__('Hover Background', 'uicore-elements'), | |
| 560 | 782 | ], |
| 783 | + ], | |
| 784 | + 'condition' => [ | |
| 785 | + 'box_style' => 'overlay', | |
| 561 | 786 | ] |
| 562 | - ); | |
| 563 | - $this->add_group_control( | |
| 564 | - Group_Control_Typography::get_type(), | |
| 565 | - [ | |
| 566 | - 'name' => 'title_typography', | |
| 567 | - 'label' => esc_html__('Title Typography', 'uicore-elements'), | |
| 568 | - 'selector' => '{{WRAPPER}} .ui-e-post-title', | |
| 787 | + ] | |
| 788 | + ); | |
| 789 | + $this->add_responsive_control( | |
| 790 | + 'content_padding', | |
| 791 | + [ | |
| 792 | + 'label' => esc_html__('Content Padding', 'uicore-elements'), | |
| 793 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 794 | + 'size_units' => ['px', 'em', '%'], | |
| 795 | + 'selectors' => [ | |
| 796 | + '{{WRAPPER}} .ui-e-post-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' | |
| 569 | 797 | ] |
| 570 | - ); | |
| 571 | - $this->add_control( | |
| 572 | - 'title_gap', | |
| 573 | - [ | |
| 574 | - 'label' => __('Title Top Space', 'uicore-elements'), | |
| 575 | - 'type' => Controls_Manager::SLIDER, | |
| 576 | - 'size_units' => ['em'], | |
| 577 | - 'separator' => 'after', | |
| 578 | - 'range' => [ | |
| 579 | - 'px' => [ | |
| 580 | - 'min' => 0, | |
| 581 | - 'max' => 3, | |
| 582 | - 'step' => 0.1, | |
| 583 | - ], | |
| 798 | + ] | |
| 799 | + ); | |
| 800 | + $this->add_control( | |
| 801 | + 'content_radius', | |
| 802 | + [ | |
| 803 | + 'label' => esc_html__('Content Border Radius', 'uicore-elements'), | |
| 804 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 805 | + 'selectors' => [ | |
| 806 | + '{{WRAPPER}} .ui-e-post-content' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;' | |
| 807 | + ], | |
| 808 | + 'condition' => array( | |
| 809 | + 'box_style!' => 'overlay', | |
| 810 | + ), | |
| 811 | + ] | |
| 812 | + ); | |
| 813 | + $this->add_control( | |
| 814 | + 'content_gap', | |
| 815 | + [ | |
| 816 | + 'label' => __('Content Space', 'uicore-elements'), | |
| 817 | + 'type' => Controls_Manager::SLIDER, | |
| 818 | + 'size_units' => ['em'], | |
| 819 | + 'separator' => 'after', | |
| 820 | + 'range' => [ | |
| 821 | + 'px' => [ | |
| 822 | + 'min' => 0, | |
| 823 | + 'max' => 3, | |
| 824 | + 'step' => 0.1, | |
| 584 | 825 | ], |
| 585 | - 'default' => [ | |
| 586 | - 'unit' => 'em', | |
| 587 | - 'size' => 1.2, | |
| 588 | - ], | |
| 589 | - 'selectors' => [ | |
| 590 | - '{{WRAPPER}} .ui-e-post-title' => 'margin-top: {{SIZE}}em;', | |
| 591 | - ], | |
| 592 | - ] | |
| 593 | - ); | |
| 594 | - $this->add_control( | |
| 595 | - 'text_color', | |
| 596 | - [ | |
| 597 | - 'label' => esc_html__('Excerpt Color', 'uicore-elements'), | |
| 598 | - 'type' => Controls_Manager::COLOR, | |
| 599 | - 'default' => '', | |
| 600 | - 'selectors' => [ | |
| 601 | - '{{WRAPPER}} .ui-e-post-text' => 'color: {{VALUE}};', | |
| 602 | - ], | |
| 603 | - ] | |
| 604 | - ); | |
| 605 | - $this->add_group_control( | |
| 606 | - Group_Control_Typography::get_type(), | |
| 607 | - [ | |
| 608 | - 'name' => 'text_typography', | |
| 609 | - 'label' => esc_html__('Excerpt Typography', 'uicore-elements'), | |
| 610 | - 'selector' => '{{WRAPPER}} .ui-e-post-text', | |
| 611 | - ] | |
| 612 | - ); | |
| 613 | - $this->add_control( | |
| 614 | - 'text_gap', | |
| 615 | - [ | |
| 616 | - 'label' => __('Excerpt Top Space', 'uicore-elements'), | |
| 617 | - 'type' => Controls_Manager::SLIDER, | |
| 618 | - 'size_units' => ['em'], | |
| 619 | - 'separator' => 'after', | |
| 620 | - 'range' => [ | |
| 621 | - 'px' => [ | |
| 622 | - 'min' => 0, | |
| 623 | - 'max' => 3, | |
| 624 | - 'step' => 0.1, | |
| 625 | - ], | |
| 626 | - ], | |
| 627 | - 'default' => [ | |
| 628 | - 'unit' => 'em', | |
| 629 | - 'size' => 0.8, | |
| 630 | - ], | |
| 631 | - 'selectors' => [ | |
| 632 | - '{{WRAPPER}} .ui-e-post-text' => 'margin-top: {{SIZE}}em;', | |
| 633 | - ], | |
| 634 | - ] | |
| 635 | - ); | |
| 636 | - $this->add_responsive_control( | |
| 637 | - 'content_padding', | |
| 638 | - [ | |
| 639 | - 'label' => esc_html__('Content Padding', 'uicore-elements'), | |
| 640 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 641 | - 'size_units' => ['px', 'em', '%'], | |
| 642 | - 'selectors' => [ | |
| 643 | - '{{WRAPPER}} .ui-e-post-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' | |
| 644 | - ] | |
| 645 | - ] | |
| 646 | - ); | |
| 647 | - $this->add_control( | |
| 648 | - 'content_gap', | |
| 649 | - [ | |
| 650 | - 'label' => __('Content Space', 'uicore-elements'), | |
| 651 | - 'type' => Controls_Manager::SLIDER, | |
| 652 | - 'size_units' => ['em'], | |
| 653 | - 'separator' => 'after', | |
| 654 | - 'range' => [ | |
| 655 | - 'px' => [ | |
| 656 | - 'min' => 0, | |
| 657 | - 'max' => 3, | |
| 658 | - 'step' => 0.1, | |
| 659 | - ], | |
| 660 | - ], | |
| 661 | - 'default' => [ | |
| 662 | - 'unit' => 'em', | |
| 663 | - 'size' => 0, | |
| 664 | - ], | |
| 665 | - 'selectors' => [ | |
| 666 | - '{{WRAPPER}} ' => '--ui-e-content-space: {{SIZE}}em;', | |
| 667 | - ], | |
| 668 | - ] | |
| 669 | - ); | |
| 670 | - $this->add_group_control( | |
| 671 | - Group_Control_Background::get_type(), | |
| 672 | - [ | |
| 673 | - 'name' => 'content_bg', | |
| 674 | - 'selector' => '{{WRAPPER}} .ui-e-post-content', | |
| 675 | - ] | |
| 676 | - ); | |
| 826 | + ], | |
| 827 | + 'default' => [ | |
| 828 | + 'unit' => 'em', | |
| 829 | + 'size' => 0, | |
| 830 | + ], | |
| 831 | + 'selectors' => [ | |
| 832 | + '{{WRAPPER}} ' => '--ui-e-content-space: {{SIZE}}em;', | |
| 833 | + ], | |
| 834 | + 'condition' => array( | |
| 835 | + 'box_style!' => 'overlay', | |
| 836 | + ), | |
| 837 | + ] | |
| 838 | + ); | |
| 677 | 839 | |
| 678 | - if($section){ | |
| 840 | + if ($section) { | |
| 679 | 841 | $this->end_controls_section(); |
| 680 | 842 | } |
| 681 | 843 | } |
| 682 | 844 | function TRAIT_register_post_button_style_controls($section = true) |
| 683 | 845 | { |
| 684 | - if($section){ | |
| 846 | + if ($section) { | |
| 685 | 847 | $this->start_controls_section( |
| 686 | 848 | 'section_button_style', |
| 687 | 849 | [ |
| 688 | 850 | 'label' => esc_html__('Button Style', 'uicore-elements'), |
| @@ -692,57 +854,57 @@ | ||
| 692 | 854 | ), |
| 693 | 855 | ] |
| 694 | 856 | ); |
| 695 | 857 | } |
| 696 | - $this->add_responsive_control( | |
| 697 | - 'button_align', | |
| 698 | - [ | |
| 699 | - 'label' => esc_html__( 'Alignment', 'elementor' ), | |
| 700 | - 'type' => Controls_Manager::CHOOSE, | |
| 701 | - 'options' => [ | |
| 702 | - 'start' => [ | |
| 703 | - 'title' => esc_html__( 'Left', 'elementor' ), | |
| 704 | - 'icon' => 'eicon-text-align-left', | |
| 705 | - ], | |
| 706 | - 'center' => [ | |
| 707 | - 'title' => esc_html__( 'Center', 'elementor' ), | |
| 708 | - 'icon' => 'eicon-text-align-center', | |
| 709 | - ], | |
| 710 | - 'end' => [ | |
| 711 | - 'title' => esc_html__( 'Right', 'elementor' ), | |
| 712 | - 'icon' => 'eicon-text-align-right', | |
| 713 | - ], | |
| 714 | - 'normal' => [ | |
| 715 | - 'title' => esc_html__( 'Justified', 'elementor' ), | |
| 716 | - 'icon' => 'eicon-text-align-justify', | |
| 717 | - ], | |
| 858 | + $this->add_responsive_control( | |
| 859 | + 'button_align', | |
| 860 | + [ | |
| 861 | + 'label' => esc_html__('Alignment', 'uicore-elements'), | |
| 862 | + 'type' => Controls_Manager::CHOOSE, | |
| 863 | + 'options' => [ | |
| 864 | + 'start' => [ | |
| 865 | + 'title' => esc_html__('Left', 'uicore-elements'), | |
| 866 | + 'icon' => 'eicon-text-align-left', | |
| 718 | 867 | ], |
| 719 | - 'default' => 'start', | |
| 720 | - 'selectors' => [ | |
| 721 | - '{{WRAPPER}} .ui-e-readmore' => 'align-self: {{VALUE}};', | |
| 868 | + 'center' => [ | |
| 869 | + 'title' => esc_html__('Center', 'uicore-elements'), | |
| 870 | + 'icon' => 'eicon-text-align-center', | |
| 722 | 871 | ], |
| 872 | + 'end' => [ | |
| 873 | + 'title' => esc_html__('Right', 'uicore-elements'), | |
| 874 | + 'icon' => 'eicon-text-align-right', | |
| 875 | + ], | |
| 876 | + 'normal' => [ | |
| 877 | + 'title' => esc_html__('Justified', 'uicore-elements'), | |
| 878 | + 'icon' => 'eicon-text-align-justify', | |
| 879 | + ], | |
| 880 | + ], | |
| 881 | + 'default' => 'start', | |
| 882 | + 'selectors' => [ | |
| 883 | + '{{WRAPPER}} .ui-e-readmore' => 'align-self: {{VALUE}};', | |
| 884 | + ], | |
| 723 | 885 | |
| 886 | + ] | |
| 887 | + ); | |
| 888 | + $this->register_button_style_controls( | |
| 889 | + [ | |
| 890 | + 'section_condition' => [ | |
| 891 | + 'show_button' => 'yes' | |
| 724 | 892 | ] |
| 725 | - ); | |
| 726 | - $this->register_button_style_controls( | |
| 727 | - [ | |
| 728 | - 'section_condition' => [ | |
| 729 | - 'show_button' => 'yes' | |
| 730 | - ] | |
| 731 | - ] | |
| 732 | - ); | |
| 733 | - // Remove button alignment from Elementor button traits because (seens to be a bug), updating Selector CSS with update_control(), don't work as expected with responsiveness | |
| 734 | - $this->remove_responsive_control('align'); | |
| 893 | + ] | |
| 894 | + ); | |
| 895 | + // Remove button alignment from Elementor button traits because (seens to be a bug), updating Selector CSS with update_control(), don't work as expected with responsiveness | |
| 896 | + $this->remove_responsive_control('align'); | |
| 735 | 897 | |
| 736 | - $this->TRAIT_register_post_specific_controls('button_gap'); | |
| 898 | + $this->TRAIT_register_post_specific_controls('button_gap'); | |
| 737 | 899 | |
| 738 | - if($section) { | |
| 900 | + if ($section) { | |
| 739 | 901 | $this->end_controls_section(); |
| 740 | 902 | } |
| 741 | 903 | } |
| 742 | 904 | function TRAIT_register_post_meta_style_controls($section = true) |
| 743 | 905 | { |
| 744 | - if($section) { | |
| 906 | + if ($section) { | |
| 745 | 907 | $this->start_controls_section( |
| 746 | 908 | 'section_style_extra_content', |
| 747 | 909 | [ |
| 748 | 910 | 'label' => __('Meta Style', 'uicore-elements'), |
| @@ -749,47 +911,47 @@ | ||
| 749 | 911 | 'tab' => Controls_Manager::TAB_STYLE, |
| 750 | 912 | ] |
| 751 | 913 | ); |
| 752 | 914 | } |
| 753 | - $this->start_controls_tabs('style_extra_tabs'); | |
| 754 | - $this->start_controls_tab( | |
| 755 | - 'style_top_tab', | |
| 756 | - [ | |
| 757 | - 'label' => esc_html__('Top', 'uicore-elements'), | |
| 758 | - ] | |
| 759 | - ); | |
| 760 | - $this->get_meta_style_controls('top'); | |
| 761 | - $this->end_controls_tab(); | |
| 915 | + $this->start_controls_tabs('style_extra_tabs'); | |
| 916 | + $this->start_controls_tab( | |
| 917 | + 'style_top_tab', | |
| 918 | + [ | |
| 919 | + 'label' => esc_html__('Top', 'uicore-elements'), | |
| 920 | + ] | |
| 921 | + ); | |
| 922 | + $this->get_meta_style_controls('top'); | |
| 923 | + $this->end_controls_tab(); | |
| 762 | 924 | |
| 763 | - $this->start_controls_tab( | |
| 764 | - 'style_before_title_tab', | |
| 765 | - [ | |
| 766 | - 'label' => esc_html__('Before Title', 'uicore-elements'), | |
| 767 | - ] | |
| 768 | - ); | |
| 769 | - $this->get_meta_style_controls('before_title'); | |
| 770 | - $this->end_controls_tab(); | |
| 925 | + $this->start_controls_tab( | |
| 926 | + 'style_before_title_tab', | |
| 927 | + [ | |
| 928 | + 'label' => esc_html__('Before Title', 'uicore-elements'), | |
| 929 | + ] | |
| 930 | + ); | |
| 931 | + $this->get_meta_style_controls('before_title'); | |
| 932 | + $this->end_controls_tab(); | |
| 771 | 933 | |
| 772 | - $this->start_controls_tab( | |
| 773 | - 'style_after_title_tab', | |
| 774 | - [ | |
| 775 | - 'label' => esc_html__('After Title', 'uicore-elements'), | |
| 776 | - ] | |
| 777 | - ); | |
| 778 | - $this->get_meta_style_controls('after_title'); | |
| 779 | - $this->end_controls_tab(); | |
| 934 | + $this->start_controls_tab( | |
| 935 | + 'style_after_title_tab', | |
| 936 | + [ | |
| 937 | + 'label' => esc_html__('After Title', 'uicore-elements'), | |
| 938 | + ] | |
| 939 | + ); | |
| 940 | + $this->get_meta_style_controls('after_title'); | |
| 941 | + $this->end_controls_tab(); | |
| 780 | 942 | |
| 781 | - $this->start_controls_tab( | |
| 782 | - 'style_bottom_tab', | |
| 783 | - [ | |
| 784 | - 'label' => esc_html__('Bottom', 'uicore-elements'), | |
| 785 | - ] | |
| 786 | - ); | |
| 787 | - $this->get_meta_style_controls('bottom'); | |
| 788 | - $this->end_controls_tab(); | |
| 789 | - $this->end_controls_tabs(); | |
| 943 | + $this->start_controls_tab( | |
| 944 | + 'style_bottom_tab', | |
| 945 | + [ | |
| 946 | + 'label' => esc_html__('Bottom', 'uicore-elements'), | |
| 947 | + ] | |
| 948 | + ); | |
| 949 | + $this->get_meta_style_controls('bottom'); | |
| 950 | + $this->end_controls_tab(); | |
| 951 | + $this->end_controls_tabs(); | |
| 790 | 952 | |
| 791 | - if($section) { | |
| 953 | + if ($section) { | |
| 792 | 954 | $this->end_controls_section(); |
| 793 | 955 | } |
| 794 | 956 | } |
| 795 | 957 | function TRAIT_register_post_animation_controls() |
| @@ -843,8 +1005,9 @@ | ||
| 843 | 1005 | 'default' => '', |
| 844 | 1006 | 'options' => [ |
| 845 | 1007 | '' => __('None', 'uicore-elements'), |
| 846 | 1008 | 'ui-e-title-anim-underline' => __('Underline', 'uicore-elements'), |
| 1009 | + 'ui-e-title-anim-show' => __('Show', 'uicore-elements'), | |
| 847 | 1010 | ], |
| 848 | 1011 | 'prefix_class' => '', |
| 849 | 1012 | ] |
| 850 | 1013 | ); |
| @@ -882,11 +1045,11 @@ | ||
| 882 | 1045 | ], |
| 883 | 1046 | ] |
| 884 | 1047 | ); |
| 885 | 1048 | } |
| 886 | - | |
| 887 | 1049 | /** |
| 888 | 1050 | * Registers specific controls that can't be registered in blocks because of diferent use by different widgets or some other reason. |
| 1051 | + * TODO: update to the use injection control, a better approach. | |
| 889 | 1052 | * |
| 890 | 1053 | * @param string $control The control to register. |
| 891 | 1054 | * @return void |
| 892 | 1055 | */ |
| @@ -919,25 +1082,65 @@ | ||
| 919 | 1082 | break; |
| 920 | 1083 | } |
| 921 | 1084 | } |
| 922 | 1085 | |
| 923 | - // Helper functions | |
| 924 | - function TRAIT_query_posts($posts_per_page, $type = null) | |
| 1086 | + /** | |
| 1087 | + * Returns the proper query args for a given post type. | |
| 1088 | + * | |
| 1089 | + * @param array $settings Elementor controls settings. | |
| 1090 | + * @param object $default_query The default query object. Used to tell if is a frontend or rest api request. | |
| 1091 | + * | |
| 1092 | + * @return void Don't return anything, but sets the query object to $_query variable that can be accessed by the widget. | |
| 1093 | + */ | |
| 1094 | + function TRAIT_query_posts($settings, $default_query) | |
| 925 | 1095 | { |
| 926 | - if (!Plugin::$instance->editor->is_edit_mode() && $this->get_settings('posts-filter_post_type') === 'current' && !isset($_GET['uicore-tb'])) { | |
| 927 | - global $wp_query; | |
| 928 | - $this->_query = $wp_query; | |
| 929 | - } elseif ($this->get_settings('posts-filter_post_type') === 'related') { | |
| 930 | - $this->_query = Helper::get_related('random', $posts_per_page); | |
| 1096 | + $post_type = $settings['posts-filter_post_type']; | |
| 1097 | + | |
| 1098 | + if ($post_type === 'related') { | |
| 1099 | + $current_post_id = $settings['__current_post_id'] ?? []; | |
| 1100 | + $this->_query = Helper::get_related_ajax( | |
| 1101 | + Query::get_queried_page($settings), | |
| 1102 | + $settings['item_limit']['size'], | |
| 1103 | + $current_post_id | |
| 1104 | + ); | |
| 931 | 1105 | } else { |
| 932 | - $query_args = Query::get_query_args('posts-filter', $this->get_settings(), get_the_ID()); | |
| 1106 | + $query_args = Query::get_query_args('posts-filter', $settings); | |
| 933 | 1107 | |
| 934 | - if ($type === 'portfolio') { | |
| 935 | - $query_args['orderby'] = 'menu_order date'; | |
| 1108 | + if ($post_type === 'current') { | |
| 1109 | + | |
| 1110 | + // Makes sure widget will render some posts at editor screen | |
| 1111 | + if ($this->is_edit_mode()) { | |
| 1112 | + $query_args['post_type'] = 'post'; | |
| 1113 | + } else { | |
| 1114 | + $query_args = $default_query; | |
| 1115 | + | |
| 1116 | + /// TODO: very likely commit `38c618c` on Elements repo make this fallback useless. Test it | |
| 1117 | + // Post type fallback for APG | |
| 1118 | + if (isset($default_query['post_type']) || isset($default_query['query']['post_type'])) { | |
| 1119 | + $post_type = $default_query['post_type'] ?? $default_query['query']['post_type']; | |
| 1120 | + } else { | |
| 1121 | + $post_type = 'post'; | |
| 1122 | + } | |
| 1123 | + | |
| 1124 | + // Set pagination | |
| 1125 | + $query_args['paged'] = Query::get_queried_page($settings); | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + // current bug: clicking `all` on `portfolio` archive post type brings `post` type posts | |
| 1129 | + | |
| 1130 | + // Set tax filters for filter component, if enabled | |
| 1131 | + $queried_filters = Query::get_queried_filters($settings, $post_type, 'posts-filter'); | |
| 1132 | + $query_args['tax_query'] = empty($queried_filters['tax_query']) | |
| 1133 | + ? [] | |
| 1134 | + : $queried_filters['tax_query']; | |
| 1135 | + } | |
| 1136 | + | |
| 1137 | + // Set products per page | |
| 1138 | + $query_args['posts_per_page'] = Helper::get_framework_visible_posts($post_type); | |
| 936 | 1139 | } |
| 937 | 1140 | |
| 938 | - if ($type === 'current') { | |
| 939 | - unset($query_args['posts_per_page']); | |
| 1141 | + if ($post_type === 'portfolio') { | |
| 1142 | + $query_args['orderby'] = 'menu_order date'; | |
| 940 | 1143 | } |
| 941 | 1144 | |
| 942 | 1145 | $this->_query = new \WP_Query($query_args); |
| 943 | 1146 | } |
| @@ -942,38 +1145,47 @@ | ||
| 942 | 1145 | $this->_query = new \WP_Query($query_args); |
| 943 | 1146 | } |
| 944 | 1147 | } |
| 945 | 1148 | |
| 946 | - // Render functions | |
| 1149 | + // Render functions | |
| 947 | 1150 | function get_post_image() |
| 948 | 1151 | { |
| 1152 | + if ($this->is_option('image', 'yes', '!==')) { | |
| 1153 | + return; | |
| 1154 | + } | |
| 949 | 1155 | |
| 950 | - if ($this->get_settings_for_display('image') === 'yes') { | |
| 951 | - $pic_id = get_post_thumbnail_id(); | |
| 952 | - if (!$pic_id) | |
| 953 | - return; | |
| 954 | - $size = $this->get_settings_for_display('image_size_select') ?? 'uicore-medium'; | |
| 955 | - ?> | |
| 956 | - <a class="ui-e-post-img-wrapp" href="<?php echo esc_url(get_permalink()); ?>" title="<?php echo esc_attr__('View Post:', 'uicore-elements') . the_title_attribute(['echo' => false]); ?>"> | |
| 957 | - <?php if ($this->get_settings_for_display('masonry') === 'ui-e-maso') { ?> | |
| 958 | - <?php the_post_thumbnail($size, ['class' => 'ui-e-post-img']); ?> | |
| 959 | - <?php } else { ?> | |
| 960 | - <div class="ui-e-post-img" style="background-image:url(<?php echo wp_get_attachment_image_url($pic_id, $size) ?>)"></div> | |
| 961 | - <?php } ?> | |
| 962 | - </a> | |
| 963 | - <?php | |
| 964 | - } | |
| 1156 | + $pic_id = get_post_thumbnail_id(); | |
| 1157 | + if (!$pic_id) | |
| 1158 | + return; | |
| 1159 | + $size = $this->get_settings_for_display('image_size_select') ?? 'uicore-medium'; | |
| 1160 | +?> | |
| 1161 | + <a class="ui-e-post-img-wrapp" | |
| 1162 | + href="<?php echo esc_url(get_permalink()); ?>" | |
| 1163 | + title="<?php echo esc_attr__('View Post:', 'uicore-elements') . the_title_attribute(['echo' => false]); ?>"> | |
| 1164 | + | |
| 1165 | + <?php if ($this->get_settings_for_display('masonry') === 'ui-e-maso') { ?> | |
| 1166 | + <?php the_post_thumbnail($size, ['class' => 'ui-e-post-img']); ?> | |
| 1167 | + <?php } else { ?> | |
| 1168 | + <div class="ui-e-post-img" style="background-image:url(<?php echo esc_url(wp_get_attachment_image_url($pic_id, $size)); ?>)"></div> | |
| 1169 | + <?php } ?> | |
| 1170 | + </a> | |
| 1171 | + <?php | |
| 1172 | + | |
| 965 | 1173 | } |
| 966 | - function get_post_title() | |
| 1174 | + function get_post_title(string $tag) | |
| 967 | 1175 | { |
| 968 | - if ($this->get_settings_for_display('title') === 'yes') | |
| 969 | - ?> | |
| 970 | - <a href="<?php echo esc_url( get_permalink() );?>" title="<?php echo esc_attr__('View Post:','uicore-elements') . esc_html(the_title_attribute(['echo'=>false])); ?>"> | |
| 971 | - <h4 class="ui-e-post-title"><span><?php echo esc_html(get_the_title()); ?></span></h4> | |
| 1176 | + if ($this->is_option('title', 'yes', '!==')) { | |
| 1177 | + return; | |
| 1178 | + } | |
| 1179 | + ?> | |
| 1180 | + <a href="<?php echo esc_url(get_permalink()); ?>" title="<?php echo esc_attr__('View Post:', 'uicore-elements') . esc_html(the_title_attribute(['echo' => false])); ?>"> | |
| 1181 | + <<?php echo Helper::esc_tag($tag); ?> class="ui-e-post-title"> | |
| 1182 | + <span> <?php echo esc_html(get_the_title()); ?> </span> | |
| 1183 | + </<?php echo Helper::esc_tag($tag); ?>> | |
| 972 | 1184 | </a> |
| 973 | - <?php | |
| 1185 | + <?php | |
| 974 | 1186 | } |
| 975 | - function get_post_meta($position) | |
| 1187 | + function get_post_meta($position, $product_id = null) | |
| 976 | 1188 | { |
| 977 | 1189 | $meta_list = $this->get_settings_for_display($position . '_meta'); |
| 978 | 1190 | if (!isset($meta_list[0]) || $meta_list[0]['type'] == '') { |
| 979 | 1191 | return; |
| @@ -979,114 +1191,126 @@ | ||
| 979 | 1191 | return; |
| 980 | 1192 | } |
| 981 | 1193 | echo ($position == 'top') ? '<div class="ui-e-post-top-meta">' : ''; |
| 982 | 1194 | echo ($position == 'after_title') ? '<div class="ui-e-meta-wrapp">' : ''; |
| 983 | - echo '<div class="ui-e-post-meta ui-e-'.esc_attr($position).'">'; | |
| 984 | - foreach ($meta_list as $meta) { | |
| 985 | - if($meta['type'] != 'none'){ | |
| 986 | - echo '<div class="ui-e-meta-item">'; | |
| 987 | - $this->display_meta($meta); | |
| 988 | - echo '</div>'; | |
| 1195 | + echo '<div class="ui-e-post-meta ui-e-' . esc_attr($position) . '">'; | |
| 1196 | + foreach ($meta_list as $meta) { | |
| 1197 | + if ($meta['type'] != 'none') { | |
| 1198 | + $this->display_meta($meta, $product_id); | |
| 989 | 1199 | |
| 990 | - if( next( $meta_list ) && $this->get_settings_for_display( $position.'_meta_separator' ) ) { | |
| 991 | - echo '<span class="ui-e-separator">'.esc_html($this->get_settings_for_display( $position.'_meta_separator' )).'</span>'; | |
| 992 | - } | |
| 1200 | + if (next($meta_list) && $this->get_settings_for_display($position . '_meta_separator')) { | |
| 1201 | + echo '<span class="ui-e-separator">' . esc_html($this->get_settings_for_display($position . '_meta_separator')) . '</span>'; | |
| 993 | 1202 | } |
| 994 | 1203 | } |
| 1204 | + } | |
| 995 | 1205 | echo '</div>'; |
| 996 | 1206 | echo ($position == 'top' || $position == 'after_title') ? '</div>' : ''; |
| 997 | 1207 | } |
| 998 | - function get_button() | |
| 1208 | + /** | |
| 1209 | + * Render the post read more button. | |
| 1210 | + * | |
| 1211 | + * @param int $index The loop index. | |
| 1212 | + * | |
| 1213 | + * @return void | |
| 1214 | + */ | |
| 1215 | + function TRAIT_get_button($index) | |
| 999 | 1216 | { |
| 1000 | 1217 | $settings = $this->get_settings_for_display(); |
| 1001 | 1218 | |
| 1002 | - $this->add_render_attribute('button', 'class', ['elementor-button-link', 'elementor-button', 'ui-e-readmore']); | |
| 1003 | - $this->add_render_attribute('button', 'role', 'button'); | |
| 1004 | - $this->add_render_attribute('content-wrapper', 'class', 'elementor-button-content-wrapper'); | |
| 1219 | + // Render att slugs | |
| 1220 | + $button_slug = 'button_' . $index; | |
| 1221 | + $content_slug = 'content-wrapper_' . $index; | |
| 1222 | + $icon_slug = 'icon-align_' . $index; | |
| 1223 | + $text_slug = 'text_' . $index; | |
| 1005 | 1224 | |
| 1225 | + $this->add_render_attribute($button_slug, [ | |
| 1226 | + 'class' => ['elementor-button-link', 'elementor-button', 'ui-e-readmore'], | |
| 1227 | + 'role' => 'button', | |
| 1228 | + ]); | |
| 1229 | + | |
| 1230 | + $this->add_render_attribute($content_slug, 'class', 'elementor-button-content-wrapper'); | |
| 1231 | + | |
| 1006 | 1232 | if (!empty($settings['button_css_id'])) { |
| 1007 | - $this->add_render_attribute('button', 'id', $settings['button_css_id']); | |
| 1233 | + $this->add_render_attribute($button_slug, 'id', $settings['button_css_id']); | |
| 1008 | 1234 | } |
| 1009 | 1235 | |
| 1010 | 1236 | if (!empty($settings['size'])) { |
| 1011 | - $this->add_render_attribute('button', 'class', 'elementor-size-' . $settings['size']); | |
| 1237 | + $this->add_render_attribute($button_slug, 'class', 'elementor-size-' . $settings['size']); | |
| 1012 | 1238 | } |
| 1013 | 1239 | |
| 1014 | 1240 | if (!empty($settings['hover_animation'])) { |
| 1015 | - $this->add_render_attribute('button', 'class', 'elementor-animation-' . $settings['hover_animation']); | |
| 1241 | + $this->add_render_attribute($button_slug, 'class', 'elementor-animation-' . $settings['hover_animation']); | |
| 1016 | 1242 | } |
| 1243 | + | |
| 1244 | + $btn_classes = isset($settings['icon_align']) | |
| 1245 | + ? ['elementor-button-icon', 'elementor-align-icon-' . $settings['icon_align']] | |
| 1246 | + : 'elementor-button-icon'; | |
| 1247 | + | |
| 1017 | 1248 | $this->add_render_attribute([ |
| 1018 | - 'icon-align' => [ | |
| 1019 | - 'class' => [ | |
| 1020 | - 'elementor-button-icon', | |
| 1021 | - 'elementor-align-icon-' . $settings['icon_align'], | |
| 1022 | - ], | |
| 1249 | + $icon_slug => [ | |
| 1250 | + 'class' => $btn_classes | |
| 1023 | 1251 | ], |
| 1024 | - 'text' => [ | |
| 1252 | + $text_slug => [ | |
| 1025 | 1253 | 'class' => 'elementor-button-text', |
| 1026 | 1254 | ], |
| 1027 | 1255 | ]); |
| 1028 | 1256 | |
| 1029 | - $tbn_content = '<span ' . $this->get_render_attribute_string('content-wrapper') . '>'; | |
| 1257 | + if (isset($settings['icon_align'])) { | |
| 1258 | + $this->add_render_attribute($content_slug, 'class', 'elementor-button-content'); | |
| 1259 | + } | |
| 1030 | 1260 | |
| 1261 | + $tbn_content = '<span ' . $this->get_render_attribute_string($content_slug) . '>'; | |
| 1262 | + | |
| 1031 | 1263 | if (!empty($settings['icon']) || !empty($settings['selected_icon']['value'])) { |
| 1032 | - $tbn_content .= '<span ' . $this->get_render_attribute_string('icon-align') . '>'; | |
| 1264 | + $tbn_content .= '<span ' . $this->get_render_attribute_string($icon_slug) . '>'; | |
| 1033 | 1265 | \ob_start(); |
| 1034 | - \Elementor\Icons_Manager::render_icon($settings['selected_icon'], ['aria-hidden' => 'true']); | |
| 1266 | + Icons_Manager::render_icon($settings['selected_icon'], ['aria-hidden' => 'true']); | |
| 1035 | 1267 | $tbn_content .= \ob_get_clean(); |
| 1036 | 1268 | $tbn_content .= '</span>'; |
| 1037 | 1269 | } |
| 1038 | 1270 | |
| 1039 | - $tbn_content .= '<span ' . $this->get_render_attribute_string('text') . '>' . $this->get_settings_for_display('text') . '</span>'; | |
| 1040 | - $tbn_content .= '</span>'; | |
| 1271 | + $tbn_content .= '<span ' . $this->get_render_attribute_string($text_slug) . '>'; | |
| 1272 | + $tbn_content .= $settings['text']; | |
| 1273 | + $tbn_content .= '</span> </span>'; | |
| 1041 | 1274 | |
| 1042 | - if ('product' === get_post_type()) { | |
| 1043 | - // WooCommerce product | |
| 1044 | - global $product; | |
| 1045 | - | |
| 1046 | - if ($product) { | |
| 1047 | - // Display WooCommerce add to cart button | |
| 1048 | - echo wp_kses_post(apply_filters( | |
| 1049 | - 'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok. | |
| 1050 | - sprintf( | |
| 1051 | - '<a href="%s" data-quantity="%s" %s>%s</a>', | |
| 1052 | - esc_url($product->add_to_cart_url()), | |
| 1053 | - esc_attr(1), | |
| 1054 | - $this->get_render_attribute_string('button'), | |
| 1055 | - $tbn_content | |
| 1056 | - ), | |
| 1057 | - $product | |
| 1058 | - )); | |
| 1059 | - } | |
| 1060 | - } else { | |
| 1061 | - | |
| 1062 | - // Default button | |
| 1063 | - ?> | |
| 1064 | - <a href="<?php echo esc_url(get_permalink()); ?>" <?php $this->print_render_attribute_string('button'); ?>> | |
| 1065 | - <?php echo wp_kses_post($tbn_content); ?> | |
| 1066 | - </a> | |
| 1275 | + ?> | |
| 1276 | + <a href="<?php echo esc_url(get_permalink()); ?>" <?php $this->print_render_attribute_string($button_slug); ?>> | |
| 1277 | + <?php | |
| 1278 | + //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1279 | + echo Helper::esc_svg($tbn_content); | |
| 1280 | + ?> | |
| 1281 | + </a> | |
| 1067 | 1282 | <?php |
| 1068 | - } | |
| 1069 | 1283 | } |
| 1070 | - function TRAIT_render_item($carousel = false, $legacy = false) | |
| 1284 | + | |
| 1285 | + /** | |
| 1286 | + * Renders a post item with various settings and options. | |
| 1287 | + * Important: any changes here should also be considered to `TRAIT_render_product()` from Product Component. | |
| 1288 | + * | |
| 1289 | + * @param int $index The loop index. | |
| 1290 | + * @param bool $carousel Indicates if the item needs carousel classnames. | |
| 1291 | + * @param bool $legacy Indicates if the item is using legacy classnames. | |
| 1292 | + * | |
| 1293 | + * @return void | |
| 1294 | + */ | |
| 1295 | + function TRAIT_render_item($index, $carousel = false, $legacy = false) | |
| 1071 | 1296 | { |
| 1072 | 1297 | $settings = $this->get_settings_for_display(); |
| 1073 | 1298 | $excerpt_length = $settings['excerpt_trim']; |
| 1074 | 1299 | |
| 1075 | 1300 | // Classnames but checking if we the widget is APG (legacy version) |
| 1076 | - $item_classes = $legacy ? ['ui-e-post-item', 'ui-e-item'] : ['ui-e-item'] ; // Single item lower wrap class receptor | |
| 1301 | + $item_classes = $legacy ? ['ui-e-post-item', 'ui-e-item'] : ['ui-e-item']; // Single item lower wrap class receptor | |
| 1077 | 1302 | $hover_item_class = $legacy ? 'anim_item' : 'item_hover_animation'; // item hover animation class |
| 1078 | 1303 | |
| 1079 | 1304 | // If widget is not carousel type, we set animations classes directly on item selector |
| 1080 | - if(!$carousel) { | |
| 1305 | + if (!$carousel) { | |
| 1081 | 1306 | $item_classes[] = 'ui-e-animations-wrp'; |
| 1082 | 1307 | $item_classes[] = $settings['animate_items'] === 'ui-e-grid-animate' ? 'elementor-invisible' : ''; |
| 1083 | 1308 | $item_classes[] = $settings[$hover_item_class] !== '' ? $settings[$hover_item_class] : ''; |
| 1084 | - | |
| 1085 | 1309 | } else { |
| 1086 | 1310 | // Get entrance and item hover animation classes |
| 1087 | - $entrance = (isset($settings['animate_items']) && $settings['animate_items'] == 'ui-e-grid-animate') ? 'elementor-invisible' : ''; | |
| 1088 | - $hover = isset($settings[$hover_item_class]) ? $settings[$hover_item_class] : ''; //$settings[$hover_item_class] : null; | |
| 1311 | + $entrance = $this->is_option('animate_items', 'ui-e-grid-animate') ? 'elementor-invisible' : ''; | |
| 1312 | + $hover = isset($settings[$hover_item_class]) ? $settings[$hover_item_class] : ''; | |
| 1089 | 1313 | $animations = sprintf('%s %s', $entrance, $hover); |
| 1090 | 1314 | |
| 1091 | 1315 | // Check if entrance or hover animation are set |
| 1092 | 1316 | $has_animation = !empty($entrance) || !empty($hover) |
| @@ -1091,56 +1315,68 @@ | ||
| 1091 | 1315 | // Check if entrance or hover animation are set |
| 1092 | 1316 | $has_animation = !empty($entrance) || !empty($hover) |
| 1093 | 1317 | |
| 1094 | 1318 | // Prints extra wrappers required by the carousel script |
| 1095 | - ?> | |
| 1319 | + ?> | |
| 1096 | 1320 | <div class="ui-e-wrp swiper-slide"> |
| 1097 | - <?php if($has_animation) : ?> | |
| 1098 | - <div class="ui-e-animations-wrp <?php echo esc_attr($animations);?>"> | |
| 1099 | - <?php endif; ?> | |
| 1100 | - <div class="ui-e-item-wrp"> | |
| 1101 | - <?php } ?> | |
| 1321 | + <?php if ($has_animation) : ?> | |
| 1322 | + <div class="ui-e-animations-wrp <?php echo esc_attr($animations); ?>"> | |
| 1323 | + <?php endif; ?> | |
| 1102 | 1324 | |
| 1103 | - <div class="<?php echo esc_attr( implode(' ', $item_classes));?>"> | |
| 1104 | - <article <?php post_class(); ?>> | |
| 1105 | - <div class="ui-e-post-top"> | |
| 1106 | - <?php $this->get_post_image(); ?> | |
| 1107 | - <?php $this->get_post_meta('top'); ?> | |
| 1108 | - </div> | |
| 1109 | - <div class="ui-e-post-content"> | |
| 1110 | - <?php $this->get_post_meta('before_title'); ?> | |
| 1111 | - <?php | |
| 1112 | - if ($this->get_settings_for_display('title') === 'yes') | |
| 1113 | - $this->get_post_title(); | |
| 1114 | - ?> | |
| 1115 | - <?php $this->get_post_meta('after_title'); ?> | |
| 1116 | - <?php | |
| 1117 | - if ($this->get_settings_for_display('excerpt')) | |
| 1118 | - echo wp_kses_post('<div class="ui-e-post-text">' . wp_trim_words(get_the_excerpt(), $excerpt_length) . '</div>'); | |
| 1119 | - ?> | |
| 1120 | - <?php $this->get_post_meta('bottom'); // button | |
| 1121 | - ?> | |
| 1122 | - <?php | |
| 1123 | - if ($this->get_settings_for_display('show_button') === 'yes') { | |
| 1124 | - // Add match height spacing element if carousel. May look intrusive, but is the simplest method compared | |
| 1125 | - // to absolute positioning or catching last content element to apply margin. | |
| 1126 | - if($carousel && $settings['match_height'] === 'yes'){ | |
| 1127 | - ?> | |
| 1325 | + <?php } ?> | |
| 1326 | + | |
| 1327 | + <div class="<?php echo esc_attr(implode(' ', $item_classes)); ?>"> | |
| 1328 | + <article <?php post_class(); ?>> | |
| 1329 | + <div class="ui-e-post-top"> | |
| 1330 | + <?php $this->get_post_image(); ?> | |
| 1331 | + <?php $this->get_post_meta('top'); ?> | |
| 1332 | + </div> | |
| 1333 | + | |
| 1334 | + <?php if ($this->is_option('global_link', 'yes')) : ?> | |
| 1335 | + <a href="<?php echo esc_url(get_permalink()); ?>" | |
| 1336 | + class="ui-e-global-link" | |
| 1337 | + aria-label="<?php echo esc_attr__('View Post:', 'uicore-elements') . esc_html(the_title_attribute(['echo' => false])); ?>" | |
| 1338 | + title="<?php echo esc_attr__('View Post:', 'uicore-elements') . esc_html(the_title_attribute(['echo' => false])); ?>"> </a> | |
| 1339 | + <?php endif; ?> | |
| 1340 | + | |
| 1341 | + <div class="ui-e-post-content"> | |
| 1342 | + | |
| 1343 | + <?php $this->get_post_meta('before_title'); ?> | |
| 1344 | + <?php | |
| 1345 | + if ($this->is_option('title', 'yes')) | |
| 1346 | + $this->get_post_title($settings['title_tag']); | |
| 1347 | + ?> | |
| 1348 | + <?php $this->get_post_meta('after_title'); ?> | |
| 1349 | + <?php | |
| 1350 | + if ($this->get_settings_for_display('excerpt')) | |
| 1351 | + echo wp_kses_post('<div class="ui-e-post-text">' . wp_trim_words(get_the_excerpt(), $excerpt_length) . '</div>'); | |
| 1352 | + ?> | |
| 1353 | + <?php $this->get_post_meta('bottom'); // button | |
| 1354 | + ?> | |
| 1355 | + <?php | |
| 1356 | + if ($this->is_option('show_button', 'yes')) { | |
| 1357 | + // Add match height spacing element if carousel. May look intrusive, but is the simplest method compared | |
| 1358 | + // to absolute positioning or catching last content element to apply margin. | |
| 1359 | + if ($carousel && $this->is_option('match_height', 'yes')) { | |
| 1360 | + ?> | |
| 1128 | 1361 | <span class="ui-e-match-height"></span> |
| 1129 | - <?php | |
| 1362 | + <?php | |
| 1363 | + } | |
| 1364 | + | |
| 1365 | + if (!isset($settings['button_position']) || empty($settings['button_position'])) { | |
| 1366 | + $this->TRAIT_get_button($index); | |
| 1367 | + } | |
| 1130 | 1368 | } |
| 1131 | - $this->get_button(); | |
| 1132 | - } | |
| 1133 | - ?> | |
| 1369 | + ?> | |
| 1370 | + </div> | |
| 1371 | + </article> | |
| 1372 | + </div> | |
| 1373 | + | |
| 1374 | + <?php if ($carousel) { ?> | |
| 1134 | 1375 | </div> |
| 1135 | - </article> | |
| 1376 | + <?php if ($has_animation) : ?> | |
| 1136 | 1377 | </div> |
| 1378 | + <?php endif; ?> | |
| 1137 | 1379 | |
| 1138 | - <?php if($carousel) { ?> | |
| 1139 | - </div> | |
| 1140 | - <?php if($has_animation) : ?> | |
| 1141 | - </div> | |
| 1142 | - <?php endif; ?> | |
| 1143 | - </div> | |
| 1144 | - <?php } | |
| 1145 | - } | |
| 1146 | -} | |
| 1380 | +<?php } | |
| 1381 | + } | |
| 1382 | + } | |