widgets
3 years ago
base.php
3 years ago
rtTPGElementorHelper.php
3 years ago
rtTPGElementorQuery.php
3 years ago
rtTPGElementorHelper.php
8482 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Elementor Helper Class |
| 4 | * |
| 5 | * @package RT_TPG |
| 6 | */ |
| 7 | |
| 8 | use Elementor\Controls_Manager; |
| 9 | use RT\ThePostGrid\Helpers\Fns; |
| 10 | use RT\ThePostGrid\Helpers\Options; |
| 11 | |
| 12 | // Do not allow directly accessing this file. |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit( 'This script cannot be accessed directly.' ); |
| 15 | } |
| 16 | |
| 17 | require_once( RT_THE_POST_GRID_PLUGIN_PATH . '/app/Widgets/elementor/rtTPGElementorQuery.php' ); |
| 18 | |
| 19 | /** |
| 20 | * Elementor Helper Class |
| 21 | */ |
| 22 | class rtTPGElementorHelper { |
| 23 | /** |
| 24 | * Post Query Builder |
| 25 | * |
| 26 | * @param $ref |
| 27 | */ |
| 28 | public static function query( $ref ) { |
| 29 | $post_types = Fns::get_post_types(); |
| 30 | |
| 31 | $taxonomies = get_taxonomies( [], 'objects' ); |
| 32 | |
| 33 | do_action( 'rt_tpg_el_query_build', $ref ); |
| 34 | $ref->start_controls_section( |
| 35 | 'rt_post_query', |
| 36 | [ |
| 37 | 'label' => esc_html__( 'Query Build', 'the-post-grid' ), |
| 38 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 39 | ] |
| 40 | ); |
| 41 | |
| 42 | $ref->add_control( |
| 43 | 'post_type', |
| 44 | [ |
| 45 | 'label' => esc_html__( 'Post Source', 'the-post-grid' ), |
| 46 | 'type' => Controls_Manager::SELECT, |
| 47 | 'options' => $post_types, |
| 48 | 'default' => 'post', |
| 49 | 'description' => $ref->get_pro_message( 'all post type.' ), |
| 50 | ] |
| 51 | ); |
| 52 | |
| 53 | //TODO: Common Filter |
| 54 | |
| 55 | $ref->add_control( |
| 56 | 'common_filters_heading', |
| 57 | [ |
| 58 | 'label' => esc_html__( 'Common Filters:', 'the-post-grid' ), |
| 59 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 60 | 'separator' => 'before', |
| 61 | 'classes' => 'tpg-control-type-heading', |
| 62 | ] |
| 63 | ); |
| 64 | |
| 65 | $ref->add_control( |
| 66 | 'post_id', |
| 67 | [ |
| 68 | 'label' => esc_html__( 'Include only', 'the-post-grid' ), |
| 69 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 70 | 'description' => esc_html__( 'Enter the post IDs separated by comma for include', 'the-post-grid' ), |
| 71 | 'placeholder' => 'Eg. 10, 15, 17', |
| 72 | ] |
| 73 | ); |
| 74 | |
| 75 | $ref->add_control( |
| 76 | 'exclude', |
| 77 | [ |
| 78 | 'label' => esc_html__( 'Exclude', 'the-post-grid' ), |
| 79 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 80 | 'description' => esc_html__( 'Enter the post IDs separated by comma for exclude', 'the-post-grid' ), |
| 81 | 'placeholder' => 'Eg. 12, 13', |
| 82 | ] |
| 83 | ); |
| 84 | |
| 85 | $ref->add_control( |
| 86 | 'post_limit', |
| 87 | [ |
| 88 | 'label' => esc_html__( 'Limit', 'the-post-grid' ), |
| 89 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 90 | 'description' => esc_html__( 'The number of posts to show. Enter -1 to show all found posts.', 'the-post-grid' ), |
| 91 | ] |
| 92 | ); |
| 93 | |
| 94 | $ref->add_control( |
| 95 | 'offset', |
| 96 | [ |
| 97 | 'label' => esc_html__( 'Offset', 'the-post-grid' ), |
| 98 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 99 | 'placeholder' => esc_html__( 'Enter Post offset', 'the-post-grid' ), |
| 100 | 'description' => esc_html__( 'Number of posts to skip. The offset parameter is ignored when post limit => -1 is used.', 'the-post-grid' ), |
| 101 | ] |
| 102 | ); |
| 103 | |
| 104 | // Advance Filter |
| 105 | |
| 106 | $ref->add_control( |
| 107 | 'advanced_filters_heading', |
| 108 | [ |
| 109 | 'label' => esc_html__( 'Advanced Filters:', 'the-post-grid' ), |
| 110 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 111 | 'separator' => 'before', |
| 112 | 'classes' => 'tpg-control-type-heading', |
| 113 | ] |
| 114 | ); |
| 115 | |
| 116 | foreach ( $taxonomies as $taxonomy => $object ) { |
| 117 | if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) ) |
| 118 | || in_array( $taxonomy, Fns::get_excluded_taxonomy() ) |
| 119 | ) { |
| 120 | continue; |
| 121 | } |
| 122 | $ref->add_control( |
| 123 | $taxonomy . '_ids', |
| 124 | [ |
| 125 | 'label' => esc_html__( "By ", 'the-post-grid' ) . $object->label, |
| 126 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 127 | 'label_block' => true, |
| 128 | 'multiple' => true, |
| 129 | 'options' => Fns::tpg_get_categories_by_id( $taxonomy ), |
| 130 | 'condition' => [ |
| 131 | 'post_type' => $object->object_type, |
| 132 | ], |
| 133 | ] |
| 134 | ); |
| 135 | } |
| 136 | |
| 137 | $ref->add_control( |
| 138 | 'relation', |
| 139 | [ |
| 140 | 'label' => esc_html__( 'Taxonomies Relation', 'the-post-grid' ), |
| 141 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 142 | 'default' => 'OR', |
| 143 | 'options' => [ |
| 144 | 'OR' => __( 'OR', 'the-post-grid' ), |
| 145 | 'AND' => __( 'AND', 'the-post-grid' ), |
| 146 | ], |
| 147 | ] |
| 148 | ); |
| 149 | |
| 150 | $ref->add_control( |
| 151 | 'author', |
| 152 | [ |
| 153 | 'label' => esc_html__( 'By Author', 'the-post-grid' ), |
| 154 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 155 | 'multiple' => true, |
| 156 | 'label_block' => true, |
| 157 | 'options' => Fns::rt_get_users(), |
| 158 | ] |
| 159 | ); |
| 160 | |
| 161 | $ref->add_control( |
| 162 | 'post_keyword', |
| 163 | [ |
| 164 | 'label' => esc_html__( 'By Keyword', 'the-post-grid' ), |
| 165 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 166 | 'label_block' => true, |
| 167 | 'placeholder' => esc_html__( 'Search by keyword', 'the-post-grid' ), |
| 168 | 'description' => esc_html__( 'Search by post title or content keyword', 'the-post-grid' ), |
| 169 | ] |
| 170 | ); |
| 171 | |
| 172 | $ref->add_control( |
| 173 | 'date_range', |
| 174 | [ |
| 175 | 'label' => esc_html__( 'Date Range (Start to End)', 'the-post-grid' ) . $ref->pro_label, |
| 176 | 'type' => \Elementor\Controls_Manager::DATE_TIME, |
| 177 | 'placeholder' => 'Choose date...', |
| 178 | 'description' => esc_html__( 'NB: Enter DEL button for delete date range', 'the-post-grid' ), |
| 179 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 180 | 'picker_options' => [ |
| 181 | 'enableTime' => false, |
| 182 | 'mode' => 'range', |
| 183 | 'dateFormat' => 'M j, Y', |
| 184 | ], |
| 185 | ] |
| 186 | ); |
| 187 | |
| 188 | |
| 189 | $orderby_opt = [ |
| 190 | 'date' => esc_html__( 'Date', 'the-post-grid' ), |
| 191 | 'ID' => esc_html__( 'Order by post ID', 'the-post-grid' ), |
| 192 | 'author' => esc_html__( 'Author', 'the-post-grid' ), |
| 193 | 'title' => esc_html__( 'Title', 'the-post-grid' ), |
| 194 | 'modified' => esc_html__( 'Last modified date', 'the-post-grid' ), |
| 195 | 'parent' => esc_html__( 'Post parent ID', 'the-post-grid' ), |
| 196 | 'comment_count' => esc_html__( 'Number of comments', 'the-post-grid' ), |
| 197 | 'menu_order' => esc_html__( 'Menu order', 'the-post-grid' ), |
| 198 | ]; |
| 199 | |
| 200 | if ( rtTPG()->hasPro() ) { |
| 201 | $prderby_pro_opt = [ |
| 202 | 'rand' => esc_html__( 'Random order', 'the-post-grid' ), |
| 203 | 'meta_value' => esc_html__( 'Meta value', 'the-post-grid' ), |
| 204 | 'meta_value_num' => esc_html__( 'Meta value number', 'the-post-grid' ), |
| 205 | 'meta_value_datetime' => esc_html__( 'Meta value datetime', 'the-post-grid' ), |
| 206 | ]; |
| 207 | $orderby_opt = array_merge( $orderby_opt, $prderby_pro_opt ); |
| 208 | } |
| 209 | |
| 210 | $ref->add_control( |
| 211 | 'orderby', |
| 212 | [ |
| 213 | 'label' => esc_html__( 'Order by', 'the-post-grid' ), |
| 214 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 215 | 'options' => $orderby_opt, |
| 216 | 'default' => 'date', |
| 217 | 'description' => $ref->get_pro_message( 'Random Order.' ), |
| 218 | ] |
| 219 | ); |
| 220 | |
| 221 | $ref->add_control( |
| 222 | 'meta_key', |
| 223 | [ |
| 224 | 'label' => esc_html__( 'Meta Key', 'the-post-grid' ), |
| 225 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 226 | 'placeholder' => esc_html__( 'Enter Meta Key.', 'the-post-grid' ), |
| 227 | 'condition' => [ |
| 228 | 'orderby' => [ 'meta_value', 'meta_value_num', 'meta_value_datetime' ], |
| 229 | ], |
| 230 | ] |
| 231 | ); |
| 232 | |
| 233 | $ref->add_control( |
| 234 | 'order', |
| 235 | [ |
| 236 | 'label' => esc_html__( 'Sort order', 'the-post-grid' ), |
| 237 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 238 | 'options' => [ |
| 239 | 'ASC' => esc_html__( 'ASC', 'the-post-grid' ), |
| 240 | 'DESC' => esc_html__( 'DESC', 'the-post-grid' ), |
| 241 | ], |
| 242 | 'default' => 'DESC', |
| 243 | 'condition' => [ |
| 244 | 'orderby!' => [ 'rand' ], |
| 245 | ], |
| 246 | ] |
| 247 | ); |
| 248 | |
| 249 | $ref->add_control( |
| 250 | 'post_status', |
| 251 | [ |
| 252 | 'label' => esc_html__( 'Post Status', 'the-post-grid' ), |
| 253 | 'type' => Controls_Manager::SELECT, |
| 254 | 'options' => Options::rtTPGPostStatus(), |
| 255 | 'default' => 'publish', |
| 256 | ] |
| 257 | ); |
| 258 | |
| 259 | |
| 260 | $ref->add_control( |
| 261 | 'ignore_sticky_posts', |
| 262 | [ |
| 263 | 'label' => esc_html__( 'Ignore sticky posts at the top', 'the-post-grid' ) . $ref->pro_label, |
| 264 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 265 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 266 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 267 | 'return_value' => 'yes', |
| 268 | 'default' => 'no', |
| 269 | 'disabled' => true, |
| 270 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 271 | ] |
| 272 | ); |
| 273 | |
| 274 | $ref->add_control( |
| 275 | 'no_posts_found_text', |
| 276 | [ |
| 277 | 'label' => esc_html__( 'No post found Text', 'the-post-grid' ), |
| 278 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 279 | 'default' => esc_html__( 'No posts found.', 'the-post-grid' ), |
| 280 | 'placeholder' => esc_html__( 'Enter No post found', 'the-post-grid' ), |
| 281 | 'separator' => 'before', |
| 282 | ] |
| 283 | ); |
| 284 | |
| 285 | |
| 286 | $ref->end_controls_section(); |
| 287 | } |
| 288 | |
| 289 | |
| 290 | /** |
| 291 | * Archive Query Builder |
| 292 | * |
| 293 | * @param $ref |
| 294 | * @param $layout_type |
| 295 | * |
| 296 | * @return void |
| 297 | */ |
| 298 | public static function query_builder( $ref, $layout_type = '' ) { |
| 299 | $post_types = Fns::get_post_types(); |
| 300 | |
| 301 | $taxonomies = get_object_taxonomies( 'post', 'object' ); |
| 302 | |
| 303 | do_action( 'rt_tpg_el_query_build', $ref ); |
| 304 | $ref->start_controls_section( |
| 305 | 'rt_post_query', |
| 306 | [ |
| 307 | 'label' => esc_html__( 'Query Build', 'the-post-grid' ), |
| 308 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 309 | ] |
| 310 | ); |
| 311 | |
| 312 | $ref->add_control( |
| 313 | 'post_limit', |
| 314 | [ |
| 315 | 'label' => esc_html__( 'Posts per page', 'the-post-grid' ), |
| 316 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 317 | 'description' => esc_html__( 'The number of posts to show. Enter -1 to show all found posts.', 'the-post-grid' ), |
| 318 | ] |
| 319 | ); |
| 320 | |
| 321 | |
| 322 | if ( 'single' == $layout_type ) { |
| 323 | $get_all_taxonomy = []; |
| 324 | foreach ( $taxonomies as $taxonomy => $object ) { |
| 325 | if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) ) |
| 326 | || in_array( $taxonomy, Fns::get_excluded_taxonomy() ) |
| 327 | ) { |
| 328 | continue; |
| 329 | } |
| 330 | $get_all_taxonomy[ $object->name ] = $object->label; |
| 331 | } |
| 332 | |
| 333 | $ref->add_control( |
| 334 | 'taxonomy_lists', |
| 335 | [ |
| 336 | 'label' => esc_html__( 'Select a Taxonomy for relation', 'the-post-grid' ), |
| 337 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 338 | 'default' => 'category', |
| 339 | 'options' => $get_all_taxonomy, |
| 340 | ] |
| 341 | ); |
| 342 | |
| 343 | $orderby_opt = [ |
| 344 | 'date' => esc_html__( 'Date', 'the-post-grid' ), |
| 345 | 'ID' => esc_html__( 'Order by post ID', 'the-post-grid' ), |
| 346 | 'author' => esc_html__( 'Author', 'the-post-grid' ), |
| 347 | 'title' => esc_html__( 'Title', 'the-post-grid' ), |
| 348 | 'modified' => esc_html__( 'Last modified date', 'the-post-grid' ), |
| 349 | 'parent' => esc_html__( 'Post parent ID', 'the-post-grid' ), |
| 350 | 'comment_count' => esc_html__( 'Number of comments', 'the-post-grid' ), |
| 351 | 'menu_order' => esc_html__( 'Menu order', 'the-post-grid' ), |
| 352 | 'rand' => esc_html__( 'Random order', 'the-post-grid' ), |
| 353 | |
| 354 | ]; |
| 355 | |
| 356 | $ref->add_control( |
| 357 | 'orderby', |
| 358 | [ |
| 359 | 'label' => esc_html__( 'Order by', 'the-post-grid' ), |
| 360 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 361 | 'options' => $orderby_opt, |
| 362 | 'default' => 'date', |
| 363 | ] |
| 364 | ); |
| 365 | |
| 366 | $ref->add_control( |
| 367 | 'order', |
| 368 | [ |
| 369 | 'label' => esc_html__( 'Sort order', 'the-post-grid' ), |
| 370 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 371 | 'options' => [ |
| 372 | 'ASC' => esc_html__( 'ASC', 'the-post-grid' ), |
| 373 | 'DESC' => esc_html__( 'DESC', 'the-post-grid' ), |
| 374 | ], |
| 375 | 'default' => 'DESC', |
| 376 | 'condition' => [ |
| 377 | 'orderby!' => 'menu_order', |
| 378 | ], |
| 379 | ] |
| 380 | ); |
| 381 | } else { |
| 382 | $ref->add_control( |
| 383 | 'post_id', |
| 384 | [ |
| 385 | 'label' => esc_html__( 'Include only', 'the-post-grid' ), |
| 386 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 387 | 'description' => esc_html__( 'Enter the post IDs separated by comma for include', 'the-post-grid' ), |
| 388 | 'placeholder' => 'Eg. 10, 15, 17', |
| 389 | ] |
| 390 | ); |
| 391 | |
| 392 | $ref->add_control( |
| 393 | 'exclude', |
| 394 | [ |
| 395 | 'label' => esc_html__( 'Exclude', 'the-post-grid' ), |
| 396 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 397 | 'description' => esc_html__( 'Enter the post IDs separated by comma for exclude', 'the-post-grid' ), |
| 398 | 'placeholder' => 'Eg. 12, 13', |
| 399 | ] |
| 400 | ); |
| 401 | |
| 402 | $ref->add_control( |
| 403 | 'offset', |
| 404 | [ |
| 405 | 'label' => esc_html__( 'Offset', 'the-post-grid' ), |
| 406 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 407 | 'placeholder' => esc_html__( 'Enter Post offset', 'the-post-grid' ), |
| 408 | 'description' => esc_html__( 'Number of posts to skip. The offset parameter is ignored when post limit => -1 is used.', 'the-post-grid' ), |
| 409 | ] |
| 410 | ); |
| 411 | |
| 412 | $ref->add_control( |
| 413 | 'no_posts_found_text_archive', |
| 414 | [ |
| 415 | 'label' => esc_html__( 'No post found Text', 'the-post-grid' ), |
| 416 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 417 | 'default' => esc_html__( 'No posts found.', 'the-post-grid' ), |
| 418 | 'placeholder' => esc_html__( 'Enter No post found', 'the-post-grid' ), |
| 419 | 'separator' => 'before', |
| 420 | ] |
| 421 | ); |
| 422 | } |
| 423 | $ref->end_controls_section(); |
| 424 | } |
| 425 | |
| 426 | /** |
| 427 | * Grid Layout Settings |
| 428 | * |
| 429 | * @param $ref |
| 430 | */ |
| 431 | public static function grid_layouts( $ref, $layout_type = '' ) { |
| 432 | $prefix = $ref->prefix; |
| 433 | |
| 434 | $ref->start_controls_section( |
| 435 | $prefix . '_layout_settings', |
| 436 | [ |
| 437 | 'label' => esc_html__( 'Layout', 'the-post-grid' ), |
| 438 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 439 | ] |
| 440 | ); |
| 441 | |
| 442 | if ( 'grid' === $prefix ) { |
| 443 | $layout_class = 'grid-layout'; |
| 444 | $layout_options = [ |
| 445 | $prefix . '-layout1' => [ |
| 446 | 'title' => esc_html__( 'Layout 1', 'the-post-grid' ), |
| 447 | ], |
| 448 | $prefix . '-layout3' => [ |
| 449 | 'title' => esc_html__( 'Layout 2', 'the-post-grid' ), |
| 450 | ], |
| 451 | $prefix . '-layout4' => [ |
| 452 | 'title' => esc_html__( 'Layout 3', 'the-post-grid' ), |
| 453 | ], |
| 454 | $prefix . '-layout2' => [ |
| 455 | 'title' => esc_html__( 'Layout 4', 'the-post-grid' ), |
| 456 | ], |
| 457 | $prefix . '-layout5' => [ |
| 458 | 'title' => esc_html__( 'Layout 5', 'the-post-grid' ), |
| 459 | ], |
| 460 | $prefix . '-layout5-2' => [ |
| 461 | 'title' => esc_html__( 'Layout 6', 'the-post-grid' ), |
| 462 | ], |
| 463 | $prefix . '-layout6' => [ |
| 464 | 'title' => esc_html__( 'Layout 7', 'the-post-grid' ), |
| 465 | ], |
| 466 | $prefix . '-layout6-2' => [ |
| 467 | 'title' => esc_html__( 'Layout 8', 'the-post-grid' ), |
| 468 | ], |
| 469 | $prefix . '-layout7' => [ |
| 470 | 'title' => esc_html__( 'Gallery', 'the-post-grid' ), |
| 471 | ], |
| 472 | ]; |
| 473 | } |
| 474 | |
| 475 | if ( 'grid_hover' === $prefix ) { |
| 476 | $layout_class = 'grid-hover-layout'; |
| 477 | $layout_options = [ |
| 478 | $prefix . '-layout1' => [ |
| 479 | 'title' => esc_html__( 'Layout 1', 'the-post-grid' ), |
| 480 | ], |
| 481 | $prefix . '-layout2' => [ |
| 482 | 'title' => esc_html__( 'Layout 2', 'the-post-grid' ), |
| 483 | ], |
| 484 | $prefix . '-layout3' => [ |
| 485 | 'title' => esc_html__( 'Layout 3', 'the-post-grid' ), |
| 486 | ], |
| 487 | $prefix . '-layout4' => [ |
| 488 | 'title' => esc_html__( 'Layout 4', 'the-post-grid' ), |
| 489 | ], |
| 490 | $prefix . '-layout4-2' => [ |
| 491 | 'title' => esc_html__( 'Layout 5', 'the-post-grid' ), |
| 492 | ], |
| 493 | $prefix . '-layout5' => [ |
| 494 | 'title' => esc_html__( 'Layout 6', 'the-post-grid' ), |
| 495 | ], |
| 496 | $prefix . '-layout5-2' => [ |
| 497 | 'title' => esc_html__( 'Layout 7', 'the-post-grid' ), |
| 498 | ], |
| 499 | $prefix . '-layout6' => [ |
| 500 | 'title' => esc_html__( 'Layout 8', 'the-post-grid' ), |
| 501 | ], |
| 502 | $prefix . '-layout6-2' => [ |
| 503 | 'title' => esc_html__( 'Layout 9', 'the-post-grid' ), |
| 504 | ], |
| 505 | $prefix . '-layout7' => [ |
| 506 | 'title' => esc_html__( 'Layout 10', 'the-post-grid' ), |
| 507 | ], |
| 508 | $prefix . '-layout7-2' => [ |
| 509 | 'title' => esc_html__( 'Layout 11', 'the-post-grid' ), |
| 510 | ], |
| 511 | $prefix . '-layout8' => [ |
| 512 | 'title' => esc_html__( 'Layout 12', 'the-post-grid' ), |
| 513 | ], |
| 514 | $prefix . '-layout9' => [ |
| 515 | 'title' => esc_html__( 'Layout 13', 'the-post-grid' ), |
| 516 | ], |
| 517 | $prefix . '-layout9-2' => [ |
| 518 | 'title' => esc_html__( 'Layout 14', 'the-post-grid' ), |
| 519 | ], |
| 520 | $prefix . '-layout10' => [ |
| 521 | 'title' => esc_html__( 'Layout 15', 'the-post-grid' ), |
| 522 | ], |
| 523 | $prefix . '-layout11' => [ |
| 524 | 'title' => esc_html__( 'Layout 16', 'the-post-grid' ), |
| 525 | ], |
| 526 | ]; |
| 527 | } |
| 528 | |
| 529 | if ( 'slider' === $prefix ) { |
| 530 | $layout_class = 'slider-layout'; |
| 531 | $layout_options = [ |
| 532 | $prefix . '-layout1' => [ |
| 533 | 'title' => esc_html__( 'Layout 1', 'the-post-grid' ), |
| 534 | ], |
| 535 | $prefix . '-layout2' => [ |
| 536 | 'title' => esc_html__( 'Layout 2', 'the-post-grid' ), |
| 537 | ], |
| 538 | $prefix . '-layout3' => [ |
| 539 | 'title' => esc_html__( 'Layout 3', 'the-post-grid' ), |
| 540 | ], |
| 541 | $prefix . '-layout4' => [ |
| 542 | 'title' => esc_html__( 'Layout 4', 'the-post-grid' ), |
| 543 | ], |
| 544 | $prefix . '-layout5' => [ |
| 545 | 'title' => esc_html__( 'Layout 5', 'the-post-grid' ), |
| 546 | ], |
| 547 | $prefix . '-layout6' => [ |
| 548 | 'title' => esc_html__( 'Layout 6', 'the-post-grid' ), |
| 549 | ], |
| 550 | $prefix . '-layout7' => [ |
| 551 | 'title' => esc_html__( 'Layout 7', 'the-post-grid' ), |
| 552 | ], |
| 553 | $prefix . '-layout8' => [ |
| 554 | 'title' => esc_html__( 'Layout 8', 'the-post-grid' ), |
| 555 | ], |
| 556 | $prefix . '-layout9' => [ |
| 557 | 'title' => esc_html__( 'Layout 9', 'the-post-grid' ), |
| 558 | ], |
| 559 | $prefix . '-layout10' => [ |
| 560 | 'title' => esc_html__( 'Layout 10', 'the-post-grid' ), |
| 561 | ], |
| 562 | $prefix . '-layout11' => [ |
| 563 | 'title' => esc_html__( 'Layout 11', 'the-post-grid' ), |
| 564 | ], |
| 565 | $prefix . '-layout12' => [ |
| 566 | 'title' => esc_html__( 'Layout 12', 'the-post-grid' ), |
| 567 | ], |
| 568 | $prefix . '-layout13' => [ |
| 569 | 'title' => esc_html__( 'Layout 13', 'the-post-grid' ), |
| 570 | ], |
| 571 | ]; |
| 572 | |
| 573 | if ( 'single' === $layout_type ) { |
| 574 | $layout_options = array_slice( $layout_options, 0, 9 ); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | $ref->add_control( |
| 579 | $prefix . '_layout', |
| 580 | [ |
| 581 | 'label' => esc_html__( 'Choose Layout', 'the-post-grid' ), |
| 582 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 583 | 'label_block' => true, |
| 584 | 'options' => $layout_options, |
| 585 | 'toggle' => false, |
| 586 | 'default' => $prefix . '-layout1', |
| 587 | 'style_transfer' => true, |
| 588 | 'classes' => 'tpg-image-select ' . $layout_class . ' ' . $ref->is_post_layout, |
| 589 | ] |
| 590 | ); |
| 591 | |
| 592 | $ref->add_control( |
| 593 | 'offset_img_position', |
| 594 | [ |
| 595 | 'label' => esc_html__( 'Offset Image Position', 'the-post-grid' ), |
| 596 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 597 | 'default' => 'image-left', |
| 598 | 'options' => [ |
| 599 | 'image-left' => esc_html__( 'Left (Default)', 'the-post-grid' ), |
| 600 | 'image-right' => esc_html__( 'Right', 'the-post-grid' ), |
| 601 | ], |
| 602 | 'prefix_class' => 'offset-', |
| 603 | 'condition' => [ |
| 604 | 'grid_layout' => [ 'grid-layout5', 'grid-layout5-2', 'list-layout2', 'list-layout2-2', 'list-layout3', 'list-layout3-2' ], |
| 605 | ], |
| 606 | ] |
| 607 | ); |
| 608 | |
| 609 | $ref->add_control( |
| 610 | 'middle_border', |
| 611 | [ |
| 612 | 'label' => esc_html__( 'Middle Border?', 'the-post-grid' ), |
| 613 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 614 | 'default' => 'yes', |
| 615 | 'options' => [ |
| 616 | 'yes' => esc_html__( 'Yes', 'the-post-grid' ), |
| 617 | 'no' => esc_html__( 'No', 'the-post-grid' ), |
| 618 | ], |
| 619 | 'condition' => [ |
| 620 | 'grid_layout' => [ 'grid-layout6', 'grid-layout6-2' ], |
| 621 | ], |
| 622 | ] |
| 623 | ); |
| 624 | |
| 625 | |
| 626 | $ref->add_control( |
| 627 | 'layout_options_heading', |
| 628 | [ |
| 629 | 'label' => esc_html__( 'Layout Options:', 'the-post-grid' ), |
| 630 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 631 | 'classes' => 'tpg-control-type-heading', |
| 632 | ] |
| 633 | ); |
| 634 | |
| 635 | |
| 636 | $column_options = [ |
| 637 | '0' => esc_html__( 'Default from layout', 'the-post-grid' ), |
| 638 | '12' => esc_html__( '1 Columns', 'the-post-grid' ), |
| 639 | '6' => esc_html__( '2 Columns', 'the-post-grid' ), |
| 640 | '4' => esc_html__( '3 Columns', 'the-post-grid' ), |
| 641 | '3' => esc_html__( '4 Columns', 'the-post-grid' ), |
| 642 | ]; |
| 643 | |
| 644 | if ( 'grid' === $prefix ) { |
| 645 | $grid_column_condition = [ |
| 646 | 'grid_layout!' => [ 'grid-layout5', 'grid-layout5-2', 'grid-layout6', 'grid-layout6-2' ], |
| 647 | ]; |
| 648 | } |
| 649 | |
| 650 | if ( 'grid_hover' === $prefix ) { |
| 651 | $grid_column_condition = [ |
| 652 | 'grid_hover_layout!' => [ 'grid_hover-layout8' ], |
| 653 | ]; |
| 654 | } |
| 655 | |
| 656 | if ( 'slider' === $prefix ) { |
| 657 | $column_options = [ |
| 658 | '0' => esc_html__( 'Default from layout', 'the-post-grid' ), |
| 659 | '1' => esc_html__( '1 Columns', 'the-post-grid' ), |
| 660 | '2' => esc_html__( '2 Columns', 'the-post-grid' ), |
| 661 | '3' => esc_html__( '3 Columns', 'the-post-grid' ), |
| 662 | '4' => esc_html__( '4 Columns', 'the-post-grid' ), |
| 663 | '5' => esc_html__( '5 Columns', 'the-post-grid' ), |
| 664 | '6' => esc_html__( '6 Columns', 'the-post-grid' ), |
| 665 | ]; |
| 666 | $grid_column_condition = [ |
| 667 | 'slider_layout!' => [ 'slider-layout10', 'slider-layout11', 'slider-layout13' ], |
| 668 | ]; |
| 669 | } |
| 670 | |
| 671 | $ref->add_responsive_control( |
| 672 | $prefix . '_column', |
| 673 | [ |
| 674 | 'label' => esc_html__( 'Column', 'the-post-grid' ), |
| 675 | 'type' => Controls_Manager::SELECT, |
| 676 | 'options' => $column_options, |
| 677 | 'default' => '0', |
| 678 | 'tablet_default' => '0', |
| 679 | 'mobile_default' => '0', |
| 680 | 'description' => esc_html__( 'Choose Column for layout.', 'the-post-grid' ), |
| 681 | 'condition' => $grid_column_condition, |
| 682 | ] |
| 683 | ); |
| 684 | |
| 685 | if ( 'single' === $layout_type ) { |
| 686 | $ref->add_control( |
| 687 | 'enable_related_slider', |
| 688 | [ |
| 689 | 'label' => esc_html__( 'Enable Slider', 'the-post-grid' ), |
| 690 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 691 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 692 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 693 | 'return_value' => 'yes', |
| 694 | 'default' => 'yes', |
| 695 | ] |
| 696 | ); |
| 697 | |
| 698 | $ref->add_responsive_control( |
| 699 | 'slider_gap_2', |
| 700 | [ |
| 701 | 'label' => esc_html__( 'Grid Gap', 'the-post-grid' ), |
| 702 | 'type' => Controls_Manager::SLIDER, |
| 703 | 'size_units' => [ 'px' ], |
| 704 | 'range' => [ |
| 705 | 'px' => [ |
| 706 | 'min' => 0, |
| 707 | 'max' => 100, |
| 708 | 'step' => 1, |
| 709 | ], |
| 710 | ], |
| 711 | 'selectors' => [ |
| 712 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-slider-item' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}}; padding-bottom: calc({{SIZE}}{{UNIT}} * 2)', |
| 713 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};', |
| 714 | ], |
| 715 | 'condition' => [ |
| 716 | 'enable_related_slider!' => 'yes', |
| 717 | ], |
| 718 | ] |
| 719 | ); |
| 720 | } |
| 721 | |
| 722 | $ref->add_responsive_control( |
| 723 | $prefix . '_offset_col_width', |
| 724 | [ |
| 725 | 'label' => esc_html__( 'Offset Column Width', 'the-post-grid' ), |
| 726 | 'type' => Controls_Manager::SLIDER, |
| 727 | 'size_units' => [ '%' ], |
| 728 | 'range' => [ |
| 729 | 'px' => [ |
| 730 | 'min' => 30, |
| 731 | 'max' => 70, |
| 732 | 'step' => 1, |
| 733 | ], |
| 734 | '%' => [ |
| 735 | 'min' => 30, |
| 736 | 'max' => 70, |
| 737 | 'step' => 1, |
| 738 | ], |
| 739 | ], |
| 740 | 'selectors' => [ |
| 741 | '{{WRAPPER}} .tpg-el-main-wrapper .offset-left' => 'width: {{SIZE}}%;', |
| 742 | '{{WRAPPER}} .tpg-el-main-wrapper .offset-right' => 'width: calc( 100% - {{SIZE}}%);', |
| 743 | ], |
| 744 | 'condition' => [ |
| 745 | $prefix . '_layout' => [ |
| 746 | 'grid-layout5', |
| 747 | 'grid-layout5-2', |
| 748 | 'grid-layout6', |
| 749 | 'grid-layout6-2', |
| 750 | 'grid_hover-layout4', |
| 751 | 'grid_hover-layout4-2', |
| 752 | 'grid_hover-layout5', |
| 753 | 'grid_hover-layout5-2', |
| 754 | 'grid_hover-layout6', |
| 755 | 'grid_hover-layout6-2', |
| 756 | 'grid_hover-layout7', |
| 757 | 'grid_hover-layout7-2', |
| 758 | 'grid_hover-layout9', |
| 759 | 'grid_hover-layout9-2', |
| 760 | ], |
| 761 | ], |
| 762 | ] |
| 763 | ); |
| 764 | |
| 765 | |
| 766 | if ( 'grid' === $prefix ) { |
| 767 | $layout_style_opt = [ |
| 768 | 'tpg-even' => esc_html__( 'Grid', 'the-post-grid' ), |
| 769 | 'tpg-full-height' => esc_html__( 'Grid Equal Height', 'the-post-grid' ), |
| 770 | ]; |
| 771 | if ( rtTPG()->hasPro() ) { |
| 772 | $layout_style_new_opt = [ |
| 773 | 'masonry' => esc_html__( 'Masonry', 'the-post-grid' ), |
| 774 | ]; |
| 775 | $layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt ); |
| 776 | } |
| 777 | |
| 778 | $ref->add_control( |
| 779 | $prefix . '_layout_style', |
| 780 | [ |
| 781 | 'label' => esc_html__( 'Layout Style', 'the-post-grid' ), |
| 782 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 783 | 'default' => 'tpg-full-height', |
| 784 | 'options' => $layout_style_opt, |
| 785 | 'description' => esc_html__( 'If you use card border then equal height will work. ', 'the-post-grid' ) . $ref->get_pro_message( "masonry layout" ), |
| 786 | 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field', |
| 787 | 'condition' => [ |
| 788 | $prefix . '_layout!' => [ |
| 789 | 'grid-layout2', |
| 790 | 'grid-layout5', |
| 791 | 'grid-layout5-2', |
| 792 | 'grid-layout6', |
| 793 | 'grid-layout6-2', |
| 794 | 'grid-layout7', |
| 795 | 'grid-layout7-2' |
| 796 | ], |
| 797 | ], |
| 798 | ] |
| 799 | ); |
| 800 | } |
| 801 | |
| 802 | if ( ! in_array( $prefix, [ 'slider' ] ) ) { |
| 803 | $layout_align_css = [ |
| 804 | '{{WRAPPER}} .rt-tpg-container .grid-layout2 .rt-holder .post-right-content' => 'justify-content: {{VALUE}};', |
| 805 | ]; |
| 806 | |
| 807 | if ( $prefix === 'grid_hover' ) { |
| 808 | $layout_align_css = [ |
| 809 | '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'justify-content: {{VALUE}};', |
| 810 | ]; |
| 811 | } |
| 812 | |
| 813 | //Grid layout |
| 814 | $ref->add_control( |
| 815 | $prefix . '_layout_alignment', |
| 816 | [ |
| 817 | 'label' => esc_html__( 'Vertical Align', 'the-post-grid' ), |
| 818 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 819 | 'options' => [ |
| 820 | '' => esc_html__( 'Default', 'the-post-grid' ), |
| 821 | 'flex-start' => esc_html__( 'Start', 'the-post-grid' ), |
| 822 | 'center' => esc_html__( 'Center', 'the-post-grid' ), |
| 823 | 'flex-end' => esc_html__( 'End', 'the-post-grid' ), |
| 824 | 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ), |
| 825 | 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ), |
| 826 | ], |
| 827 | 'condition' => [ |
| 828 | $prefix . '_layout!' => [ |
| 829 | 'grid-layout1', |
| 830 | 'grid-layout3', |
| 831 | 'grid-layout4', |
| 832 | 'grid-layout5', |
| 833 | 'grid-layout5-2', |
| 834 | 'grid-layout6', |
| 835 | 'grid-layout6-2', |
| 836 | 'grid-layout7', |
| 837 | ], |
| 838 | ], |
| 839 | 'selectors' => $layout_align_css, |
| 840 | ] |
| 841 | ); |
| 842 | } |
| 843 | |
| 844 | if ( $prefix === 'slider' ) { |
| 845 | //Grid layout |
| 846 | $ref->add_control( |
| 847 | $prefix . '_layout_alignment_2', |
| 848 | [ |
| 849 | 'label' => esc_html__( 'Vertical Align', 'the-post-grid' ), |
| 850 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 851 | 'options' => [ |
| 852 | '' => esc_html__( 'Default', 'the-post-grid' ), |
| 853 | 'flex-start' => esc_html__( 'Start', 'the-post-grid' ), |
| 854 | 'center' => esc_html__( 'Center', 'the-post-grid' ), |
| 855 | 'flex-end' => esc_html__( 'End', 'the-post-grid' ), |
| 856 | 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ), |
| 857 | 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ), |
| 858 | ], |
| 859 | 'condition' => [ |
| 860 | $prefix . '_layout!' => [ |
| 861 | 'slider-layout1', |
| 862 | 'slider-layout2', |
| 863 | 'slider-layout3', |
| 864 | 'slider-layout13', |
| 865 | 'slider-layout4' |
| 866 | ], |
| 867 | ], |
| 868 | 'selectors' => [ |
| 869 | '{{WRAPPER}} .tpg-el-main-wrapper .grid-behaviour .rt-holder .rt-el-content-wrapper .gallery-content' => 'justify-content: {{VALUE}};height:100%;', |
| 870 | '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'justify-content: {{VALUE}};', |
| 871 | ], |
| 872 | ] |
| 873 | ); |
| 874 | } |
| 875 | |
| 876 | $ref->add_responsive_control( |
| 877 | 'full_wrapper_align', |
| 878 | [ |
| 879 | 'label' => esc_html__( 'Text Align', 'the-post-grid' ), |
| 880 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 881 | 'options' => [ |
| 882 | 'left' => [ |
| 883 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 884 | 'icon' => 'eicon-text-align-left', |
| 885 | ], |
| 886 | 'center' => [ |
| 887 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 888 | 'icon' => 'eicon-text-align-center', |
| 889 | ], |
| 890 | 'right' => [ |
| 891 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 892 | 'icon' => 'eicon-text-align-right', |
| 893 | ], |
| 894 | ], |
| 895 | 'prefix_class' => 'tpg-wrapper-align-', |
| 896 | 'render_type' => 'template', |
| 897 | 'toggle' => true, |
| 898 | 'selectors' => [ |
| 899 | '{{WRAPPER}} .tpg-post-holder div' => 'text-align: {{VALUE}};', |
| 900 | ], |
| 901 | 'condition' => [ |
| 902 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 903 | ], |
| 904 | |
| 905 | ] |
| 906 | ); |
| 907 | |
| 908 | $ref->end_controls_section(); |
| 909 | } |
| 910 | |
| 911 | |
| 912 | /** |
| 913 | * Front-end Filter Settings |
| 914 | * |
| 915 | * @param $ref |
| 916 | */ |
| 917 | public static function filter_settings( $ref ) { |
| 918 | $prefix = $ref->prefix; |
| 919 | |
| 920 | if ( ! rtTPG()->hasPro() ) { |
| 921 | return; |
| 922 | } |
| 923 | $ref->start_controls_section( |
| 924 | $prefix . '_filter_settings', |
| 925 | [ |
| 926 | 'label' => esc_html__( 'Filter (Front-end)', 'the-post-grid' ), |
| 927 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 928 | ] |
| 929 | ); |
| 930 | |
| 931 | $ref->add_control( |
| 932 | 'show_taxonomy_filter', |
| 933 | [ |
| 934 | 'label' => esc_html__( 'Taxonomy Filter', 'the-post-grid' ), |
| 935 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 936 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 937 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 938 | 'return_value' => 'show', |
| 939 | 'default' => 'hide', |
| 940 | ] |
| 941 | ); |
| 942 | |
| 943 | $ref->add_control( |
| 944 | 'show_author_filter', |
| 945 | [ |
| 946 | 'label' => esc_html__( 'Author filter', 'the-post-grid' ), |
| 947 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 948 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 949 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 950 | 'return_value' => 'show', |
| 951 | 'default' => 'hide', |
| 952 | ] |
| 953 | ); |
| 954 | |
| 955 | $ref->add_control( |
| 956 | 'show_order_by', |
| 957 | [ |
| 958 | 'label' => esc_html__( 'Order By Filter', 'the-post-grid' ), |
| 959 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 960 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 961 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 962 | 'return_value' => 'show', |
| 963 | 'default' => 'hide', |
| 964 | ] |
| 965 | ); |
| 966 | |
| 967 | $ref->add_control( |
| 968 | 'show_sort_order', |
| 969 | [ |
| 970 | 'label' => esc_html__( 'Sort Order Filter', 'the-post-grid' ), |
| 971 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 972 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 973 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 974 | 'return_value' => 'show', |
| 975 | 'default' => 'hide', |
| 976 | ] |
| 977 | ); |
| 978 | |
| 979 | $ref->add_control( |
| 980 | 'show_search', |
| 981 | [ |
| 982 | 'label' => esc_html__( 'Search filter', 'the-post-grid' ), |
| 983 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 984 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 985 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 986 | 'return_value' => 'show', |
| 987 | 'default' => 'hide', |
| 988 | ] |
| 989 | ); |
| 990 | |
| 991 | //TODO: Filter Settings |
| 992 | //====================================================== |
| 993 | |
| 994 | $front_end_filter_condition = [ |
| 995 | 'relation' => 'or', |
| 996 | 'terms' => [ |
| 997 | [ |
| 998 | 'name' => 'show_taxonomy_filter', |
| 999 | 'operator' => '==', |
| 1000 | 'value' => 'show', |
| 1001 | ], |
| 1002 | [ |
| 1003 | 'name' => 'show_author_filter', |
| 1004 | 'operator' => '==', |
| 1005 | 'value' => 'show', |
| 1006 | ], |
| 1007 | [ |
| 1008 | 'name' => 'show_order_by', |
| 1009 | 'operator' => '==', |
| 1010 | 'value' => 'show', |
| 1011 | ], |
| 1012 | [ |
| 1013 | 'name' => 'show_sort_order', |
| 1014 | 'operator' => '==', |
| 1015 | 'value' => 'show', |
| 1016 | ], |
| 1017 | [ |
| 1018 | 'name' => 'show_search', |
| 1019 | 'operator' => '==', |
| 1020 | 'value' => 'show', |
| 1021 | ], |
| 1022 | ], |
| 1023 | ]; |
| 1024 | |
| 1025 | |
| 1026 | $ref->add_control( |
| 1027 | 'filter_type', |
| 1028 | [ |
| 1029 | 'label' => esc_html__( 'Filter Type', 'the-post-grid' ), |
| 1030 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1031 | 'default' => 'dropdown', |
| 1032 | 'options' => [ |
| 1033 | 'dropdown' => esc_html__( 'Dropdown', 'the-post-grid' ), |
| 1034 | 'button' => esc_html__( 'Button', 'the-post-grid' ), |
| 1035 | ], |
| 1036 | 'render_type' => 'template', |
| 1037 | 'prefix_class' => 'tpg-filter-type-', |
| 1038 | 'conditions' => $front_end_filter_condition, |
| 1039 | 'separator' => 'before', |
| 1040 | ] |
| 1041 | ); |
| 1042 | |
| 1043 | $ref->add_control( |
| 1044 | 'filter_btn_style', |
| 1045 | [ |
| 1046 | 'label' => esc_html__( 'Filter Style', 'the-post-grid' ), |
| 1047 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1048 | 'default' => 'default', |
| 1049 | 'options' => [ |
| 1050 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 1051 | 'carousel' => esc_html__( 'Collapsable', 'the-post-grid' ), |
| 1052 | ], |
| 1053 | 'condition' => [ |
| 1054 | 'filter_type' => 'button', |
| 1055 | ], |
| 1056 | 'conditions' => $front_end_filter_condition, |
| 1057 | 'description' => esc_html__( 'If you use collapsable then only category section show on the filter', 'the-post-grid' ), |
| 1058 | ] |
| 1059 | ); |
| 1060 | |
| 1061 | $ref->add_responsive_control( |
| 1062 | 'filter_btn_item_per_page', |
| 1063 | [ |
| 1064 | 'label' => esc_html__( 'Button Item Per Slider', 'the-post-grid' ), |
| 1065 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1066 | 'options' => [ |
| 1067 | 'auto' => esc_html__( 'Auto', 'the-post-grid' ), |
| 1068 | '2' => esc_html__( '2', 'the-post-grid' ), |
| 1069 | '3' => esc_html__( '3', 'the-post-grid' ), |
| 1070 | '4' => esc_html__( '4', 'the-post-grid' ), |
| 1071 | '5' => esc_html__( '5', 'the-post-grid' ), |
| 1072 | '6' => esc_html__( '6', 'the-post-grid' ), |
| 1073 | '7' => esc_html__( '7', 'the-post-grid' ), |
| 1074 | '8' => esc_html__( '8', 'the-post-grid' ), |
| 1075 | '9' => esc_html__( '9', 'the-post-grid' ), |
| 1076 | '10' => esc_html__( '10', 'the-post-grid' ), |
| 1077 | '11' => esc_html__( '11', 'the-post-grid' ), |
| 1078 | '12' => esc_html__( '12', 'the-post-grid' ), |
| 1079 | ], |
| 1080 | 'default' => 'auto', |
| 1081 | 'tablet_default' => 'auto', |
| 1082 | 'mobile_default' => 'auto', |
| 1083 | 'condition' => [ |
| 1084 | 'filter_type' => 'button', |
| 1085 | 'filter_btn_style' => 'carousel', |
| 1086 | ], |
| 1087 | 'conditions' => $front_end_filter_condition, |
| 1088 | 'description' => esc_html__( 'If you use carousel then only category section show on the filter', 'the-post-grid' ), |
| 1089 | ] |
| 1090 | ); |
| 1091 | |
| 1092 | |
| 1093 | $post_types = Fns::get_post_types(); |
| 1094 | $_all_taxonomies = []; |
| 1095 | |
| 1096 | foreach ( $post_types as $post_type => $label ) { |
| 1097 | $_taxonomies = get_object_taxonomies( $post_type, 'object' ); |
| 1098 | if ( empty( $_taxonomies ) ) { |
| 1099 | continue; |
| 1100 | } |
| 1101 | $taxonomies_list = []; |
| 1102 | foreach ( $_taxonomies as $tax ) { |
| 1103 | if ( in_array( $tax->name, [ |
| 1104 | 'post_format', |
| 1105 | 'elementor_library_type', |
| 1106 | 'product_visibility', |
| 1107 | 'product_shipping_class' |
| 1108 | ] ) ) { |
| 1109 | continue; |
| 1110 | } |
| 1111 | if ( in_array( $tax->name, $_all_taxonomies ) ) { |
| 1112 | continue; |
| 1113 | } |
| 1114 | |
| 1115 | $taxonomies_list[ $tax->name ] = $tax->label; |
| 1116 | $_all_taxonomies[] = $tax->name; |
| 1117 | } |
| 1118 | |
| 1119 | if ( 'post' === $post_type ) { |
| 1120 | $default_cat = 'category'; |
| 1121 | } else if ( 'product' === $post_type ) { |
| 1122 | $default_cat = 'product_cat'; |
| 1123 | } else if ( 'download' === $post_type ) { |
| 1124 | $default_cat = 'download_category'; |
| 1125 | } else if ( 'docs' === $post_type ) { |
| 1126 | $default_cat = 'doc_category'; |
| 1127 | } else if ( 'lp_course' === $post_type ) { |
| 1128 | $default_cat = 'course_category'; |
| 1129 | } else { |
| 1130 | $taxonomie_keys = array_keys( $_taxonomies ); |
| 1131 | $filter_cat = array_filter( |
| 1132 | $taxonomie_keys, |
| 1133 | function ( $item ) { |
| 1134 | return strpos( $item, 'cat' ) !== false; |
| 1135 | } |
| 1136 | ); |
| 1137 | |
| 1138 | if ( is_array( $filter_cat ) && ! empty( $filter_cat ) ) { |
| 1139 | $default_cat = array_shift( $filter_cat ); |
| 1140 | } |
| 1141 | } |
| 1142 | |
| 1143 | |
| 1144 | $ref->add_control( |
| 1145 | $post_type . '_filter_taxonomy', |
| 1146 | [ |
| 1147 | 'label' => esc_html__( 'Choose Taxonomy', 'the-post-grid' ), |
| 1148 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1149 | 'default' => $default_cat, |
| 1150 | 'options' => $taxonomies_list, |
| 1151 | 'condition' => [ |
| 1152 | 'post_type' => $post_type, |
| 1153 | 'show_taxonomy_filter' => 'show', |
| 1154 | ], |
| 1155 | 'description' => esc_html__( 'Select a taxonomy for showing in filter', 'the-post-grid' ), |
| 1156 | ] |
| 1157 | ); |
| 1158 | |
| 1159 | foreach ( $_taxonomies as $tax ) { |
| 1160 | if ( in_array( $tax->name, [ |
| 1161 | 'post_format', |
| 1162 | 'elementor_library_type', |
| 1163 | 'product_visibility', |
| 1164 | 'product_shipping_class' |
| 1165 | ] ) ) { |
| 1166 | continue; |
| 1167 | } |
| 1168 | if ( in_array( $tax->name, $_all_taxonomies ) ) { |
| 1169 | continue; |
| 1170 | } |
| 1171 | |
| 1172 | $term_first = [ '0' => esc_html__( '--Select--', 'the-post-grid' ) ]; |
| 1173 | $term_lists = get_terms( |
| 1174 | [ |
| 1175 | 'taxonomy' => $tax->name, //Custom taxonomy name |
| 1176 | 'hide_empty' => true, |
| 1177 | 'fields' => "id=>name", |
| 1178 | ] |
| 1179 | ); |
| 1180 | |
| 1181 | $term_lists = $term_first + $term_lists; |
| 1182 | |
| 1183 | $ref->add_control( |
| 1184 | $tax->name . '_default_terms', |
| 1185 | [ |
| 1186 | 'label' => esc_html__( 'Default ', 'the-post-grid' ) . $tax->label, |
| 1187 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1188 | 'default' => '0', |
| 1189 | 'options' => $term_lists, |
| 1190 | 'condition' => [ |
| 1191 | $post_type . '_filter_taxonomy' => $tax->name, |
| 1192 | 'post_type' => $post_type, |
| 1193 | 'show_taxonomy_filter' => 'show', |
| 1194 | ], |
| 1195 | ] |
| 1196 | ); |
| 1197 | } |
| 1198 | |
| 1199 | } |
| 1200 | |
| 1201 | $front_end_filter_tax_condition = [ |
| 1202 | 'relation' => 'or', |
| 1203 | 'terms' => [ |
| 1204 | [ |
| 1205 | 'name' => 'show_taxonomy_filter', |
| 1206 | 'operator' => '==', |
| 1207 | 'value' => 'show', |
| 1208 | ], |
| 1209 | [ |
| 1210 | 'name' => 'show_author_filter', |
| 1211 | 'operator' => '==', |
| 1212 | 'value' => 'show', |
| 1213 | ], |
| 1214 | ], |
| 1215 | ]; |
| 1216 | |
| 1217 | $ref->add_control( |
| 1218 | 'filter_post_count', |
| 1219 | [ |
| 1220 | 'label' => esc_html__( 'Filter Post Count', 'the-post-grid' ), |
| 1221 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1222 | 'default' => 'no', |
| 1223 | 'options' => [ |
| 1224 | 'yes' => esc_html__( 'Yes', 'the-post-grid' ), |
| 1225 | 'no' => esc_html__( 'No', 'the-post-grid' ), |
| 1226 | ], |
| 1227 | 'conditions' => $front_end_filter_tax_condition, |
| 1228 | ] |
| 1229 | ); |
| 1230 | |
| 1231 | |
| 1232 | $ref->add_control( |
| 1233 | 'tgp_filter_taxonomy_hierarchical', |
| 1234 | [ |
| 1235 | 'label' => esc_html__( 'Tax Hierarchical', 'the-post-grid' ), |
| 1236 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1237 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 1238 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 1239 | 'return_value' => 'yes', |
| 1240 | 'default' => 'yes', |
| 1241 | 'conditions' => $front_end_filter_tax_condition, |
| 1242 | 'condition' => [ |
| 1243 | 'filter_type' => 'button', |
| 1244 | 'filter_btn_style' => 'default', |
| 1245 | ], |
| 1246 | ] |
| 1247 | ); |
| 1248 | |
| 1249 | $ref->add_control( |
| 1250 | 'tpg_hide_all_button', |
| 1251 | [ |
| 1252 | 'label' => esc_html__( 'Hide Show all button', 'the-post-grid' ), |
| 1253 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1254 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1255 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1256 | 'return_value' => 'yes', |
| 1257 | 'default' => 'yes', |
| 1258 | 'conditions' => $front_end_filter_tax_condition, |
| 1259 | 'condition' => [ |
| 1260 | 'filter_type' => 'button', |
| 1261 | ], |
| 1262 | ] |
| 1263 | ); |
| 1264 | |
| 1265 | $ref->add_control( |
| 1266 | 'tax_filter_all_text', |
| 1267 | [ |
| 1268 | 'label' => esc_html__( 'All Taxonomy Text', 'the-post-grid' ), |
| 1269 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1270 | 'placeholder' => esc_html__( 'Enter All Category Text Here..', 'the-post-grid' ), |
| 1271 | 'conditions' => $front_end_filter_tax_condition, |
| 1272 | ] |
| 1273 | ); |
| 1274 | $ref->add_control( |
| 1275 | 'author_filter_all_text', |
| 1276 | [ |
| 1277 | 'label' => esc_html__( 'All Users Text', 'the-post-grid' ), |
| 1278 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1279 | 'placeholder' => esc_html__( 'Enter All Users Text Here..', 'the-post-grid' ), |
| 1280 | 'condition' => [ |
| 1281 | 'show_author_filter' => 'show', |
| 1282 | 'filter_btn_style' => 'default', |
| 1283 | ], |
| 1284 | ] |
| 1285 | ); |
| 1286 | |
| 1287 | |
| 1288 | $ref->end_controls_section(); |
| 1289 | } |
| 1290 | |
| 1291 | |
| 1292 | /** |
| 1293 | * List Layout Settings |
| 1294 | * |
| 1295 | * @param $ref |
| 1296 | */ |
| 1297 | public static function list_layouts( $ref, $layout_type = '' ) { |
| 1298 | $prefix = $ref->prefix; |
| 1299 | $ref->start_controls_section( |
| 1300 | 'list_layout_settings', |
| 1301 | [ |
| 1302 | 'label' => esc_html__( 'Layout', 'the-post-grid' ), |
| 1303 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 1304 | ] |
| 1305 | ); |
| 1306 | |
| 1307 | $ref->add_control( |
| 1308 | 'list_layout', |
| 1309 | [ |
| 1310 | 'label' => esc_html__( 'Choose Layout', 'the-post-grid' ), |
| 1311 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 1312 | 'label_block' => true, |
| 1313 | 'options' => [ |
| 1314 | 'list-layout1' => [ |
| 1315 | 'title' => esc_html__( 'Layout 1', 'the-post-grid' ), |
| 1316 | ], |
| 1317 | 'list-layout2' => [ |
| 1318 | 'title' => esc_html__( 'Layout 2', 'the-post-grid' ), |
| 1319 | ], |
| 1320 | 'list-layout2-2' => [ |
| 1321 | 'title' => esc_html__( 'Layout 3', 'the-post-grid' ), |
| 1322 | ], |
| 1323 | 'list-layout3' => [ |
| 1324 | 'title' => esc_html__( 'Layout 4', 'the-post-grid' ), |
| 1325 | ], |
| 1326 | 'list-layout3-2' => [ |
| 1327 | 'title' => esc_html__( 'Layout 5', 'the-post-grid' ), |
| 1328 | ], |
| 1329 | 'list-layout4' => [ |
| 1330 | 'title' => esc_html__( 'Layout 6', 'the-post-grid' ), |
| 1331 | ], |
| 1332 | 'list-layout5' => [ |
| 1333 | 'title' => esc_html__( 'Layout 7', 'the-post-grid' ), |
| 1334 | ], |
| 1335 | ], |
| 1336 | 'toggle' => false, |
| 1337 | 'default' => 'list-layout1', |
| 1338 | 'style_transfer' => true, |
| 1339 | 'classes' => 'tpg-image-select list-layout ' . $ref->is_post_layout, |
| 1340 | ] |
| 1341 | ); |
| 1342 | |
| 1343 | $ref->add_control( |
| 1344 | 'layout_options_heading2', |
| 1345 | [ |
| 1346 | 'label' => esc_html__( 'Layout Options:', 'the-post-grid' ), |
| 1347 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 1348 | 'classes' => 'tpg-control-type-heading', |
| 1349 | ] |
| 1350 | ); |
| 1351 | |
| 1352 | $ref->add_responsive_control( |
| 1353 | 'list_column', |
| 1354 | [ |
| 1355 | 'label' => esc_html__( 'Column', 'the-post-grid' ), |
| 1356 | 'type' => Controls_Manager::SELECT, |
| 1357 | 'options' => [ |
| 1358 | '0' => esc_html__( 'Default from layout', 'the-post-grid' ), |
| 1359 | '12' => esc_html__( '1 Columns', 'the-post-grid' ), |
| 1360 | '6' => esc_html__( '2 Columns', 'the-post-grid' ), |
| 1361 | '4' => esc_html__( '3 Columns', 'the-post-grid' ), |
| 1362 | '3' => esc_html__( '4 Columns', 'the-post-grid' ), |
| 1363 | ], |
| 1364 | 'default' => '0', |
| 1365 | 'tablet_default' => '0', |
| 1366 | 'mobile_default' => '0', |
| 1367 | 'description' => esc_html__( 'Choose Column for layout', 'the-post-grid' ), |
| 1368 | 'condition' => [ |
| 1369 | 'list_layout!' => [ 'list-layout2', 'list-layout2-2', 'list-layout3', 'list-layout3-2', 'list-layout4' ], |
| 1370 | ], |
| 1371 | ] |
| 1372 | ); |
| 1373 | |
| 1374 | |
| 1375 | $ref->add_responsive_control( |
| 1376 | 'list_layout_alignment', |
| 1377 | [ |
| 1378 | 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ), |
| 1379 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1380 | 'options' => [ |
| 1381 | '' => esc_html__( 'Default', 'the-post-grid' ), |
| 1382 | 'flex-start' => esc_html__( 'Start', 'the-post-grid' ), |
| 1383 | 'center' => esc_html__( 'Center', 'the-post-grid' ), |
| 1384 | 'flex-end' => esc_html__( 'End', 'the-post-grid' ), |
| 1385 | 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ), |
| 1386 | 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ), |
| 1387 | ], |
| 1388 | 'selectors' => [ |
| 1389 | '{{WRAPPER}} .tpg-el-main-wrapper .list-behaviour .rt-holder .rt-el-content-wrapper' => 'align-items: {{VALUE}};', |
| 1390 | ], |
| 1391 | 'condition' => [ |
| 1392 | 'list_layout!' => [ 'list-layout2', 'list-layout2-2' ], |
| 1393 | ], |
| 1394 | ] |
| 1395 | ); |
| 1396 | |
| 1397 | $ref->add_responsive_control( |
| 1398 | 'list_left_side_width', |
| 1399 | [ |
| 1400 | 'label' => esc_html__( 'Offset Width', 'the-post-grid' ), |
| 1401 | 'type' => Controls_Manager::SLIDER, |
| 1402 | 'size_units' => [ '%' ], |
| 1403 | 'range' => [ |
| 1404 | 'px' => [ |
| 1405 | 'min' => 0, |
| 1406 | 'max' => 700, |
| 1407 | 'step' => 5, |
| 1408 | ], |
| 1409 | '%' => [ |
| 1410 | 'min' => 0, |
| 1411 | 'max' => 100, |
| 1412 | ], |
| 1413 | ], |
| 1414 | 'selectors' => [ |
| 1415 | '{{WRAPPER}} .rt-tpg-container .list-layout-wrapper .offset-left' => 'width: {{SIZE}}%;', |
| 1416 | '{{WRAPPER}} .rt-tpg-container .list-layout-wrapper .offset-right' => 'width: calc( 100% - {{SIZE}}%);', |
| 1417 | ], |
| 1418 | 'condition' => [ |
| 1419 | 'list_layout' => [ 'list-layout2', 'list-layout3', 'list-layout2-2', 'list-layout3-2' ], |
| 1420 | ], |
| 1421 | ] |
| 1422 | ); |
| 1423 | |
| 1424 | |
| 1425 | $layout_style_opt = [ |
| 1426 | 'tpg-even' => esc_html__( ucwords( $ref->prefix ) . ' Default', 'the-post-grid' ), |
| 1427 | ]; |
| 1428 | if ( rtTPG()->hasPro() ) { |
| 1429 | $layout_style_new_opt = [ |
| 1430 | 'masonry' => esc_html__( 'Masonry', 'the-post-grid' ), |
| 1431 | ]; |
| 1432 | $layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt ); |
| 1433 | } |
| 1434 | |
| 1435 | $ref->add_control( |
| 1436 | 'list_layout_style', |
| 1437 | [ |
| 1438 | 'label' => esc_html__( 'Layout Style', 'the-post-grid' ), |
| 1439 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1440 | 'default' => 'tpg-even', |
| 1441 | 'options' => $layout_style_opt, |
| 1442 | 'description' => $ref->get_pro_message( "masonry layout" ), |
| 1443 | 'condition' => [ |
| 1444 | 'list_layout' => [ 'list-layout1', 'list-layout5' ], |
| 1445 | 'list_column!' => [ '0', '12' ], |
| 1446 | ], |
| 1447 | ] |
| 1448 | ); |
| 1449 | |
| 1450 | $ref->add_responsive_control( |
| 1451 | 'full_wrapper_align', |
| 1452 | [ |
| 1453 | 'label' => esc_html__( 'Text Align', 'the-post-grid' ), |
| 1454 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 1455 | 'options' => [ |
| 1456 | 'left' => [ |
| 1457 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 1458 | 'icon' => 'eicon-text-align-left', |
| 1459 | ], |
| 1460 | 'center' => [ |
| 1461 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 1462 | 'icon' => 'eicon-text-align-center', |
| 1463 | ], |
| 1464 | 'right' => [ |
| 1465 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 1466 | 'icon' => 'eicon-text-align-right', |
| 1467 | ], |
| 1468 | ], |
| 1469 | 'selectors' => [ |
| 1470 | '{{WRAPPER}} .tpg-post-holder div' => 'text-align: {{VALUE}};', |
| 1471 | ], |
| 1472 | 'render_type' => 'template', |
| 1473 | 'prefix_class' => 'tpg-wrapper-align-', |
| 1474 | 'toggle' => true, |
| 1475 | ] |
| 1476 | ); |
| 1477 | |
| 1478 | $ref->end_controls_section(); |
| 1479 | } |
| 1480 | |
| 1481 | /** |
| 1482 | * Pagination and Load more style tab |
| 1483 | * |
| 1484 | * @param $ref |
| 1485 | * @param bool $is_print |
| 1486 | */ |
| 1487 | public static function pagination_settings( $ref, $layout_type = '' ) { |
| 1488 | $ref->start_controls_section( |
| 1489 | 'pagination_settings', |
| 1490 | [ |
| 1491 | 'label' => esc_html__( 'Pagination', 'the-post-grid' ), |
| 1492 | 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 1493 | ] |
| 1494 | ); |
| 1495 | |
| 1496 | $ref->add_control( |
| 1497 | 'show_pagination', |
| 1498 | [ |
| 1499 | 'label' => esc_html__( 'Show Pagination', 'the-post-grid' ), |
| 1500 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1501 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1502 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1503 | 'return_value' => 'show', |
| 1504 | 'default' => 'default', |
| 1505 | 'render_type' => 'template', |
| 1506 | // 'prefix_class' => 'pagination-visibility-', |
| 1507 | ] |
| 1508 | ); |
| 1509 | |
| 1510 | |
| 1511 | if ( 'archive' !== $layout_type ) { |
| 1512 | $ref->add_control( |
| 1513 | 'display_per_page', |
| 1514 | [ |
| 1515 | 'label' => esc_html__( 'Display Per Page', 'the-post-grid' ), |
| 1516 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 1517 | 'default' => 6, |
| 1518 | 'description' => esc_html__( 'Enter how may posts will display per page', 'the-post-grid' ), |
| 1519 | 'condition' => [ |
| 1520 | 'show_pagination' => 'show', |
| 1521 | ], |
| 1522 | ] |
| 1523 | ); |
| 1524 | } |
| 1525 | |
| 1526 | |
| 1527 | $default_pagination = 'pagination'; |
| 1528 | if ( 'archive' == $layout_type ) { |
| 1529 | $pagination_type = []; |
| 1530 | $default_pagination = 'pagination_ajax'; |
| 1531 | } else { |
| 1532 | $pagination_type = [ |
| 1533 | 'pagination' => esc_html__( 'Default Pagination', 'the-post-grid' ), |
| 1534 | ]; |
| 1535 | } |
| 1536 | |
| 1537 | if ( rtTPG()->hasPro() ) { |
| 1538 | $pagination_type_pro = [ |
| 1539 | 'pagination_ajax' => esc_html__( 'Ajax Pagination ( Only for Grid )', 'the-post-grid' ), |
| 1540 | 'load_more' => esc_html__( 'Load More - On Click', 'the-post-grid' ), |
| 1541 | 'load_on_scroll' => esc_html__( 'Load On Scroll', 'the-post-grid' ), |
| 1542 | ]; |
| 1543 | $pagination_type = array_merge( $pagination_type, $pagination_type_pro ); |
| 1544 | } |
| 1545 | |
| 1546 | $ref->add_control( |
| 1547 | 'pagination_type', |
| 1548 | [ |
| 1549 | 'label' => esc_html__( 'Pagination Type', 'the-post-grid' ), |
| 1550 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1551 | 'default' => $default_pagination, |
| 1552 | 'options' => $pagination_type, |
| 1553 | 'description' => $ref->get_pro_message( 'loadmore and ajax pagination' ), |
| 1554 | 'condition' => [ |
| 1555 | 'show_pagination' => 'show', |
| 1556 | ], |
| 1557 | ] |
| 1558 | ); |
| 1559 | |
| 1560 | $ref->add_control( |
| 1561 | 'ajax_pagination_type', |
| 1562 | [ |
| 1563 | 'label' => esc_html__( 'Enable Ajax Next Previous', 'the-post-grid' ), |
| 1564 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1565 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 1566 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 1567 | 'return_value' => 'yes', |
| 1568 | 'default' => false, |
| 1569 | 'condition' => [ |
| 1570 | 'pagination_type' => 'pagination_ajax', |
| 1571 | 'show_pagination' => 'show', |
| 1572 | ], |
| 1573 | 'prefix_class' => 'ajax-pagination-type-next-prev-', |
| 1574 | ] |
| 1575 | ); |
| 1576 | |
| 1577 | |
| 1578 | $ref->add_control( |
| 1579 | 'load_more_button_text', |
| 1580 | [ |
| 1581 | 'label' => esc_html__( 'Button Text', 'the-post-grid' ), |
| 1582 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1583 | 'default' => esc_html__( 'Load More', 'the-post-grid' ), |
| 1584 | 'condition' => [ |
| 1585 | 'pagination_type' => 'load_more', |
| 1586 | 'show_pagination' => 'show', |
| 1587 | ], |
| 1588 | ] |
| 1589 | ); |
| 1590 | |
| 1591 | |
| 1592 | $ref->end_controls_section(); |
| 1593 | } |
| 1594 | |
| 1595 | /** |
| 1596 | * Get Field Selections |
| 1597 | * |
| 1598 | * @param $ref |
| 1599 | */ |
| 1600 | |
| 1601 | public static function field_selection( $ref ) { |
| 1602 | $prefix = $ref->prefix; |
| 1603 | $ref->start_controls_section( |
| 1604 | 'field_selection_settings', |
| 1605 | [ |
| 1606 | 'label' => esc_html__( 'Field Selection', 'the-post-grid' ), |
| 1607 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 1608 | ] |
| 1609 | ); |
| 1610 | |
| 1611 | $ref->add_control( |
| 1612 | 'show_section_title', |
| 1613 | [ |
| 1614 | 'label' => esc_html__( 'Section Title', 'the-post-grid' ), |
| 1615 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1616 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1617 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1618 | 'return_value' => 'show', |
| 1619 | 'default' => 'show', |
| 1620 | 'render_type' => 'template', |
| 1621 | // 'prefix_class' => 'section-title-visibility-', |
| 1622 | ] |
| 1623 | ); |
| 1624 | |
| 1625 | $ref->add_control( |
| 1626 | 'show_title', |
| 1627 | [ |
| 1628 | 'label' => esc_html__( 'Post Title', 'the-post-grid' ), |
| 1629 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1630 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1631 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1632 | 'return_value' => 'show', |
| 1633 | 'default' => 'show', |
| 1634 | 'render_type' => 'template', |
| 1635 | // 'prefix_class' => 'title-visibility-', |
| 1636 | 'condition' => [ |
| 1637 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1638 | ], |
| 1639 | |
| 1640 | ] |
| 1641 | ); |
| 1642 | |
| 1643 | $ref->add_control( |
| 1644 | 'show_thumb', |
| 1645 | [ |
| 1646 | 'label' => esc_html__( 'Post Thumbnail', 'the-post-grid' ), |
| 1647 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1648 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1649 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1650 | 'return_value' => 'show', |
| 1651 | 'default' => 'show', |
| 1652 | 'render_type' => 'template', |
| 1653 | // 'prefix_class' => 'thumbnail-visibility-', |
| 1654 | ] |
| 1655 | ); |
| 1656 | |
| 1657 | $ref->add_control( |
| 1658 | 'show_excerpt', |
| 1659 | [ |
| 1660 | 'label' => esc_html__( 'Post Excerpt', 'the-post-grid' ), |
| 1661 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1662 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1663 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1664 | 'return_value' => 'show', |
| 1665 | 'default' => 'show', |
| 1666 | 'render_type' => 'template', |
| 1667 | // 'prefix_class' => 'excerpt-visibility-', |
| 1668 | 'condition' => [ |
| 1669 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1670 | ], |
| 1671 | ] |
| 1672 | ); |
| 1673 | |
| 1674 | $ref->add_control( |
| 1675 | 'show_meta', |
| 1676 | [ |
| 1677 | 'label' => esc_html__( 'Meta Data', 'the-post-grid' ), |
| 1678 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1679 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1680 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1681 | 'return_value' => 'show', |
| 1682 | 'default' => 'show', |
| 1683 | 'render_type' => 'template', |
| 1684 | 'prefix_class' => 'meta-visibility-', |
| 1685 | 'condition' => [ |
| 1686 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1687 | ], |
| 1688 | ] |
| 1689 | ); |
| 1690 | |
| 1691 | $ref->add_control( |
| 1692 | 'show_date', |
| 1693 | [ |
| 1694 | 'label' => esc_html__( 'Post Date', 'the-post-grid' ), |
| 1695 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1696 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1697 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1698 | 'return_value' => 'show', |
| 1699 | 'default' => 'show', |
| 1700 | 'render_type' => 'template', |
| 1701 | 'classes' => 'tpg-padding-left', |
| 1702 | // 'prefix_class' => 'date-visibility-', |
| 1703 | 'condition' => [ |
| 1704 | 'show_meta' => 'show', |
| 1705 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1706 | ], |
| 1707 | ] |
| 1708 | ); |
| 1709 | |
| 1710 | $ref->add_control( |
| 1711 | 'show_category', |
| 1712 | [ |
| 1713 | 'label' => esc_html__( 'Post Categories', 'the-post-grid' ), |
| 1714 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1715 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1716 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1717 | 'return_value' => 'show', |
| 1718 | 'default' => 'show', |
| 1719 | 'render_type' => 'template', |
| 1720 | 'classes' => 'tpg-padding-left', |
| 1721 | // 'prefix_class' => 'category-visibility-', |
| 1722 | 'condition' => [ |
| 1723 | 'show_meta' => 'show', |
| 1724 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1725 | ], |
| 1726 | ] |
| 1727 | ); |
| 1728 | |
| 1729 | $ref->add_control( |
| 1730 | 'show_author', |
| 1731 | [ |
| 1732 | 'label' => esc_html__( 'Post Author', 'the-post-grid' ), |
| 1733 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1734 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1735 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1736 | 'return_value' => 'show', |
| 1737 | 'default' => 'show', |
| 1738 | 'classes' => 'tpg-padding-left', |
| 1739 | 'condition' => [ |
| 1740 | 'show_meta' => 'show', |
| 1741 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1742 | ], |
| 1743 | ] |
| 1744 | ); |
| 1745 | |
| 1746 | $ref->add_control( |
| 1747 | 'show_tags', |
| 1748 | [ |
| 1749 | 'label' => esc_html__( 'Post Tags', 'the-post-grid' ), |
| 1750 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1751 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1752 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1753 | 'return_value' => 'show', |
| 1754 | 'default' => false, |
| 1755 | 'classes' => 'tpg-padding-left', |
| 1756 | 'condition' => [ |
| 1757 | 'show_meta' => 'show', |
| 1758 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1759 | ], |
| 1760 | ] |
| 1761 | ); |
| 1762 | |
| 1763 | $ref->add_control( |
| 1764 | 'show_comment_count', |
| 1765 | [ |
| 1766 | 'label' => esc_html__( 'Post Comment Count', 'the-post-grid' ), |
| 1767 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1768 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1769 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1770 | 'return_value' => 'show', |
| 1771 | 'default' => false, |
| 1772 | 'classes' => 'tpg-padding-left', |
| 1773 | 'condition' => [ |
| 1774 | 'show_meta' => 'show', |
| 1775 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1776 | ], |
| 1777 | ] |
| 1778 | ); |
| 1779 | |
| 1780 | $ref->add_control( |
| 1781 | 'show_post_count', |
| 1782 | [ |
| 1783 | 'label' => esc_html__( 'Post View Count', 'the-post-grid' ) . $ref->pro_label, |
| 1784 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1785 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1786 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1787 | 'return_value' => 'show', |
| 1788 | 'default' => false, |
| 1789 | 'classes' => rtTPG()->hasPro() ? 'tpg-padding-left' : 'the-post-grid-field-hide tpg-padding-left', |
| 1790 | |
| 1791 | 'condition' => [ |
| 1792 | 'show_meta' => 'show', |
| 1793 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1794 | ], |
| 1795 | ] |
| 1796 | ); |
| 1797 | |
| 1798 | $ref->add_control( |
| 1799 | 'show_read_more', |
| 1800 | [ |
| 1801 | 'label' => esc_html__( 'Read More Button', 'the-post-grid' ), |
| 1802 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1803 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1804 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1805 | 'return_value' => 'show', |
| 1806 | 'default' => 'show', |
| 1807 | 'condition' => [ |
| 1808 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1809 | ], |
| 1810 | ] |
| 1811 | ); |
| 1812 | |
| 1813 | $ref->add_control( |
| 1814 | 'show_social_share', |
| 1815 | [ |
| 1816 | 'label' => esc_html__( 'Social Share', 'the-post-grid' ) . $ref->pro_label, |
| 1817 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1818 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1819 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1820 | 'return_value' => 'show', |
| 1821 | 'default' => 'default', |
| 1822 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 1823 | 'condition' => [ |
| 1824 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1825 | ], |
| 1826 | ] |
| 1827 | ); |
| 1828 | |
| 1829 | if ( Fns::is_woocommerce() ) { |
| 1830 | $ref->add_control( |
| 1831 | 'show_woocommerce_rating', |
| 1832 | [ |
| 1833 | 'label' => __( 'Rating (WooCommerce)', 'the-post-grid' ), |
| 1834 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1835 | 'label_on' => __( 'Show', 'the-post-grid' ), |
| 1836 | 'label_off' => __( 'Hide', 'the-post-grid' ), |
| 1837 | 'return_value' => 'show', |
| 1838 | 'default' => 'default', |
| 1839 | 'condition' => [ |
| 1840 | 'post_type' => [ 'product', 'download' ], |
| 1841 | ], |
| 1842 | ] |
| 1843 | ); |
| 1844 | } |
| 1845 | |
| 1846 | |
| 1847 | $cf = Fns::is_acf(); |
| 1848 | if ( $cf ) { |
| 1849 | $ref->add_control( |
| 1850 | 'show_acf', |
| 1851 | [ |
| 1852 | 'label' => esc_html__( 'Advanced Custom Field', 'the-post-grid' ) . $ref->pro_label, |
| 1853 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1854 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1855 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1856 | 'return_value' => 'show', |
| 1857 | 'default' => false, |
| 1858 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 1859 | 'condition' => [ |
| 1860 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 1861 | ], |
| 1862 | ] |
| 1863 | ); |
| 1864 | } |
| 1865 | |
| 1866 | $ref->end_controls_section(); |
| 1867 | } |
| 1868 | |
| 1869 | |
| 1870 | /** |
| 1871 | * Section Title Settings |
| 1872 | * |
| 1873 | * @param $ref |
| 1874 | */ |
| 1875 | |
| 1876 | public static function section_title_settings( $ref, $layout_type = '' ) { |
| 1877 | $default = $layout_type == 'single' ? 'Related Posts' : 'Section Title'; |
| 1878 | $ref->start_controls_section( |
| 1879 | 'section_title_settings', |
| 1880 | [ |
| 1881 | 'label' => esc_html__( 'Section Title', 'the-post-grid' ), |
| 1882 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 1883 | 'condition' => [ |
| 1884 | 'show_section_title' => 'show', |
| 1885 | ], |
| 1886 | ] |
| 1887 | ); |
| 1888 | |
| 1889 | |
| 1890 | $ref->add_control( |
| 1891 | 'section_title_style', |
| 1892 | [ |
| 1893 | 'label' => esc_html__( 'Section Title Style', 'the-post-grid' ), |
| 1894 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1895 | 'default' => 'style1', |
| 1896 | 'options' => [ |
| 1897 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 1898 | 'style1' => esc_html__( 'Style 1', 'the-post-grid' ), |
| 1899 | 'style2' => esc_html__( 'Style 2', 'the-post-grid' ), |
| 1900 | 'style3' => esc_html__( 'Style 3', 'the-post-grid' ), |
| 1901 | ], |
| 1902 | 'prefix_class' => 'section-title-style-', |
| 1903 | 'render_type' => 'template', |
| 1904 | 'condition' => [ |
| 1905 | 'show_section_title' => 'show', |
| 1906 | ], |
| 1907 | ] |
| 1908 | ); |
| 1909 | |
| 1910 | if ( 'single' === $layout_type ) { |
| 1911 | $ref->add_control( |
| 1912 | 'section_title_source', |
| 1913 | [ |
| 1914 | 'label' => esc_html__( 'Title source', 'the-post-grid' ), |
| 1915 | 'type' => \Elementor\Controls_Manager::HIDDEN, |
| 1916 | 'default' => 'custom_title', |
| 1917 | ] |
| 1918 | ); |
| 1919 | } else { |
| 1920 | $ref->add_control( |
| 1921 | 'section_title_source', |
| 1922 | [ |
| 1923 | 'label' => esc_html__( 'Title Source', 'the-post-grid' ), |
| 1924 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1925 | 'default' => 'custom_title', |
| 1926 | 'options' => [ |
| 1927 | 'page_title' => esc_html__( 'Page Title', 'the-post-grid' ), |
| 1928 | 'custom_title' => esc_html__( 'Custom Title', 'the-post-grid' ), |
| 1929 | ], |
| 1930 | 'condition' => [ |
| 1931 | 'show_section_title' => 'show', |
| 1932 | ], |
| 1933 | ] |
| 1934 | ); |
| 1935 | } |
| 1936 | |
| 1937 | $ref->add_control( |
| 1938 | 'section_title_text', |
| 1939 | [ |
| 1940 | 'label' => esc_html__( 'Title', 'the-post-grid' ), |
| 1941 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1942 | 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ), |
| 1943 | 'default' => esc_html__( $default, 'the-post-grid' ), |
| 1944 | 'label_block' => true, |
| 1945 | 'condition' => [ |
| 1946 | 'section_title_source' => 'custom_title', |
| 1947 | 'show_section_title' => 'show', |
| 1948 | ], |
| 1949 | ] |
| 1950 | ); |
| 1951 | |
| 1952 | |
| 1953 | $ref->add_control( |
| 1954 | 'title_prefix', |
| 1955 | [ |
| 1956 | 'label' => esc_html__( 'Title Prefix Text', 'the-post-grid' ), |
| 1957 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1958 | 'placeholder' => esc_html__( 'Title prefix text', 'the-post-grid' ), |
| 1959 | 'condition' => [ |
| 1960 | 'section_title_source' => 'page_title', |
| 1961 | ], |
| 1962 | ] |
| 1963 | ); |
| 1964 | |
| 1965 | $ref->add_control( |
| 1966 | 'title_suffix', |
| 1967 | [ |
| 1968 | 'label' => esc_html__( 'Title Suffix Text', 'the-post-grid' ), |
| 1969 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1970 | 'placeholder' => esc_html__( 'Title suffix text', 'the-post-grid' ), |
| 1971 | 'condition' => [ |
| 1972 | 'section_title_source' => 'page_title', |
| 1973 | ], |
| 1974 | ] |
| 1975 | ); |
| 1976 | |
| 1977 | $ref->add_control( |
| 1978 | 'section_title_tag', |
| 1979 | [ |
| 1980 | 'label' => esc_html__( 'Title Tag', 'the-post-grid' ), |
| 1981 | 'type' => Controls_Manager::SELECT, |
| 1982 | 'default' => 'h2', |
| 1983 | 'options' => [ |
| 1984 | 'h1' => esc_html__( 'H1', 'the-post-grid' ), |
| 1985 | 'h2' => esc_html__( 'H2', 'the-post-grid' ), |
| 1986 | 'h3' => esc_html__( 'H3', 'the-post-grid' ), |
| 1987 | 'h4' => esc_html__( 'H4', 'the-post-grid' ), |
| 1988 | 'h5' => esc_html__( 'H5', 'the-post-grid' ), |
| 1989 | 'h6' => esc_html__( 'H6', 'the-post-grid' ), |
| 1990 | ], |
| 1991 | 'condition' => [ |
| 1992 | 'show_section_title' => 'show', |
| 1993 | ], |
| 1994 | ] |
| 1995 | ); |
| 1996 | |
| 1997 | if ( 'archive' == $layout_type ) { |
| 1998 | $ref->add_control( |
| 1999 | 'show_cat_desc', |
| 2000 | [ |
| 2001 | 'label' => esc_html__( 'Show Archive Description', 'the-post-grid' ), |
| 2002 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2003 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 2004 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2005 | 'return_value' => 'yes', |
| 2006 | 'default' => false, |
| 2007 | ] |
| 2008 | ); |
| 2009 | } |
| 2010 | |
| 2011 | $ref->end_controls_section(); |
| 2012 | } |
| 2013 | |
| 2014 | |
| 2015 | /** |
| 2016 | * Thumbnail Settings |
| 2017 | * |
| 2018 | * @param $ref |
| 2019 | */ |
| 2020 | |
| 2021 | public static function post_thumbnail_settings( $ref ) { |
| 2022 | $prefix = $ref->prefix; |
| 2023 | $ref->start_controls_section( |
| 2024 | 'post_thumbnail_settings', |
| 2025 | [ |
| 2026 | 'label' => esc_html__( 'Thumbnail', 'the-post-grid' ), |
| 2027 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 2028 | 'condition' => [ |
| 2029 | 'show_thumb' => 'show', |
| 2030 | ], |
| 2031 | ] |
| 2032 | ); |
| 2033 | |
| 2034 | |
| 2035 | $ref->add_control( |
| 2036 | 'media_source', |
| 2037 | [ |
| 2038 | 'label' => esc_html__( 'Media Source', 'the-post-grid' ), |
| 2039 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2040 | 'default' => 'feature_image', |
| 2041 | 'options' => [ |
| 2042 | 'feature_image' => esc_html__( 'Feature Image', 'the-post-grid' ), |
| 2043 | 'first_image' => esc_html__( 'First Image from content', 'the-post-grid' ), |
| 2044 | ], |
| 2045 | ] |
| 2046 | ); |
| 2047 | |
| 2048 | $thumb_exclude = ''; |
| 2049 | if ( ! rtTPG()->hasPro() ) { |
| 2050 | $thumb_exclude = 'custom'; |
| 2051 | } |
| 2052 | |
| 2053 | |
| 2054 | //Default Image |
| 2055 | $ref->add_group_control( |
| 2056 | \Elementor\Group_Control_Image_Size::get_type(), |
| 2057 | [ |
| 2058 | 'name' => 'image', |
| 2059 | 'exclude' => [ $thumb_exclude ], |
| 2060 | 'default' => 'medium_large', |
| 2061 | 'label' => $ref->get_pro_message( "custom dimension." ), |
| 2062 | 'condition' => [ |
| 2063 | 'media_source' => 'feature_image', |
| 2064 | ], |
| 2065 | ] |
| 2066 | ); |
| 2067 | |
| 2068 | $ref->add_control( |
| 2069 | 'img_crop_style', |
| 2070 | [ |
| 2071 | 'label' => esc_html__( 'Image Crop Style', 'the-post-grid' ), |
| 2072 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2073 | 'default' => 'hard', |
| 2074 | 'options' => [ |
| 2075 | 'soft' => esc_html__( 'Soft Crop', 'the-post-grid' ), |
| 2076 | 'hard' => esc_html__( 'Hard Crop', 'the-post-grid' ), |
| 2077 | ], |
| 2078 | 'condition' => [ |
| 2079 | 'image_size' => 'custom', |
| 2080 | 'media_source' => 'feature_image', |
| 2081 | ], |
| 2082 | ] |
| 2083 | ); |
| 2084 | |
| 2085 | |
| 2086 | $thumb_condition = [ |
| 2087 | 'media_source' => 'feature_image', |
| 2088 | 'grid_layout' => [ 'grid-layout5', 'grid-layout5-2', 'grid-layout6', 'grid-layout6-2' ], |
| 2089 | ]; |
| 2090 | |
| 2091 | if ( $ref->prefix === 'list' ) { |
| 2092 | $thumb_condition = [ |
| 2093 | 'media_source' => 'feature_image', |
| 2094 | 'list_layout' => [ 'list-layout2', 'list-layout3', 'list-layout2-2', 'list-layout3-2' ], |
| 2095 | ]; |
| 2096 | } |
| 2097 | |
| 2098 | if ( $ref->prefix === 'grid_hover' ) { |
| 2099 | $thumb_condition = [ |
| 2100 | 'media_source' => 'feature_image', |
| 2101 | 'grid_hover_layout' => [ |
| 2102 | 'grid_hover-layout4', |
| 2103 | 'grid_hover-layout4-2', |
| 2104 | 'grid_hover-layout5', |
| 2105 | 'grid_hover-layout5-2', |
| 2106 | 'grid_hover-layout6', |
| 2107 | 'grid_hover-layout6-2', |
| 2108 | 'grid_hover-layout7', |
| 2109 | 'grid_hover-layout7-2', |
| 2110 | 'grid_hover-layout9', |
| 2111 | 'grid_hover-layout9-2', |
| 2112 | ], |
| 2113 | ]; |
| 2114 | } |
| 2115 | if ( $ref->prefix === 'slider' ) { |
| 2116 | $thumb_condition = [ |
| 2117 | 'media_source' => 'feature_image', |
| 2118 | 'slider_layout' => [ 'slider-layout10' ], |
| 2119 | ]; |
| 2120 | } |
| 2121 | |
| 2122 | //Offset Image |
| 2123 | $ref->add_group_control( |
| 2124 | \Elementor\Group_Control_Image_Size::get_type(), |
| 2125 | [ |
| 2126 | 'name' => 'image_offset', |
| 2127 | 'exclude' => [ 'custom' ], |
| 2128 | 'default' => 'medium_large', |
| 2129 | 'condition' => $thumb_condition, |
| 2130 | 'classes' => 'tpg-offset-thumb-size', |
| 2131 | ] |
| 2132 | ); |
| 2133 | |
| 2134 | if ( 'list' == $prefix ) { |
| 2135 | $ref->add_responsive_control( |
| 2136 | 'list_image_side_width', |
| 2137 | [ |
| 2138 | 'label' => esc_html__( 'List Image Width', 'the-post-grid' ), |
| 2139 | 'type' => Controls_Manager::SLIDER, |
| 2140 | 'size_units' => [ 'px', '%' ], |
| 2141 | 'range' => [ |
| 2142 | 'px' => [ |
| 2143 | 'min' => 0, |
| 2144 | 'max' => 700, |
| 2145 | 'step' => 5, |
| 2146 | ], |
| 2147 | '%' => [ |
| 2148 | 'min' => 0, |
| 2149 | 'max' => 100, |
| 2150 | ], |
| 2151 | ], |
| 2152 | 'selectors' => [ |
| 2153 | '{{WRAPPER}} .rt-tpg-container .list-layout-wrapper [class*="rt-col"]:not(.offset-left) .rt-holder .tpg-el-image-wrap' => 'flex: 0 0 {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};', |
| 2154 | ], |
| 2155 | 'condition' => [ |
| 2156 | 'list_layout!' => [ 'list-layout4' ], |
| 2157 | ], |
| 2158 | ] |
| 2159 | ); |
| 2160 | } |
| 2161 | |
| 2162 | if ( rtTPG()->hasPro() ) { |
| 2163 | $ref->add_responsive_control( |
| 2164 | 'image_height', |
| 2165 | [ |
| 2166 | 'label' => esc_html__( 'Image Height', 'the-post-grid' ), |
| 2167 | 'type' => Controls_Manager::SLIDER, |
| 2168 | 'size_units' => [ '%', 'px' ], |
| 2169 | 'range' => [ |
| 2170 | '%' => [ |
| 2171 | 'min' => 0, |
| 2172 | 'max' => 100, |
| 2173 | ], |
| 2174 | 'px' => [ |
| 2175 | 'min' => 0, |
| 2176 | 'max' => 1000, |
| 2177 | 'step' => 1, |
| 2178 | ], |
| 2179 | ], |
| 2180 | 'selectors' => [ |
| 2181 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader > :not(.offset-right) .tpg-el-image-wrap' => 'height: {{SIZE}}{{UNIT}};', |
| 2182 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader > :not(.offset-right) .tpg-el-image-wrap img' => 'height: {{SIZE}}{{UNIT}};', |
| 2183 | '{{WRAPPER}} .tpg-el-main-wrapper.slider-layout11-main .rt-grid-hover-item .rt-holder .rt-el-content-wrapper' => 'height: {{SIZE}}{{UNIT}};', |
| 2184 | '{{WRAPPER}} .tpg-el-main-wrapper.slider-layout12-main .rt-grid-hover-item .rt-holder .rt-el-content-wrapper' => 'height: {{SIZE}}{{UNIT}};', |
| 2185 | ], |
| 2186 | ] |
| 2187 | ); |
| 2188 | |
| 2189 | $ref->add_responsive_control( |
| 2190 | 'offset_image_height', |
| 2191 | [ |
| 2192 | 'label' => esc_html__( 'Offset Image Height', 'the-post-grid' ), |
| 2193 | 'type' => Controls_Manager::SLIDER, |
| 2194 | 'size_units' => [ '%', 'px' ], |
| 2195 | 'range' => [ |
| 2196 | '%' => [ |
| 2197 | 'min' => 0, |
| 2198 | 'max' => 100, |
| 2199 | ], |
| 2200 | 'px' => [ |
| 2201 | 'min' => 0, |
| 2202 | 'max' => 1000, |
| 2203 | 'step' => 1, |
| 2204 | ], |
| 2205 | ], |
| 2206 | 'condition' => $thumb_condition, |
| 2207 | 'selectors' => [ |
| 2208 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader .offset-right .tpg-el-image-wrap' => 'height: {{SIZE}}{{UNIT}};', |
| 2209 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader .offset-right .tpg-el-image-wrap img' => 'height: {{SIZE}}{{UNIT}};', |
| 2210 | ], |
| 2211 | ] |
| 2212 | ); |
| 2213 | } |
| 2214 | |
| 2215 | $ref->add_control( |
| 2216 | 'hover_animation', |
| 2217 | [ |
| 2218 | 'label' => esc_html__( 'Image Hover Animation', 'the-post-grid' ), |
| 2219 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2220 | 'default' => 'default', |
| 2221 | 'options' => [ |
| 2222 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2223 | 'img_zoom_in' => esc_html__( 'Zoom In', 'the-post-grid' ), |
| 2224 | 'img_zoom_out' => esc_html__( 'Zoom Out', 'the-post-grid' ), |
| 2225 | 'slide_to_right' => esc_html__( 'Slide to Right', 'the-post-grid' ), |
| 2226 | 'slide_to_left' => esc_html__( 'Slide to Left', 'the-post-grid' ), |
| 2227 | 'img_no_effect' => esc_html__( 'None', 'the-post-grid' ), |
| 2228 | ], |
| 2229 | 'render_type' => 'template', |
| 2230 | 'prefix_class' => 'img_hover_animation_', |
| 2231 | ] |
| 2232 | ); |
| 2233 | |
| 2234 | $ref->add_control( |
| 2235 | 'is_thumb_lightbox', |
| 2236 | [ |
| 2237 | 'label' => esc_html__( 'Light Box', 'the-post-grid' ) . $ref->pro_label, |
| 2238 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2239 | 'default' => 'default', |
| 2240 | 'options' => [ |
| 2241 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2242 | 'show' => esc_html__( 'Show', 'the-post-grid' ), |
| 2243 | 'hide' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2244 | ], |
| 2245 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2246 | ] |
| 2247 | ); |
| 2248 | |
| 2249 | $ref->add_control( |
| 2250 | 'light_box_icon', |
| 2251 | [ |
| 2252 | 'label' => esc_html__( 'Light Box Icon', 'the-post-grid' ), |
| 2253 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2254 | 'default' => [ |
| 2255 | 'value' => 'fas fa-plus', |
| 2256 | 'library' => 'solid', |
| 2257 | ], |
| 2258 | 'condition' => [ |
| 2259 | 'is_thumb_lightbox' => 'show', |
| 2260 | ], |
| 2261 | ] |
| 2262 | ); |
| 2263 | |
| 2264 | $ref->add_control( |
| 2265 | 'is_default_img', |
| 2266 | [ |
| 2267 | 'label' => esc_html__( 'Enable Default Image', 'the-post-grid' ) . $ref->pro_label, |
| 2268 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2269 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 2270 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2271 | 'return_value' => 'yes', |
| 2272 | 'default' => false, |
| 2273 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2274 | ] |
| 2275 | ); |
| 2276 | |
| 2277 | |
| 2278 | $ref->add_control( |
| 2279 | 'default_image', |
| 2280 | [ |
| 2281 | 'label' => esc_html__( 'Default Image', 'the-post-grid' ) . $ref->pro_label, |
| 2282 | 'type' => \Elementor\Controls_Manager::MEDIA, |
| 2283 | 'default' => [ |
| 2284 | 'url' => rtTPG()->get_assets_uri( 'images/placeholder.jpg' ), |
| 2285 | ], |
| 2286 | 'condition' => [ |
| 2287 | 'is_default_img' => 'yes', |
| 2288 | ], |
| 2289 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2290 | ] |
| 2291 | ); |
| 2292 | |
| 2293 | $ref->end_controls_section(); |
| 2294 | } |
| 2295 | |
| 2296 | |
| 2297 | /** |
| 2298 | * Post Title Settings |
| 2299 | * |
| 2300 | * @param $ref |
| 2301 | */ |
| 2302 | |
| 2303 | public static function post_title_settings( $ref ) { |
| 2304 | $prefix = $ref->prefix; |
| 2305 | |
| 2306 | $ref->start_controls_section( |
| 2307 | 'post_title_settings', |
| 2308 | [ |
| 2309 | 'label' => esc_html__( 'Post Title', 'the-post-grid' ), |
| 2310 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 2311 | 'condition' => [ |
| 2312 | 'show_title' => 'show', |
| 2313 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 2314 | ], |
| 2315 | ] |
| 2316 | ); |
| 2317 | |
| 2318 | $ref->add_control( |
| 2319 | 'title_tag', |
| 2320 | [ |
| 2321 | 'label' => esc_html__( 'Title Tag', 'the-post-grid' ), |
| 2322 | 'type' => Controls_Manager::SELECT, |
| 2323 | 'default' => 'h3', |
| 2324 | 'options' => [ |
| 2325 | 'h1' => esc_html__( 'H1', 'the-post-grid' ), |
| 2326 | 'h2' => esc_html__( 'H2', 'the-post-grid' ), |
| 2327 | 'h3' => esc_html__( 'H3', 'the-post-grid' ), |
| 2328 | 'h4' => esc_html__( 'H4', 'the-post-grid' ), |
| 2329 | 'h5' => esc_html__( 'H5', 'the-post-grid' ), |
| 2330 | 'h6' => esc_html__( 'H6', 'the-post-grid' ), |
| 2331 | ], |
| 2332 | ] |
| 2333 | ); |
| 2334 | |
| 2335 | $ref->add_control( |
| 2336 | 'title_visibility_style', |
| 2337 | [ |
| 2338 | 'label' => esc_html__( 'Title Visibility Style', 'the-post-grid' ), |
| 2339 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2340 | 'default' => 'default', |
| 2341 | 'options' => [ |
| 2342 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2343 | 'one-line' => esc_html__( 'Show in 1 line', 'the-post-grid' ), |
| 2344 | 'two-line' => esc_html__( 'Show in 2 lines', 'the-post-grid' ), |
| 2345 | 'three-line' => esc_html__( 'Show in 3 lines', 'the-post-grid' ), |
| 2346 | 'custom' => esc_html__( 'Custom', 'the-post-grid' ), |
| 2347 | ], |
| 2348 | 'render_type' => 'template', |
| 2349 | 'prefix_class' => 'title-', |
| 2350 | ] |
| 2351 | ); |
| 2352 | |
| 2353 | $ref->add_control( |
| 2354 | 'title_limit', |
| 2355 | [ |
| 2356 | 'label' => esc_html__( 'Title Length', 'the-post-grid' ), |
| 2357 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 2358 | 'step' => 1, |
| 2359 | 'classes' => 'tpg-padding-left', |
| 2360 | 'condition' => [ |
| 2361 | 'title_visibility_style' => 'custom', |
| 2362 | ], |
| 2363 | ] |
| 2364 | ); |
| 2365 | |
| 2366 | $ref->add_control( |
| 2367 | 'title_limit_type', |
| 2368 | [ |
| 2369 | 'label' => esc_html__( 'Title Crop by', 'the-post-grid' ), |
| 2370 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2371 | 'default' => 'word', |
| 2372 | 'options' => [ |
| 2373 | 'word' => esc_html__( 'Words', 'the-post-grid' ), |
| 2374 | 'character' => esc_html__( 'Characters', 'the-post-grid' ), |
| 2375 | ], |
| 2376 | 'classes' => 'tpg-padding-left', |
| 2377 | 'conditions' => [ |
| 2378 | 'relation' => 'and', |
| 2379 | 'terms' => [ |
| 2380 | [ |
| 2381 | 'name' => 'title_limit', |
| 2382 | 'operator' => '>', |
| 2383 | 'value' => 0, |
| 2384 | ], |
| 2385 | [ |
| 2386 | 'name' => 'title_visibility_style', |
| 2387 | 'operator' => '==', |
| 2388 | 'value' => 'custom', |
| 2389 | ], |
| 2390 | ], |
| 2391 | |
| 2392 | ], |
| 2393 | ] |
| 2394 | ); |
| 2395 | |
| 2396 | $title_position = [ |
| 2397 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2398 | ]; |
| 2399 | if ( rtTPG()->hasPro() ) { |
| 2400 | $title_position_pro = [ |
| 2401 | 'above_image' => esc_html__( 'Above Image', 'the-post-grid' ), |
| 2402 | 'below_image' => esc_html__( 'Below Image', 'the-post-grid' ), |
| 2403 | ]; |
| 2404 | $title_position = array_merge( $title_position, $title_position_pro ); |
| 2405 | } |
| 2406 | |
| 2407 | $ref->add_control( |
| 2408 | 'title_position', |
| 2409 | [ |
| 2410 | 'label' => esc_html__( 'Title Position', 'the-post-grid' ) . $ref->pro_label, |
| 2411 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2412 | 'default' => 'default', |
| 2413 | 'prefix_class' => 'title_position_', |
| 2414 | 'render_type' => 'template', |
| 2415 | 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field', |
| 2416 | 'options' => $title_position, |
| 2417 | 'description' => $ref->get_pro_message( 'more position (above/below image)' ), |
| 2418 | 'condition' => [ |
| 2419 | $prefix . '_layout' => [ |
| 2420 | 'grid-layout1', |
| 2421 | 'grid-layout2', |
| 2422 | 'grid-layout3', |
| 2423 | 'grid-layout4', |
| 2424 | 'slider-layout1', |
| 2425 | 'slider-layout2', |
| 2426 | 'slider-layout3', |
| 2427 | ], |
| 2428 | ], |
| 2429 | ] |
| 2430 | ); |
| 2431 | |
| 2432 | $ref->add_control( |
| 2433 | 'title_position_hidden', |
| 2434 | [ |
| 2435 | 'label' => esc_html__( 'Title Position', 'the-post-grid' ), |
| 2436 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2437 | 'default' => 'default', |
| 2438 | 'prefix_class' => 'title_position_', |
| 2439 | 'render_type' => 'template', |
| 2440 | 'classes' => 'tpg-should-hide-field', |
| 2441 | 'options' => [ |
| 2442 | 'default' => esc_html__( 'Default', 'the-post-grid' ) |
| 2443 | ], |
| 2444 | 'condition' => [ |
| 2445 | $prefix . '_layout!' => [ |
| 2446 | 'grid-layout1', |
| 2447 | 'grid-layout2', |
| 2448 | 'grid-layout3', |
| 2449 | 'grid-layout4', |
| 2450 | 'slider-layout1', |
| 2451 | 'slider-layout2', |
| 2452 | 'slider-layout3', |
| 2453 | ], |
| 2454 | ], |
| 2455 | ] |
| 2456 | ); |
| 2457 | |
| 2458 | $ref->add_control( |
| 2459 | 'title_hover_underline', |
| 2460 | [ |
| 2461 | 'label' => esc_html__( 'Title Hover Underline', 'the-post-grid' ), |
| 2462 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2463 | 'default' => 'default', |
| 2464 | 'prefix_class' => 'title_hover_border_', |
| 2465 | 'render_type' => 'template', |
| 2466 | 'options' => [ |
| 2467 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2468 | 'enable' => esc_html__( 'Enable', 'the-post-grid' ), |
| 2469 | 'disable' => esc_html__( 'Disable', 'the-post-grid' ), |
| 2470 | ], |
| 2471 | ] |
| 2472 | ); |
| 2473 | |
| 2474 | |
| 2475 | $ref->end_controls_section(); |
| 2476 | } |
| 2477 | |
| 2478 | |
| 2479 | /** |
| 2480 | * Post Excerpt Settings |
| 2481 | * |
| 2482 | * @param $ref |
| 2483 | */ |
| 2484 | |
| 2485 | public static function post_excerpt_settings( $ref ) { |
| 2486 | $prefix = $ref->prefix; |
| 2487 | |
| 2488 | $ref->start_controls_section( |
| 2489 | 'post_excerpt_settings', |
| 2490 | [ |
| 2491 | 'label' => esc_html__( 'Excerpt / Content', 'the-post-grid' ), |
| 2492 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 2493 | 'condition' => [ |
| 2494 | 'show_excerpt' => 'show', |
| 2495 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 2496 | ], |
| 2497 | ] |
| 2498 | ); |
| 2499 | |
| 2500 | $excerpt_type = [ |
| 2501 | 'character' => esc_html__( 'Character', 'the-post-grid' ), |
| 2502 | 'word' => esc_html__( 'Word', 'the-post-grid' ), |
| 2503 | ]; |
| 2504 | |
| 2505 | |
| 2506 | if ( in_array( $prefix, [ 'grid', 'list' ] ) ) { |
| 2507 | $excerpt_type['full'] = esc_html__( 'Full Content', 'the-post-grid' ); |
| 2508 | } |
| 2509 | |
| 2510 | $ref->add_control( |
| 2511 | 'excerpt_type', |
| 2512 | [ |
| 2513 | 'label' => esc_html__( 'Excerpt Type', 'the-post-grid' ), |
| 2514 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2515 | 'default' => 'character', |
| 2516 | 'options' => $excerpt_type, |
| 2517 | ] |
| 2518 | ); |
| 2519 | |
| 2520 | $default_excerpt_limit = 100; |
| 2521 | if ( 'grid' == $prefix ) { |
| 2522 | $default_excerpt_limit = 200; |
| 2523 | } |
| 2524 | |
| 2525 | $ref->add_control( |
| 2526 | 'excerpt_limit', |
| 2527 | [ |
| 2528 | 'label' => esc_html__( 'Excerpt Limit', 'the-post-grid' ), |
| 2529 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 2530 | 'step' => 1, |
| 2531 | 'default' => $default_excerpt_limit, |
| 2532 | 'condition' => [ |
| 2533 | 'excerpt_type' => [ 'character', 'word' ], |
| 2534 | ], |
| 2535 | ] |
| 2536 | ); |
| 2537 | |
| 2538 | $ref->add_control( |
| 2539 | 'excerpt_more_text', |
| 2540 | [ |
| 2541 | 'label' => esc_html__( 'Expansion Indicator', 'the-post-grid' ), |
| 2542 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 2543 | 'default' => '...', |
| 2544 | 'condition' => [ |
| 2545 | 'excerpt_type' => [ 'character', 'word' ], |
| 2546 | ], |
| 2547 | ] |
| 2548 | ); |
| 2549 | |
| 2550 | $ref->end_controls_section(); |
| 2551 | } |
| 2552 | |
| 2553 | /** |
| 2554 | * Post Meta Settings |
| 2555 | * |
| 2556 | * @param $ref |
| 2557 | */ |
| 2558 | |
| 2559 | public static function post_meta_settings( $ref ) { |
| 2560 | $prefix = $ref->prefix; |
| 2561 | |
| 2562 | $ref->start_controls_section( |
| 2563 | 'post_meta_settings', |
| 2564 | [ |
| 2565 | 'label' => esc_html__( 'Meta Data', 'the-post-grid' ), |
| 2566 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 2567 | 'conditions' => [ |
| 2568 | 'relation' => 'or', |
| 2569 | 'terms' => [ |
| 2570 | [ |
| 2571 | 'name' => 'show_date', |
| 2572 | 'operator' => '==', |
| 2573 | 'value' => 'show', |
| 2574 | ], |
| 2575 | [ |
| 2576 | 'name' => 'show_category', |
| 2577 | 'operator' => '==', |
| 2578 | 'value' => 'show', |
| 2579 | ], |
| 2580 | [ |
| 2581 | 'name' => 'show_author', |
| 2582 | 'operator' => '==', |
| 2583 | 'value' => 'show', |
| 2584 | ], |
| 2585 | [ |
| 2586 | 'name' => 'show_tags', |
| 2587 | 'operator' => '==', |
| 2588 | 'value' => 'show', |
| 2589 | ], |
| 2590 | [ |
| 2591 | 'name' => 'show_comment_count', |
| 2592 | 'operator' => '==', |
| 2593 | 'value' => 'show', |
| 2594 | ], |
| 2595 | [ |
| 2596 | 'name' => 'show_post_count', |
| 2597 | 'operator' => '==', |
| 2598 | 'value' => 'show', |
| 2599 | ], |
| 2600 | ], |
| 2601 | ], |
| 2602 | 'condition' => [ |
| 2603 | 'show_meta' => 'show', |
| 2604 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 2605 | ], |
| 2606 | ] |
| 2607 | ); |
| 2608 | |
| 2609 | $meta_position = [ |
| 2610 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2611 | ]; |
| 2612 | if ( rtTPG()->hasPro() ) { |
| 2613 | $meta_position_pro = [ |
| 2614 | 'above_title' => esc_html__( 'Above Title', 'the-post-grid' ), |
| 2615 | 'below_title' => esc_html__( 'Below Title', 'the-post-grid' ), |
| 2616 | 'above_excerpt' => esc_html__( 'Above excerpt', 'the-post-grid' ), |
| 2617 | 'below_excerpt' => esc_html__( 'Below excerpt', 'the-post-grid' ), |
| 2618 | ]; |
| 2619 | $meta_position = array_merge( $meta_position, $meta_position_pro ); |
| 2620 | } |
| 2621 | |
| 2622 | $ref->add_control( |
| 2623 | 'meta_position', |
| 2624 | [ |
| 2625 | 'label' => esc_html__( 'Meta Position', 'the-post-grid' ) . $ref->pro_label, |
| 2626 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2627 | 'default' => 'default', |
| 2628 | 'prefix_class' => 'meta_position_', |
| 2629 | 'render_type' => 'template', |
| 2630 | 'options' => $meta_position, |
| 2631 | 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field', |
| 2632 | ] |
| 2633 | ); |
| 2634 | |
| 2635 | $ref->add_control( |
| 2636 | 'show_meta_icon', |
| 2637 | [ |
| 2638 | 'label' => esc_html__( 'Show Meta Icon', 'the-post-grid' ), |
| 2639 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2640 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 2641 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2642 | 'return_value' => 'yes', |
| 2643 | 'default' => 'yes', |
| 2644 | ] |
| 2645 | ); |
| 2646 | |
| 2647 | $ref->add_control( |
| 2648 | 'meta_separator', |
| 2649 | [ |
| 2650 | 'label' => esc_html__( 'Meta Separator', 'the-post-grid' ), |
| 2651 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2652 | 'default' => 'default', |
| 2653 | 'options' => [ |
| 2654 | 'default' => esc_html__( 'Default - None', 'the-post-grid' ), |
| 2655 | '.' => esc_html__( 'Dot ( . )', 'the-post-grid' ), |
| 2656 | '/' => esc_html__( 'Single Slash ( / )', 'the-post-grid' ), |
| 2657 | '//' => esc_html__( 'Double Slash ( // )', 'the-post-grid' ), |
| 2658 | '-' => esc_html__( 'Hyphen ( - )', 'the-post-grid' ), |
| 2659 | '|' => esc_html__( 'Vertical Pipe ( | )', 'the-post-grid' ), |
| 2660 | ], |
| 2661 | ] |
| 2662 | ); |
| 2663 | |
| 2664 | |
| 2665 | $ref->add_control( |
| 2666 | 'meta_popover_toggle', |
| 2667 | [ |
| 2668 | 'label' => esc_html__( 'Change Meta Icon', 'the-post-grid' ), |
| 2669 | 'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE, |
| 2670 | 'label_off' => esc_html__( 'Default', 'the-post-grid' ), |
| 2671 | 'label_on' => esc_html__( 'Custom', 'the-post-grid' ), |
| 2672 | 'return_value' => 'yes', |
| 2673 | 'condition' => [ |
| 2674 | 'show_meta_icon' => 'yes', |
| 2675 | ], |
| 2676 | ] |
| 2677 | ); |
| 2678 | |
| 2679 | $ref->start_popover(); |
| 2680 | |
| 2681 | $ref->add_control( |
| 2682 | 'user_icon', |
| 2683 | [ |
| 2684 | 'label' => esc_html__( 'Author Icon', 'the-post-grid' ), |
| 2685 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2686 | 'condition' => [ |
| 2687 | 'show_author_image!' => 'icon', |
| 2688 | ], |
| 2689 | ] |
| 2690 | ); |
| 2691 | |
| 2692 | $ref->add_control( |
| 2693 | 'cat_icon', |
| 2694 | [ |
| 2695 | 'label' => esc_html__( 'Category Icon', 'the-post-grid' ), |
| 2696 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2697 | 'condition' => [ |
| 2698 | 'show_category' => 'show', |
| 2699 | ], |
| 2700 | ] |
| 2701 | ); |
| 2702 | |
| 2703 | $ref->add_control( |
| 2704 | 'date_icon', |
| 2705 | [ |
| 2706 | 'label' => esc_html__( 'Date Icon', 'the-post-grid' ), |
| 2707 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2708 | 'condition' => [ |
| 2709 | 'show_date' => 'show', |
| 2710 | ], |
| 2711 | ] |
| 2712 | ); |
| 2713 | |
| 2714 | $ref->add_control( |
| 2715 | 'tag_icon', |
| 2716 | [ |
| 2717 | 'label' => esc_html__( 'Tags Icon', 'the-post-grid' ), |
| 2718 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2719 | 'condition' => [ |
| 2720 | 'show_tags' => 'show', |
| 2721 | ], |
| 2722 | ] |
| 2723 | ); |
| 2724 | |
| 2725 | $ref->add_control( |
| 2726 | 'comment_icon', |
| 2727 | [ |
| 2728 | 'label' => esc_html__( 'Comment Icon', 'the-post-grid' ), |
| 2729 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2730 | 'condition' => [ |
| 2731 | 'show_comment_count' => 'show', |
| 2732 | ], |
| 2733 | ] |
| 2734 | ); |
| 2735 | |
| 2736 | $ref->add_control( |
| 2737 | 'post_count_icon', |
| 2738 | [ |
| 2739 | 'label' => esc_html__( 'Post Count Icon', 'the-post-grid' ), |
| 2740 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2741 | 'condition' => [ |
| 2742 | 'show_post_count' => 'show', |
| 2743 | ], |
| 2744 | ] |
| 2745 | ); |
| 2746 | |
| 2747 | $ref->end_popover(); |
| 2748 | |
| 2749 | |
| 2750 | /** |
| 2751 | * TODO: Author Style |
| 2752 | * ******************** |
| 2753 | */ |
| 2754 | |
| 2755 | $ref->add_control( |
| 2756 | 'meta_author_divider', |
| 2757 | [ |
| 2758 | 'type' => \Elementor\Controls_Manager::DIVIDER, |
| 2759 | 'condition' => [ |
| 2760 | 'show_author!' => '', |
| 2761 | ], |
| 2762 | ] |
| 2763 | ); |
| 2764 | |
| 2765 | $ref->add_control( |
| 2766 | 'meta_author_heading', |
| 2767 | [ |
| 2768 | 'label' => esc_html__( 'Author Setting:', 'the-post-grid' ), |
| 2769 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2770 | 'classes' => 'tpg-control-type-heading', |
| 2771 | 'condition' => [ |
| 2772 | 'show_author!' => '', |
| 2773 | ], |
| 2774 | ] |
| 2775 | ); |
| 2776 | |
| 2777 | $ref->add_control( |
| 2778 | 'author_prefix', |
| 2779 | [ |
| 2780 | 'label' => esc_html__( 'Author Prefix', 'the-post-grid' ), |
| 2781 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 2782 | 'placeholder' => esc_html__( 'By', 'the-post-grid' ), |
| 2783 | 'condition' => [ |
| 2784 | 'show_author!' => '', |
| 2785 | ], |
| 2786 | ] |
| 2787 | ); |
| 2788 | |
| 2789 | $ref->add_control( |
| 2790 | 'author_icon_visibility', |
| 2791 | [ |
| 2792 | 'label' => esc_html__( 'Author Icon Visibility', 'the-post-grid' ), |
| 2793 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2794 | 'default' => 'show', |
| 2795 | 'options' => [ |
| 2796 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2797 | 'hide' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2798 | 'show' => esc_html__( 'Show', 'the-post-grid' ), |
| 2799 | ], |
| 2800 | 'condition' => [ |
| 2801 | 'show_author!' => '', |
| 2802 | ], |
| 2803 | 'prefix_class' => 'tpg-is-author-icon-', |
| 2804 | ] |
| 2805 | ); |
| 2806 | |
| 2807 | $ref->add_control( |
| 2808 | 'show_author_image', |
| 2809 | [ |
| 2810 | 'label' => esc_html__( 'Author Image / Icon', 'the-post-grid' ), |
| 2811 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2812 | 'default' => 'image', |
| 2813 | 'options' => [ |
| 2814 | 'image' => esc_html__( 'Image', 'the-post-grid' ), |
| 2815 | 'icon' => esc_html__( 'Icon', 'the-post-grid' ), |
| 2816 | ], |
| 2817 | 'render_type' => 'template', |
| 2818 | 'prefix_class' => 'author-image-visibility-', |
| 2819 | 'condition' => [ |
| 2820 | 'show_author!' => '', |
| 2821 | 'author_icon_visibility!' => 'hide', |
| 2822 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 2823 | ], |
| 2824 | ] |
| 2825 | ); |
| 2826 | |
| 2827 | $ref->add_responsive_control( |
| 2828 | 'author_icon_width', |
| 2829 | [ |
| 2830 | 'label' => esc_html__( 'Author Image Width', 'the-post-grid' ), |
| 2831 | 'type' => Controls_Manager::SLIDER, |
| 2832 | 'size_units' => [ 'px' ], |
| 2833 | 'range' => [ |
| 2834 | 'px' => [ |
| 2835 | 'min' => 10, |
| 2836 | 'max' => 100, |
| 2837 | 'step' => 1, |
| 2838 | ], |
| 2839 | ], |
| 2840 | 'selectors' => [ |
| 2841 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags span img' => 'width: {{SIZE}}{{UNIT}} !important;max-width:{{SIZE}}{{UNIT}};height:{{SIZE}}{{UNIT}} !important;', |
| 2842 | ], |
| 2843 | 'condition' => [ |
| 2844 | 'show_author!' => '', |
| 2845 | 'author_icon_visibility!' => 'hide', |
| 2846 | 'show_author_image!' => 'icon', |
| 2847 | ], |
| 2848 | ] |
| 2849 | ); |
| 2850 | |
| 2851 | /** |
| 2852 | * TODO: Category Style |
| 2853 | * ******************** |
| 2854 | */ |
| 2855 | |
| 2856 | $ref->add_control( |
| 2857 | 'category_heading', |
| 2858 | [ |
| 2859 | 'label' => esc_html__( 'Category and Tags Setting:', 'the-post-grid' ), |
| 2860 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2861 | 'classes' => 'tpg-control-type-heading', |
| 2862 | 'conditions' => [ |
| 2863 | 'relation' => 'or', |
| 2864 | 'terms' => [ |
| 2865 | [ |
| 2866 | 'name' => 'show_category', |
| 2867 | 'operator' => '==', |
| 2868 | 'value' => 'show', |
| 2869 | ], |
| 2870 | [ |
| 2871 | 'name' => 'show_tags', |
| 2872 | 'operator' => '==', |
| 2873 | 'value' => 'show', |
| 2874 | ], |
| 2875 | ], |
| 2876 | ], |
| 2877 | ] |
| 2878 | ); |
| 2879 | |
| 2880 | $ref->add_control( |
| 2881 | 'category_position', |
| 2882 | [ |
| 2883 | 'label' => esc_html__( 'Category Position', 'the-post-grid' ) . $ref->pro_label, |
| 2884 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2885 | 'default' => 'default', |
| 2886 | 'options' => [ |
| 2887 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2888 | 'above_title' => esc_html__( 'Above Title', 'the-post-grid' ), |
| 2889 | 'with_meta' => esc_html__( 'With Meta', 'the-post-grid' ), |
| 2890 | 'top_left' => esc_html__( 'Over image (Top Left)', 'the-post-grid' ), |
| 2891 | 'top_right' => esc_html__( 'Over image (Top Right)', 'the-post-grid' ), |
| 2892 | 'bottom_left' => esc_html__( 'Over image (Bottom Left)', 'the-post-grid' ), |
| 2893 | 'bottom_right' => esc_html__( 'Over image (Bottom Right)', 'the-post-grid' ), |
| 2894 | 'image_center' => esc_html__( 'Over image (Center)', 'the-post-grid' ), |
| 2895 | ], |
| 2896 | 'condition' => [ |
| 2897 | 'show_category' => 'show', |
| 2898 | ], |
| 2899 | 'render_type' => 'template', |
| 2900 | 'divider' => 'before', |
| 2901 | 'prefix_class' => 'tpg-category-position-', |
| 2902 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2903 | ] |
| 2904 | ); |
| 2905 | |
| 2906 | $category_style_condition = [ |
| 2907 | 'relation' => 'or', |
| 2908 | 'terms' => [ |
| 2909 | [ |
| 2910 | 'name' => 'category_position', |
| 2911 | 'operator' => '!=', |
| 2912 | 'value' => 'default', |
| 2913 | ], |
| 2914 | [ |
| 2915 | 'name' => $prefix . '_layout', |
| 2916 | 'operator' => 'in', |
| 2917 | 'value' => [ 'grid-layout5', 'grid-layout5-2', 'grid-layout6', 'grid-layout6-2' ], |
| 2918 | ], |
| 2919 | ], |
| 2920 | ]; |
| 2921 | |
| 2922 | |
| 2923 | $ref->add_control( |
| 2924 | 'category_style', |
| 2925 | [ |
| 2926 | 'label' => esc_html__( 'Category Style', 'the-post-grid' ) . $ref->pro_label, |
| 2927 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2928 | 'default' => 'style1', |
| 2929 | 'options' => [ |
| 2930 | 'style1' => esc_html__( 'Style 1 - Only Text', 'the-post-grid' ), |
| 2931 | 'style2' => esc_html__( 'Style 2 - Background', 'the-post-grid' ), |
| 2932 | 'style3' => esc_html__( 'Style 3 - Fold edge', 'the-post-grid' ), |
| 2933 | 'style4' => esc_html__( 'Style 4 - Different Color', 'the-post-grid' ), |
| 2934 | ], |
| 2935 | 'prefix_class' => 'tpg-cat-', |
| 2936 | 'render_type' => 'template', |
| 2937 | 'description' => rtTPG()->hasPro() ? esc_html( "Different background color will work if you use style 1 and 2" ) : '', |
| 2938 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2939 | 'conditions' => $category_style_condition, |
| 2940 | ] |
| 2941 | ); |
| 2942 | |
| 2943 | if ( rtTPG()->hasPro() ) { |
| 2944 | $ref->add_control( |
| 2945 | 'important_note', |
| 2946 | [ |
| 2947 | 'raw' => esc_html__( 'NB. If you use different background color for category then please choose style 2 or 3 from above', 'the-post-grid' ), |
| 2948 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 2949 | ] |
| 2950 | ); |
| 2951 | } |
| 2952 | |
| 2953 | if ( rtTPG()->hasPro() ) { |
| 2954 | $ref->add_control( |
| 2955 | 'show_cat_icon', |
| 2956 | [ |
| 2957 | 'label' => esc_html__( 'Show Over Image Category Icon', 'the-post-grid' ), |
| 2958 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2959 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 2960 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2961 | 'return_value' => 'yes', |
| 2962 | 'default' => false, |
| 2963 | 'conditions' => $category_style_condition, |
| 2964 | ] |
| 2965 | ); |
| 2966 | } |
| 2967 | |
| 2968 | $post_types = Fns::get_post_types(); |
| 2969 | $_all_taxonomies = []; |
| 2970 | foreach ( $post_types as $post_type => $label ) { |
| 2971 | $_taxonomies = get_object_taxonomies( $post_type, 'object' ); |
| 2972 | if ( empty( $_taxonomies ) ) { |
| 2973 | continue; |
| 2974 | } |
| 2975 | $term_options = []; |
| 2976 | foreach ( $_taxonomies as $tax ) { |
| 2977 | if ( 'post_format' == $tax->name ) { |
| 2978 | continue; |
| 2979 | } |
| 2980 | if ( in_array( $tax->name, $_all_taxonomies ) ) { |
| 2981 | continue; |
| 2982 | } |
| 2983 | $_all_taxonomies[] = $tax->name; |
| 2984 | $term_options[ $tax->name ] = $tax->label; |
| 2985 | } |
| 2986 | |
| 2987 | if ( 'post' === $post_type ) { |
| 2988 | $default_cat = 'category'; |
| 2989 | $default_tag = 'post_tag'; |
| 2990 | } else if ( 'product' === $post_type ) { |
| 2991 | $default_cat = 'product_cat'; |
| 2992 | $default_tag = 'product_tag'; |
| 2993 | } else if ( 'download' === $post_type ) { |
| 2994 | $default_cat = 'download_category'; |
| 2995 | $default_tag = 'download_tag'; |
| 2996 | } else if ( 'docs' === $post_type ) { |
| 2997 | $default_cat = 'doc_category'; |
| 2998 | $default_tag = 'doc_tag'; |
| 2999 | } else if ( 'lp_course' === $post_type ) { |
| 3000 | $default_cat = 'course_category'; |
| 3001 | $default_tag = 'course_tag'; |
| 3002 | } else { |
| 3003 | $taxonomie_keys = array_keys( $_taxonomies ); |
| 3004 | $filter_cat = array_filter( |
| 3005 | $taxonomie_keys, |
| 3006 | function ( $item ) { |
| 3007 | return strpos( $item, 'cat' ) !== false; |
| 3008 | } |
| 3009 | ); |
| 3010 | $filter_tag = array_filter( |
| 3011 | $taxonomie_keys, |
| 3012 | function ( $item ) { |
| 3013 | return strpos( $item, 'tag' ) !== false; |
| 3014 | } |
| 3015 | ); |
| 3016 | |
| 3017 | if ( is_array( $filter_cat ) && ! empty( $filter_cat ) ) { |
| 3018 | $default_cat = array_shift( $filter_cat ); |
| 3019 | } |
| 3020 | if ( is_array( $filter_tag ) && ! empty( $filter_tag ) ) { |
| 3021 | $default_tag = array_shift( $filter_tag ); |
| 3022 | } |
| 3023 | } |
| 3024 | |
| 3025 | $ref->add_control( |
| 3026 | $post_type . '_taxonomy', |
| 3027 | [ |
| 3028 | 'label' => esc_html__( 'Category Source', 'the-post-grid' ), |
| 3029 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3030 | 'default' => $default_cat, |
| 3031 | 'options' => $term_options, |
| 3032 | 'condition' => [ |
| 3033 | 'show_category' => 'show', |
| 3034 | 'post_type' => $post_type, |
| 3035 | ], |
| 3036 | 'description' => esc_html__( 'Select which taxonomy should sit in the place of categories. Default: Category', 'the-post-grid' ), |
| 3037 | ] |
| 3038 | ); |
| 3039 | |
| 3040 | $ref->add_control( |
| 3041 | $post_type . '_tags', |
| 3042 | [ |
| 3043 | 'label' => esc_html__( 'Tags Source', 'the-post-grid' ), |
| 3044 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3045 | 'default' => $default_tag, |
| 3046 | 'options' => $term_options, |
| 3047 | 'condition' => [ |
| 3048 | 'show_category' => 'show', |
| 3049 | 'post_type' => $post_type, |
| 3050 | ], |
| 3051 | 'description' => esc_html__( 'Select which taxonomy should sit in the place of tags. Default: Tags', 'the-post-grid' ), |
| 3052 | ] |
| 3053 | ); |
| 3054 | } |
| 3055 | |
| 3056 | $ref->add_control( |
| 3057 | 'comment_count_heading', |
| 3058 | [ |
| 3059 | 'label' => esc_html__( 'Comment Count ', 'the-post-grid' ), |
| 3060 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 3061 | 'classes' => 'tpg-control-type-heading', |
| 3062 | 'condition' => [ |
| 3063 | 'show_comment_count' => 'show', |
| 3064 | ], |
| 3065 | ] |
| 3066 | ); |
| 3067 | |
| 3068 | $ref->add_control( |
| 3069 | 'show_comment_count_label', |
| 3070 | [ |
| 3071 | 'label' => esc_html__( 'Show Comment Label', 'the-post-grid' ), |
| 3072 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3073 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 3074 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 3075 | 'return_value' => 'yes', |
| 3076 | 'default' => 'yes', |
| 3077 | 'condition' => [ |
| 3078 | 'show_comment_count' => 'show', |
| 3079 | ], |
| 3080 | ] |
| 3081 | ); |
| 3082 | |
| 3083 | $ref->add_control( |
| 3084 | 'comment_count_label_singular', |
| 3085 | [ |
| 3086 | 'label' => esc_html__( 'Comment Label Singular', 'the-post-grid' ), |
| 3087 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 3088 | 'default' => esc_html__( 'Comment', 'the-post-grid' ), |
| 3089 | 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ), |
| 3090 | 'condition' => [ |
| 3091 | 'show_comment_count' => 'show', |
| 3092 | 'show_comment_count_label' => 'yes', |
| 3093 | ], |
| 3094 | ] |
| 3095 | ); |
| 3096 | |
| 3097 | $ref->add_control( |
| 3098 | 'comment_count_label_plural', |
| 3099 | [ |
| 3100 | 'label' => esc_html__( 'Comment Label Plural', 'the-post-grid' ), |
| 3101 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 3102 | 'default' => esc_html__( 'Comments', 'the-post-grid' ), |
| 3103 | 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ), |
| 3104 | 'condition' => [ |
| 3105 | 'show_comment_count' => 'show', |
| 3106 | 'show_comment_count_label' => 'yes', |
| 3107 | ], |
| 3108 | ] |
| 3109 | ); |
| 3110 | |
| 3111 | $ref->add_control( |
| 3112 | 'meta_ordering_heading', |
| 3113 | [ |
| 3114 | 'label' => esc_html__( 'Meta Ordering', 'the-post-grid' ), |
| 3115 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 3116 | 'classes' => 'tpg-control-type-heading', |
| 3117 | ] |
| 3118 | ); |
| 3119 | |
| 3120 | $repeater = new \Elementor\Repeater(); |
| 3121 | |
| 3122 | $repeater->add_control( |
| 3123 | 'repeater_hidden', |
| 3124 | [ |
| 3125 | 'type' => \Elementor\Controls_Manager::HIDDEN, |
| 3126 | ] |
| 3127 | ); |
| 3128 | |
| 3129 | $ref->add_control( |
| 3130 | 'meta_ordering', |
| 3131 | [ |
| 3132 | 'label' => esc_html__( 'Meta Ordering (Drag and Drop)', 'the-post-grid' ), |
| 3133 | 'type' => \Elementor\Controls_Manager::REPEATER, |
| 3134 | 'fields' => $repeater->get_controls(), |
| 3135 | 'default' => [ |
| 3136 | [ |
| 3137 | 'meta_title' => esc_html__( 'Author', 'the-post-grid' ), |
| 3138 | 'meta_name' => 'author', |
| 3139 | ], |
| 3140 | [ |
| 3141 | 'meta_title' => esc_html__( 'Date', 'the-post-grid' ), |
| 3142 | 'meta_name' => 'date', |
| 3143 | ], |
| 3144 | [ |
| 3145 | 'meta_title' => esc_html__( 'Category', 'the-post-grid' ), |
| 3146 | 'meta_name' => 'category', |
| 3147 | ], |
| 3148 | [ |
| 3149 | 'meta_title' => esc_html__( 'Tags', 'the-post-grid' ), |
| 3150 | 'meta_name' => 'tags', |
| 3151 | ], |
| 3152 | [ |
| 3153 | 'meta_title' => esc_html__( 'Comment Count', 'the-post-grid' ), |
| 3154 | 'meta_name' => 'comment_count', |
| 3155 | ], |
| 3156 | [ |
| 3157 | 'meta_title' => esc_html__( 'Post Count', 'the-post-grid' ), |
| 3158 | 'meta_name' => 'post_count', |
| 3159 | ], |
| 3160 | [ |
| 3161 | 'meta_title' => esc_html__( 'Post Like', 'the-post-grid' ), |
| 3162 | 'meta_name' => 'post_like', |
| 3163 | ], |
| 3164 | ], |
| 3165 | 'classes' => 'tpg-item-order-repeater', |
| 3166 | 'title_field' => '{{{ meta_title }}}', |
| 3167 | ] |
| 3168 | ); |
| 3169 | |
| 3170 | $ref->end_controls_section(); |
| 3171 | } |
| 3172 | |
| 3173 | |
| 3174 | /** |
| 3175 | * Read More Settings |
| 3176 | * |
| 3177 | * @param $ref |
| 3178 | */ |
| 3179 | |
| 3180 | public static function post_readmore_settings( $ref ) { |
| 3181 | $prefix = $ref->prefix; |
| 3182 | |
| 3183 | $ref->start_controls_section( |
| 3184 | 'post_readmore_settings', |
| 3185 | [ |
| 3186 | 'label' => esc_html__( 'Read More', 'the-post-grid' ), |
| 3187 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 3188 | 'condition' => [ |
| 3189 | 'show_read_more' => 'show', |
| 3190 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 3191 | ], |
| 3192 | ] |
| 3193 | ); |
| 3194 | |
| 3195 | |
| 3196 | $ref->add_control( |
| 3197 | 'readmore_btn_style', |
| 3198 | [ |
| 3199 | 'label' => esc_html__( 'Button Style', 'the-post-grid' ), |
| 3200 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3201 | 'default' => 'default-style', |
| 3202 | 'options' => [ |
| 3203 | 'default-style' => esc_html__( 'Default from style', 'the-post-grid' ), |
| 3204 | 'only-text' => esc_html__( 'Only Text Button', 'the-post-grid' ), |
| 3205 | |
| 3206 | ], |
| 3207 | 'prefix_class' => 'readmore-btn-', |
| 3208 | ] |
| 3209 | ); |
| 3210 | |
| 3211 | $ref->add_control( |
| 3212 | 'read_more_label', |
| 3213 | [ |
| 3214 | 'label' => esc_html__( 'Read More Label', 'the-post-grid' ), |
| 3215 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 3216 | 'default' => esc_html__( 'Read More', 'the-post-grid' ), |
| 3217 | 'placeholder' => esc_html__( 'Type Read More Label here', 'the-post-grid' ), |
| 3218 | ] |
| 3219 | ); |
| 3220 | |
| 3221 | |
| 3222 | $ref->add_control( |
| 3223 | 'show_btn_icon', |
| 3224 | [ |
| 3225 | 'label' => esc_html__( 'Show Button Icon', 'the-post-grid' ), |
| 3226 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3227 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 3228 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 3229 | 'return_value' => 'yes', |
| 3230 | 'default' => false, |
| 3231 | ] |
| 3232 | ); |
| 3233 | |
| 3234 | $ref->add_control( |
| 3235 | 'readmore_btn_icon', |
| 3236 | [ |
| 3237 | 'label' => esc_html__( 'Choose Icon', 'the-post-grid' ), |
| 3238 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 3239 | 'condition' => [ |
| 3240 | 'show_btn_icon' => 'yes', |
| 3241 | ], |
| 3242 | ] |
| 3243 | ); |
| 3244 | |
| 3245 | $ref->add_control( |
| 3246 | 'readmore_icon_position', |
| 3247 | [ |
| 3248 | 'label' => esc_html__( 'Icon Position', 'the-post-grid' ), |
| 3249 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3250 | 'default' => 'right', |
| 3251 | 'options' => [ |
| 3252 | 'left' => esc_html__( 'Left', 'the-post-grid' ), |
| 3253 | 'right' => esc_html__( 'Right', 'the-post-grid' ), |
| 3254 | ], |
| 3255 | 'condition' => [ |
| 3256 | 'show_btn_icon' => 'yes', |
| 3257 | ], |
| 3258 | ] |
| 3259 | ); |
| 3260 | |
| 3261 | $ref->end_controls_section(); |
| 3262 | } |
| 3263 | |
| 3264 | |
| 3265 | /** |
| 3266 | * Advanced Custom Field ACF Settings |
| 3267 | * |
| 3268 | * @param $ref |
| 3269 | */ |
| 3270 | |
| 3271 | public static function tpg_acf_settings( $ref ) { |
| 3272 | $prefix = $ref->prefix; |
| 3273 | $cf = Fns::is_acf(); |
| 3274 | |
| 3275 | if ( ! $cf || ! rtTPG()->hasPro() ) { |
| 3276 | return; |
| 3277 | } |
| 3278 | |
| 3279 | $ref->start_controls_section( |
| 3280 | 'tgp_acf_settings', |
| 3281 | [ |
| 3282 | 'label' => esc_html__( 'ACF Settings', 'the-post-grid' ), |
| 3283 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 3284 | 'condition' => [ |
| 3285 | 'show_acf' => 'show', |
| 3286 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 3287 | ], |
| 3288 | ] |
| 3289 | ); |
| 3290 | |
| 3291 | self::get_tpg_acf_settings( $ref ); |
| 3292 | |
| 3293 | $ref->end_controls_section(); |
| 3294 | } |
| 3295 | |
| 3296 | public static function get_tpg_acf_settings( $ref, $is_archive = false ) { |
| 3297 | |
| 3298 | $post_types = Fns::get_post_types(); |
| 3299 | |
| 3300 | |
| 3301 | if ( $is_archive ) { |
| 3302 | $get_acf_field = Fns::get_groups_by_post_type( 'post' ); |
| 3303 | $selected_acf_id = ''; |
| 3304 | if ( ! empty( $get_acf_field ) && is_array( $get_acf_field ) ) { |
| 3305 | $selected_acf_id = array_key_first( $get_acf_field ); |
| 3306 | } |
| 3307 | |
| 3308 | $ref->add_control( |
| 3309 | 'cf_group', |
| 3310 | [ |
| 3311 | 'label' => esc_html__( "Choose Advanced Custom Field (ACF)", 'the-post-grid' ), |
| 3312 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 3313 | 'label_block' => true, |
| 3314 | 'multiple' => true, |
| 3315 | 'default' => [ $selected_acf_id ], |
| 3316 | 'options' => Fns::get_groups_by_post_type( 'post' ), |
| 3317 | ] |
| 3318 | ); |
| 3319 | |
| 3320 | } else { |
| 3321 | foreach ( $post_types as $post_type => $post_type_title ) { |
| 3322 | $get_acf_field = Fns::get_groups_by_post_type( $post_type ); |
| 3323 | $selected_acf_id = ''; |
| 3324 | if ( ! empty( $get_acf_field ) && is_array( $get_acf_field ) ) { |
| 3325 | $selected_acf_id = array_key_first( $get_acf_field ); |
| 3326 | } |
| 3327 | |
| 3328 | $ref->add_control( |
| 3329 | $post_type . '_cf_group', |
| 3330 | [ |
| 3331 | 'label' => esc_html__( "Choose Advanced Custom Field (ACF)", 'the-post-grid' ), |
| 3332 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 3333 | 'label_block' => true, |
| 3334 | 'multiple' => true, |
| 3335 | 'default' => [ $selected_acf_id ], |
| 3336 | 'options' => Fns::get_groups_by_post_type( $post_type ), |
| 3337 | 'condition' => [ |
| 3338 | 'post_type' => $post_type, |
| 3339 | ], |
| 3340 | ] |
| 3341 | ); |
| 3342 | } |
| 3343 | } |
| 3344 | |
| 3345 | $ref->add_control( |
| 3346 | 'cf_hide_empty_value', |
| 3347 | [ |
| 3348 | 'label' => esc_html__( 'Hide field with empty value?', 'the-post-grid' ), |
| 3349 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3350 | 'label_on' => esc_html__( 'No', 'the-post-grid' ), |
| 3351 | 'label_off' => esc_html__( 'Yes', 'the-post-grid' ), |
| 3352 | 'return_value' => 'yes', |
| 3353 | 'default' => 'yes', |
| 3354 | ] |
| 3355 | ); |
| 3356 | |
| 3357 | $ref->add_control( |
| 3358 | 'cf_hide_group_title', |
| 3359 | [ |
| 3360 | 'label' => esc_html__( 'Show group title?', 'the-post-grid' ), |
| 3361 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3362 | 'label_on' => esc_html__( 'No', 'the-post-grid' ), |
| 3363 | 'label_off' => esc_html__( 'Yes', 'the-post-grid' ), |
| 3364 | 'return_value' => 'yes', |
| 3365 | 'default' => 'yes', |
| 3366 | ] |
| 3367 | ); |
| 3368 | |
| 3369 | $ref->add_control( |
| 3370 | 'cf_show_only_value', |
| 3371 | [ |
| 3372 | 'label' => esc_html__( 'Show label?', 'the-post-grid' ), |
| 3373 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3374 | 'label_on' => esc_html__( 'No', 'the-post-grid' ), |
| 3375 | 'label_off' => esc_html__( 'Yes', 'the-post-grid' ), |
| 3376 | 'return_value' => 'yes', |
| 3377 | 'default' => 'yes', |
| 3378 | ] |
| 3379 | ); |
| 3380 | } |
| 3381 | |
| 3382 | |
| 3383 | /** |
| 3384 | * Links Settings |
| 3385 | * |
| 3386 | * @param $ref |
| 3387 | */ |
| 3388 | public static function links( $ref ) { |
| 3389 | $prefix = $ref->prefix; |
| 3390 | |
| 3391 | $ref->start_controls_section( |
| 3392 | 'tpg_links_settings', |
| 3393 | [ |
| 3394 | 'label' => esc_html__( 'Links', 'the-post-grid' ), |
| 3395 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 3396 | 'condition' => [ |
| 3397 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 3398 | ], |
| 3399 | |
| 3400 | ] |
| 3401 | ); |
| 3402 | |
| 3403 | $link_type = [ |
| 3404 | 'default' => esc_html__( 'Link to details page', 'the-post-grid' ), |
| 3405 | ]; |
| 3406 | if ( rtTPG()->hasPro() ) { |
| 3407 | $link_type['popup'] = esc_html__( 'Single Popup', 'the-post-grid' ); |
| 3408 | $link_type['multi_popup'] = esc_html__( 'Multi Popup', 'the-post-grid' ); |
| 3409 | } |
| 3410 | $link_type['none'] = esc_html__( 'No Link', 'the-post-grid' ); |
| 3411 | |
| 3412 | $ref->add_control( |
| 3413 | 'post_link_type', |
| 3414 | [ |
| 3415 | 'label' => esc_html__( 'Post link type', 'the-post-grid' ), |
| 3416 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3417 | 'default' => 'default', |
| 3418 | 'options' => $link_type, |
| 3419 | 'description' => $ref->get_pro_message( 'popup options' ), |
| 3420 | ] |
| 3421 | ); |
| 3422 | |
| 3423 | $ref->add_control( |
| 3424 | 'link_target', |
| 3425 | [ |
| 3426 | 'label' => esc_html__( 'Link Target', 'the-post-grid' ), |
| 3427 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3428 | 'default' => '_self', |
| 3429 | 'options' => [ |
| 3430 | '_self' => esc_html__( 'Same Window', 'the-post-grid' ), |
| 3431 | '_blank' => esc_html__( 'New Window', 'the-post-grid' ), |
| 3432 | ], |
| 3433 | 'condition' => [ |
| 3434 | 'post_link_type' => 'default', |
| 3435 | ], |
| 3436 | ] |
| 3437 | ); |
| 3438 | |
| 3439 | $ref->add_control( |
| 3440 | 'is_thumb_linked', |
| 3441 | [ |
| 3442 | 'label' => esc_html__( 'Thumbnail Link', 'the-post-grid' ), |
| 3443 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3444 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 3445 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 3446 | 'return_value' => 'yes', |
| 3447 | 'default' => 'yes', |
| 3448 | ] |
| 3449 | ); |
| 3450 | |
| 3451 | $ref->end_controls_section(); |
| 3452 | } |
| 3453 | |
| 3454 | |
| 3455 | /** |
| 3456 | * Promotions |
| 3457 | * |
| 3458 | * @param $ref |
| 3459 | */ |
| 3460 | public static function promotions( $ref ) { |
| 3461 | if ( rtTPG()->hasPro() ) { |
| 3462 | return; |
| 3463 | } |
| 3464 | $pro_url = "//www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/"; |
| 3465 | |
| 3466 | $ref->start_controls_section( |
| 3467 | 'tpg_pro_alert', |
| 3468 | [ |
| 3469 | 'label' => sprintf( |
| 3470 | '<span style="color: #f54">%s</span>', |
| 3471 | __( 'Go Premium for More Features', 'the-post-grid' ) |
| 3472 | ), |
| 3473 | ] |
| 3474 | ); |
| 3475 | |
| 3476 | $ref->add_control( |
| 3477 | 'tpg_control_get_pro', |
| 3478 | [ |
| 3479 | 'type' => Controls_Manager::RAW_HTML, |
| 3480 | 'raw' => '<div class="elementor-nerd-box"><div class="elementor-nerd-box-title" style="margin-top: 0; margin-bottom: 20px;">Unlock more possibilities</div><div class="elementor-nerd-box-message"><span class="pro-feature" style="font-size: 13px;"> Get the <a href="' |
| 3481 | . $pro_url |
| 3482 | . '" target="_blank" style="color: #f54">Pro version</a> for more stunning layouts and customization options.</span></div><a class="elementor-nerd-box-link elementor-button elementor-button-default elementor-button-go-pro" href="' |
| 3483 | . $pro_url . '" target="_blank">Get Pro</a></div>', |
| 3484 | ] |
| 3485 | ); |
| 3486 | |
| 3487 | $ref->end_controls_section(); |
| 3488 | } |
| 3489 | |
| 3490 | |
| 3491 | /** |
| 3492 | * Section Title Style |
| 3493 | * |
| 3494 | * @param $ref |
| 3495 | */ |
| 3496 | public static function sectionTitle( $ref, $layout_type = '' ) { |
| 3497 | $prefix = $ref->prefix; |
| 3498 | $ref->start_controls_section( |
| 3499 | 'tpg_section_title_style', |
| 3500 | [ |
| 3501 | 'label' => esc_html__( 'Section Title', 'the-post-grid' ), |
| 3502 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3503 | 'condition' => [ |
| 3504 | 'show_section_title' => 'show', |
| 3505 | ], |
| 3506 | ] |
| 3507 | ); |
| 3508 | |
| 3509 | $ref->add_control( |
| 3510 | 'section_title_alignment', |
| 3511 | [ |
| 3512 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 3513 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 3514 | 'options' => [ |
| 3515 | 'left' => [ |
| 3516 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 3517 | 'icon' => 'eicon-text-align-left', |
| 3518 | ], |
| 3519 | 'center' => [ |
| 3520 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 3521 | 'icon' => 'eicon-text-align-center', |
| 3522 | ], |
| 3523 | 'right' => [ |
| 3524 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 3525 | 'icon' => 'eicon-text-align-right', |
| 3526 | ], |
| 3527 | ], |
| 3528 | 'render_type' => 'template', |
| 3529 | 'prefix_class' => 'section-title-align-', |
| 3530 | ] |
| 3531 | ); |
| 3532 | |
| 3533 | $ref->add_responsive_control( |
| 3534 | 'section_title_margin', |
| 3535 | [ |
| 3536 | 'label' => esc_html__( 'Margin', 'the-post-grid' ), |
| 3537 | 'type' => Controls_Manager::DIMENSIONS, |
| 3538 | 'size_units' => [ 'px' ], |
| 3539 | 'default' => [ |
| 3540 | 'top' => '', |
| 3541 | 'right' => '', |
| 3542 | 'bottom' => '', |
| 3543 | 'left' => '', |
| 3544 | 'isLinked' => false, |
| 3545 | ], |
| 3546 | 'selectors' => [ |
| 3547 | '{{WRAPPER}} .tpg-widget-heading-wrapper' => 'margin:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3548 | ], |
| 3549 | ] |
| 3550 | ); |
| 3551 | |
| 3552 | if ( 'slider' === $prefix ) { |
| 3553 | $ref->add_responsive_control( |
| 3554 | 'section_title_padding', |
| 3555 | [ |
| 3556 | 'label' => esc_html__( 'Padding', 'the-post-grid' ), |
| 3557 | 'type' => Controls_Manager::DIMENSIONS, |
| 3558 | 'size_units' => [ 'px' ], |
| 3559 | 'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ] |
| 3560 | 'default' => [ |
| 3561 | 'top' => '', |
| 3562 | 'right' => '', |
| 3563 | 'bottom' => '', |
| 3564 | 'left' => '', |
| 3565 | 'isLinked' => false, |
| 3566 | ], |
| 3567 | 'selectors' => [ |
| 3568 | '{{WRAPPER}} .slider-layout-main .tpg-widget-heading-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3569 | ], |
| 3570 | ] |
| 3571 | ); |
| 3572 | } |
| 3573 | |
| 3574 | $ref->add_group_control( |
| 3575 | \Elementor\Group_Control_Typography::get_type(), |
| 3576 | [ |
| 3577 | 'name' => 'section_title_typography', |
| 3578 | 'label' => esc_html__( 'Typography', 'the-post-grid' ), |
| 3579 | 'selector' => '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading', |
| 3580 | ] |
| 3581 | ); |
| 3582 | |
| 3583 | $ref->add_control( |
| 3584 | 'section_title_color', |
| 3585 | [ |
| 3586 | 'label' => esc_html__( 'Title Color', 'the-post-grid' ), |
| 3587 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3588 | 'selectors' => [ |
| 3589 | '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading' => 'color: {{VALUE}}', |
| 3590 | ], |
| 3591 | ] |
| 3592 | ); |
| 3593 | |
| 3594 | $ref->add_control( |
| 3595 | 'section_title_bg_color', |
| 3596 | [ |
| 3597 | 'label' => esc_html__( 'Title Background Color', 'the-post-grid' ), |
| 3598 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3599 | 'selectors' => [ |
| 3600 | '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, {{WRAPPER}} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading' => 'background-color: {{VALUE}}', |
| 3601 | '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading::after, {{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading::before' => 'border-color: {{VALUE}} transparent', |
| 3602 | ], |
| 3603 | 'condition' => [ |
| 3604 | 'section_title_style' => [ 'style2', 'style3' ], |
| 3605 | ], |
| 3606 | ] |
| 3607 | ); |
| 3608 | |
| 3609 | |
| 3610 | $ref->add_control( |
| 3611 | 'section_title_dot_color', |
| 3612 | [ |
| 3613 | 'label' => esc_html__( 'Dot Color', 'the-post-grid' ), |
| 3614 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3615 | 'selectors' => [ |
| 3616 | '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading::before' => 'background-color: {{VALUE}}', |
| 3617 | ], |
| 3618 | 'condition' => [ |
| 3619 | 'section_title_style' => 'style1', |
| 3620 | ], |
| 3621 | ] |
| 3622 | ); |
| 3623 | |
| 3624 | $ref->add_control( |
| 3625 | 'section_title_line_color', |
| 3626 | [ |
| 3627 | 'label' => esc_html__( 'Line / Border Color', 'the-post-grid' ), |
| 3628 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3629 | 'selectors' => [ |
| 3630 | '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line' => 'border-color: {{VALUE}}', |
| 3631 | '{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper:not(.carousel) .tpg-widget-heading-wrapper,{{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper:not(.carousel) .tpg-widget-heading-wrapper,{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel, {{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper.carousel' => 'border-bottom-color: {{VALUE}}', |
| 3632 | '{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide.selected, {{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide.selected' => 'color: {{VALUE}}', |
| 3633 | '{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide:hover, {{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide:hover' => 'color: {{VALUE}}', |
| 3634 | '{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide::before, {{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide::before' => 'border-bottom-color: {{VALUE}}', |
| 3635 | ], |
| 3636 | 'condition' => [ |
| 3637 | 'section_title_style!' => 'default', |
| 3638 | ], |
| 3639 | ] |
| 3640 | ); |
| 3641 | |
| 3642 | $ref->add_control( |
| 3643 | 'prefix_text_color', |
| 3644 | [ |
| 3645 | 'label' => esc_html__( 'Prefix Color', 'the-post-grid' ), |
| 3646 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3647 | 'selectors' => [ |
| 3648 | '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .prefix-text' => 'color: {{VALUE}}', |
| 3649 | ], |
| 3650 | 'condition' => [ |
| 3651 | 'section_title_source' => 'page_title', |
| 3652 | ], |
| 3653 | ] |
| 3654 | ); |
| 3655 | $ref->add_control( |
| 3656 | 'suffix_text_color', |
| 3657 | [ |
| 3658 | 'label' => esc_html__( 'Suffix Color', 'the-post-grid' ), |
| 3659 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3660 | 'selectors' => [ |
| 3661 | '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .suffix-text' => 'color: {{VALUE}}', |
| 3662 | ], |
| 3663 | 'condition' => [ |
| 3664 | 'section_title_source' => 'page_title', |
| 3665 | ], |
| 3666 | ] |
| 3667 | ); |
| 3668 | |
| 3669 | |
| 3670 | if ( 'archive' == $layout_type ) { |
| 3671 | $ref->add_control( |
| 3672 | 'cat_tag_description_heading', |
| 3673 | [ |
| 3674 | 'label' => esc_html__( 'Category / Tag Description', 'the-post-grid' ), |
| 3675 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 3676 | 'classes' => 'tpg-control-type-heading', |
| 3677 | 'condition' => [ |
| 3678 | 'show_cat_desc' => 'yes', |
| 3679 | ], |
| 3680 | ] |
| 3681 | ); |
| 3682 | |
| 3683 | $ref->add_group_control( |
| 3684 | \Elementor\Group_Control_Typography::get_type(), |
| 3685 | [ |
| 3686 | 'name' => 'taxonomy_des_typography', |
| 3687 | 'label' => esc_html__( 'Description Typography', 'the-post-grid' ), |
| 3688 | 'selector' => '{{WRAPPER}} .tpg-category-description', |
| 3689 | 'condition' => [ |
| 3690 | 'show_cat_desc' => 'yes', |
| 3691 | ], |
| 3692 | ] |
| 3693 | ); |
| 3694 | |
| 3695 | $ref->add_responsive_control( |
| 3696 | 'taxonomy_des_alignment', |
| 3697 | [ |
| 3698 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 3699 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 3700 | 'options' => [ |
| 3701 | 'left' => [ |
| 3702 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 3703 | 'icon' => 'eicon-text-align-left', |
| 3704 | ], |
| 3705 | 'center' => [ |
| 3706 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 3707 | 'icon' => 'eicon-text-align-center', |
| 3708 | ], |
| 3709 | 'right' => [ |
| 3710 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 3711 | 'icon' => 'eicon-text-align-right', |
| 3712 | ], |
| 3713 | ], |
| 3714 | 'selectors' => [ |
| 3715 | '{{WRAPPER}} .tpg-category-description' => 'text-align: {{VALUE}}', |
| 3716 | ], |
| 3717 | 'condition' => [ |
| 3718 | 'show_cat_desc' => 'yes', |
| 3719 | ], |
| 3720 | ] |
| 3721 | ); |
| 3722 | |
| 3723 | $ref->add_control( |
| 3724 | 'taxonomy_des_color', |
| 3725 | [ |
| 3726 | 'label' => esc_html__( 'Title Color', 'the-post-grid' ), |
| 3727 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3728 | 'selectors' => [ |
| 3729 | '{{WRAPPER}} .tpg-category-description' => 'color: {{VALUE}}', |
| 3730 | ], |
| 3731 | 'condition' => [ |
| 3732 | 'show_cat_desc' => 'yes', |
| 3733 | ], |
| 3734 | ] |
| 3735 | ); |
| 3736 | |
| 3737 | $ref->add_responsive_control( |
| 3738 | 'taxonomy_des_dimension', |
| 3739 | [ |
| 3740 | 'label' => esc_html__( 'Padding', 'the-post-grid' ), |
| 3741 | 'type' => Controls_Manager::DIMENSIONS, |
| 3742 | 'size_units' => [ 'px' ], |
| 3743 | 'selectors' => [ |
| 3744 | '{{WRAPPER}} .tpg-category-description' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3745 | ], |
| 3746 | 'condition' => [ |
| 3747 | 'show_cat_desc' => 'yes', |
| 3748 | ], |
| 3749 | ] |
| 3750 | ); |
| 3751 | } |
| 3752 | |
| 3753 | $ref->end_controls_section(); |
| 3754 | } |
| 3755 | |
| 3756 | |
| 3757 | /** |
| 3758 | * Thumbnail Style Tab |
| 3759 | * |
| 3760 | * @param $ref |
| 3761 | */ |
| 3762 | public static function thumbnailStyle( $ref ) { |
| 3763 | $prefix = $ref->prefix; |
| 3764 | // Thumbnail style |
| 3765 | //======================================================== |
| 3766 | $ref->start_controls_section( |
| 3767 | 'thumbnail_style', |
| 3768 | [ |
| 3769 | 'label' => esc_html__( 'Thumbnail', 'the-post-grid' ), |
| 3770 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3771 | 'condition' => [ |
| 3772 | 'show_thumb' => 'show', |
| 3773 | ], |
| 3774 | ] |
| 3775 | ); |
| 3776 | |
| 3777 | $ref->add_responsive_control( |
| 3778 | 'img_border_radius', |
| 3779 | [ |
| 3780 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ) . $ref->pro_label, |
| 3781 | 'type' => Controls_Manager::DIMENSIONS, |
| 3782 | 'size_units' => [ 'px', '%', 'em' ], |
| 3783 | 'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ] |
| 3784 | 'default' => [ |
| 3785 | 'top' => '', |
| 3786 | 'right' => '', |
| 3787 | 'bottom' => '', |
| 3788 | 'left' => '', |
| 3789 | 'isLinked' => true, |
| 3790 | ], |
| 3791 | 'selectors' => [ |
| 3792 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap, {{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img, {{WRAPPER}} .rt-grid-hover-item .grid-hover-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;', |
| 3793 | ], |
| 3794 | 'description' => $ref->get_pro_message( "image radius." ), |
| 3795 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 3796 | ] |
| 3797 | ); |
| 3798 | |
| 3799 | $ref->add_control( |
| 3800 | 'image_width', |
| 3801 | [ |
| 3802 | 'label' => esc_html__( 'Image Width (Optional)', 'the-post-grid' ), |
| 3803 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3804 | 'default' => 'inherit', |
| 3805 | 'options' => [ |
| 3806 | 'inherit' => esc_html__( 'Default', 'the-post-grid' ), |
| 3807 | '100%' => esc_html__( '100%', 'the-post-grid' ), |
| 3808 | 'auto' => esc_html__( 'Auto', 'the-post-grid' ), |
| 3809 | ], |
| 3810 | 'selectors' => [ |
| 3811 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img' => 'width: {{VALUE}};', |
| 3812 | ], |
| 3813 | ] |
| 3814 | ); |
| 3815 | |
| 3816 | if ( 'grid_hover' != $prefix ) { |
| 3817 | $ref->add_responsive_control( |
| 3818 | 'thumbnail_spacing', |
| 3819 | [ |
| 3820 | 'label' => esc_html__( 'Thumbnail Margin', 'the-post-grid' ), |
| 3821 | 'type' => Controls_Manager::DIMENSIONS, |
| 3822 | 'size_units' => [ 'px' ], |
| 3823 | 'selectors' => [ |
| 3824 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3825 | ], |
| 3826 | 'default' => [ |
| 3827 | 'top' => '', |
| 3828 | 'right' => '', |
| 3829 | 'bottom' => '', |
| 3830 | 'left' => '', |
| 3831 | 'isLinked' => false, |
| 3832 | ], |
| 3833 | ] |
| 3834 | ); |
| 3835 | } |
| 3836 | |
| 3837 | if ( in_array( $prefix, [ 'grid_hover', 'slider' ] ) ) { |
| 3838 | if ( 'slider' == $prefix ) { |
| 3839 | $thumbnail_padding_condition = [ |
| 3840 | 'slider_layout' => [ |
| 3841 | 'slider-layout4', |
| 3842 | 'slider-layout5', |
| 3843 | 'slider-layout6', |
| 3844 | 'slider-layout7', |
| 3845 | 'slider-layout8', |
| 3846 | 'slider-layout9', |
| 3847 | 'slider-layout10' |
| 3848 | ], |
| 3849 | ]; |
| 3850 | } else { |
| 3851 | $thumbnail_padding_condition = [ |
| 3852 | 'grid_hover_layout!' => '', |
| 3853 | ]; |
| 3854 | } |
| 3855 | $ref->add_responsive_control( |
| 3856 | 'grid_hover_thumbnail_margin', |
| 3857 | [ |
| 3858 | 'label' => esc_html__( 'Thumbnail padding', 'the-post-grid' ), |
| 3859 | 'type' => Controls_Manager::DIMENSIONS, |
| 3860 | 'size_units' => [ 'px' ], |
| 3861 | 'selectors' => [ |
| 3862 | '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3863 | '{{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper .gallery-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3864 | ], |
| 3865 | 'condition' => $thumbnail_padding_condition, |
| 3866 | ] |
| 3867 | ); |
| 3868 | } |
| 3869 | |
| 3870 | //Overlay Style Heading |
| 3871 | |
| 3872 | $ref->add_control( |
| 3873 | 'thumb_overlay_style_heading', |
| 3874 | [ |
| 3875 | 'label' => esc_html__( 'Overlay Style:', 'the-post-grid' ), |
| 3876 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 3877 | 'classes' => 'tpg-control-type-heading', |
| 3878 | ] |
| 3879 | ); |
| 3880 | |
| 3881 | //TODO: Tab normal |
| 3882 | $ref->start_controls_tabs( |
| 3883 | 'grid_hover_style_tabs' |
| 3884 | ); |
| 3885 | |
| 3886 | $ref->start_controls_tab( |
| 3887 | 'grid_hover_style_normal_tab', |
| 3888 | [ |
| 3889 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 3890 | ] |
| 3891 | ); |
| 3892 | |
| 3893 | $ref->add_group_control( |
| 3894 | \Elementor\Group_Control_Background::get_type(), |
| 3895 | [ |
| 3896 | 'name' => 'grid_hover_overlay_color', |
| 3897 | 'label' => esc_html__( 'Overlay BG', 'the-post-grid' ), |
| 3898 | 'types' => [ 'classic', 'gradient' ], |
| 3899 | 'selector' => '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content:before, {{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap .overlay', |
| 3900 | 'exclude' => [ 'image' ], |
| 3901 | 'fields_options' => [ |
| 3902 | 'background' => [ |
| 3903 | 'label' => esc_html__( 'Overlay Background Type', 'the-post-grid' ), |
| 3904 | ], |
| 3905 | 'color' => [ |
| 3906 | 'label' => 'Background Color', |
| 3907 | ], |
| 3908 | 'color_b' => [ |
| 3909 | 'label' => 'Background Color 2', |
| 3910 | ], |
| 3911 | ], |
| 3912 | ] |
| 3913 | ); |
| 3914 | |
| 3915 | $ref->add_control( |
| 3916 | 'thumb_lightbox_bg', |
| 3917 | [ |
| 3918 | 'label' => esc_html__( 'Light Box Background', 'the-post-grid' ), |
| 3919 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3920 | 'selectors' => [ |
| 3921 | '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}', |
| 3922 | ], |
| 3923 | 'condition' => [ |
| 3924 | 'is_thumb_lightbox' => 'show', |
| 3925 | ], |
| 3926 | ] |
| 3927 | ); |
| 3928 | |
| 3929 | $ref->add_control( |
| 3930 | 'thumb_lightbox_color', |
| 3931 | [ |
| 3932 | 'label' => esc_html__( 'Light Box Color', 'the-post-grid' ), |
| 3933 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3934 | 'selectors' => [ |
| 3935 | '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}', |
| 3936 | ], |
| 3937 | 'condition' => [ |
| 3938 | 'is_thumb_lightbox' => 'show', |
| 3939 | ], |
| 3940 | ] |
| 3941 | ); |
| 3942 | |
| 3943 | $ref->add_control( |
| 3944 | 'thumbnail_position', |
| 3945 | [ |
| 3946 | 'label' => esc_html__( 'Thumb Position', 'the-post-grid' ), |
| 3947 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3948 | 'default' => 'inherit', |
| 3949 | 'options' => [ |
| 3950 | '' => esc_html__( 'Center Center', 'the-post-grid' ), |
| 3951 | 'top center' => esc_html__( 'Top Center', 'the-post-grid' ), |
| 3952 | 'bottom center' => esc_html__( 'Bottom Center', 'the-post-grid' ), |
| 3953 | 'center left' => esc_html__( 'Left Center', 'the-post-grid' ), |
| 3954 | 'center right' => esc_html__( 'Right Center', 'the-post-grid' ), |
| 3955 | ], |
| 3956 | 'selectors' => [ |
| 3957 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder .tpg-el-image-wrap img' => 'object-position: {{VALUE}};', |
| 3958 | ], |
| 3959 | ] |
| 3960 | ); |
| 3961 | |
| 3962 | $ref->add_responsive_control( |
| 3963 | 'thumbnail_opacity', |
| 3964 | [ |
| 3965 | 'label' => esc_html__( 'Thumbnail Opacity', 'the-post-grid' ), |
| 3966 | 'type' => Controls_Manager::SLIDER, |
| 3967 | 'size_units' => [ 'px' ], |
| 3968 | 'range' => [ |
| 3969 | 'px' => [ |
| 3970 | 'min' => 0, |
| 3971 | 'max' => 1, |
| 3972 | 'step' => 0.1, |
| 3973 | ], |
| 3974 | ], |
| 3975 | 'selectors' => [ |
| 3976 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img' => 'opacity: {{SIZE}};', |
| 3977 | ], |
| 3978 | ] |
| 3979 | ); |
| 3980 | |
| 3981 | $ref->end_controls_tab(); |
| 3982 | |
| 3983 | //TODO: Tab Hover |
| 3984 | $ref->start_controls_tab( |
| 3985 | 'grid_hover_style_hover_tab', |
| 3986 | [ |
| 3987 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 3988 | ] |
| 3989 | ); |
| 3990 | |
| 3991 | $ref->add_group_control( |
| 3992 | \Elementor\Group_Control_Background::get_type(), |
| 3993 | [ |
| 3994 | 'name' => 'grid_hover_overlay_color_hover', |
| 3995 | 'label' => esc_html__( 'Overlay BG - Hover', 'the-post-grid' ), |
| 3996 | 'types' => [ 'classic', 'gradient' ], |
| 3997 | 'selector' => '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content:after, {{WRAPPER}} .tpg-el-main-wrapper .rt-holder:hover .tpg-el-image-wrap .overlay', |
| 3998 | 'exclude' => [ 'image' ], |
| 3999 | 'fields_options' => [ |
| 4000 | 'background' => [ |
| 4001 | 'label' => esc_html__( 'Overlay Background Type - Hover', 'the-post-grid' ), |
| 4002 | ], |
| 4003 | 'color' => [ |
| 4004 | 'label' => 'Background Color', |
| 4005 | ], |
| 4006 | 'color_b' => [ |
| 4007 | 'label' => 'Background Color 2', |
| 4008 | ], |
| 4009 | ], |
| 4010 | ] |
| 4011 | ); |
| 4012 | |
| 4013 | |
| 4014 | $ref->add_control( |
| 4015 | 'thumb_lightbox_bg_hover', |
| 4016 | [ |
| 4017 | 'label' => esc_html__( 'Light Box Background - Hover', 'the-post-grid' ), |
| 4018 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4019 | 'selectors' => [ |
| 4020 | '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}', |
| 4021 | ], |
| 4022 | 'condition' => [ |
| 4023 | 'is_thumb_lightbox' => 'show', |
| 4024 | ], |
| 4025 | ] |
| 4026 | ); |
| 4027 | |
| 4028 | $ref->add_control( |
| 4029 | 'thumb_lightbox_color_hover', |
| 4030 | [ |
| 4031 | 'label' => esc_html__( 'Light Box Color - Hover', 'the-post-grid' ), |
| 4032 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4033 | 'selectors' => [ |
| 4034 | '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}', |
| 4035 | ], |
| 4036 | 'condition' => [ |
| 4037 | 'is_thumb_lightbox' => 'show', |
| 4038 | ], |
| 4039 | ] |
| 4040 | ); |
| 4041 | |
| 4042 | $ref->add_control( |
| 4043 | 'thumbnail_position_hover', |
| 4044 | [ |
| 4045 | 'label' => esc_html__( 'Thumb Position - Hover', 'the-post-grid' ), |
| 4046 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 4047 | 'default' => 'inherit', |
| 4048 | 'options' => [ |
| 4049 | '' => esc_html__( 'Center Center', 'the-post-grid' ), |
| 4050 | 'top center' => esc_html__( 'Top Center', 'the-post-grid' ), |
| 4051 | 'bottom center' => esc_html__( 'Bottom Center', 'the-post-grid' ), |
| 4052 | 'center left' => esc_html__( 'Left Center', 'the-post-grid' ), |
| 4053 | 'center right' => esc_html__( 'Right Center', 'the-post-grid' ), |
| 4054 | ], |
| 4055 | 'selectors' => [ |
| 4056 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder:hover .tpg-el-image-wrap img' => 'object-position: {{VALUE}};', |
| 4057 | ], |
| 4058 | ] |
| 4059 | ); |
| 4060 | |
| 4061 | $ref->add_responsive_control( |
| 4062 | 'thumbnail_opacity_hover', |
| 4063 | [ |
| 4064 | 'label' => esc_html__( 'Thumbnail Opacity - Hover', 'the-post-grid' ), |
| 4065 | 'type' => Controls_Manager::SLIDER, |
| 4066 | 'size_units' => [ 'px' ], |
| 4067 | 'range' => [ |
| 4068 | 'px' => [ |
| 4069 | 'min' => 0, |
| 4070 | 'max' => 1, |
| 4071 | 'step' => 0.1, |
| 4072 | ], |
| 4073 | ], |
| 4074 | 'selectors' => [ |
| 4075 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder:hover .tpg-el-image-wrap img ' => 'opacity: {{SIZE}};', |
| 4076 | ], |
| 4077 | ] |
| 4078 | ); |
| 4079 | |
| 4080 | $ref->end_controls_tab(); |
| 4081 | |
| 4082 | $ref->end_controls_tabs(); |
| 4083 | |
| 4084 | //TODO: End Tab Hover |
| 4085 | |
| 4086 | $ref->add_responsive_control( |
| 4087 | 'thumbnail_transition_duration', |
| 4088 | [ |
| 4089 | 'label' => esc_html__( 'Thumbnail Transition Duration', 'the-post-grid' ), |
| 4090 | 'type' => Controls_Manager::SLIDER, |
| 4091 | 'size_units' => [ 'px' ], |
| 4092 | 'range' => [ |
| 4093 | 'px' => [ |
| 4094 | 'min' => 0, |
| 4095 | 'max' => 10, |
| 4096 | 'step' => 0.1, |
| 4097 | ], |
| 4098 | ], |
| 4099 | 'selectors' => [ |
| 4100 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img ' => 'transition-duration: {{SIZE}}s;', |
| 4101 | ], |
| 4102 | ] |
| 4103 | ); |
| 4104 | |
| 4105 | $ref->add_control( |
| 4106 | 'hr_for_overlay', |
| 4107 | [ |
| 4108 | 'type' => \Elementor\Controls_Manager::DIVIDER, |
| 4109 | ] |
| 4110 | ); |
| 4111 | |
| 4112 | $overlay_type_opt = [ |
| 4113 | 'always' => esc_html__( 'Show Always', 'the-post-grid' ), |
| 4114 | 'fadein-on-hover' => esc_html__( 'FadeIn on hover', 'the-post-grid' ), |
| 4115 | 'fadeout-on-hover' => esc_html__( 'FadeOut on hover', 'the-post-grid' ), |
| 4116 | 'slidein-on-hover' => esc_html__( 'SlideIn on hover', 'the-post-grid' ), |
| 4117 | 'slideout-on-hover' => esc_html__( 'SlideOut on hover', 'the-post-grid' ), |
| 4118 | 'zoomin-on-hover' => esc_html__( 'ZoomIn on hover', 'the-post-grid' ), |
| 4119 | 'zoomout-on-hover' => esc_html__( 'ZoomOut on hover', 'the-post-grid' ), |
| 4120 | 'zoominall-on-hover' => esc_html__( 'ZoomIn Content on hover', 'the-post-grid' ), |
| 4121 | 'zoomoutall-on-hover' => esc_html__( 'ZoomOut Content on hover', 'the-post-grid' ), |
| 4122 | ]; |
| 4123 | |
| 4124 | if ( $ref->prefix == 'grid_hover' || $ref->prefix == 'slider' ) { |
| 4125 | $overlay_type_opt2 = [ |
| 4126 | 'flipin-on-hover' => esc_html__( 'FlipIn on hover', 'the-post-grid' ), |
| 4127 | 'flipout-on-hover' => esc_html__( 'FlipOut on hover', 'the-post-grid' ), |
| 4128 | ]; |
| 4129 | $overlay_type_opt = array_merge( $overlay_type_opt, $overlay_type_opt2 ); |
| 4130 | } |
| 4131 | |
| 4132 | $ref->add_control( |
| 4133 | 'grid_hover_overlay_type', |
| 4134 | [ |
| 4135 | 'label' => esc_html__( 'Overlay Interaction', 'the-post-grid' ), |
| 4136 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 4137 | 'default' => 'always', |
| 4138 | 'options' => $overlay_type_opt, |
| 4139 | 'description' => esc_html__( 'If you don\'t choose overlay background then it will work only for some selected layout ', 'the-post-grid' ), |
| 4140 | 'prefix_class' => 'grid-hover-overlay-type-', |
| 4141 | ] |
| 4142 | ); |
| 4143 | |
| 4144 | $overlay_height_condition = [ |
| 4145 | 'grid_hover_layout!' => [ 'grid_hover-layout3' ], |
| 4146 | ]; |
| 4147 | if ( $ref->prefix === 'slider' ) { |
| 4148 | $overlay_height_condition = [ |
| 4149 | 'slider_layout!' => [ '' ], |
| 4150 | ]; |
| 4151 | } |
| 4152 | $ref->add_control( |
| 4153 | 'grid_hover_overlay_height', |
| 4154 | [ |
| 4155 | 'label' => esc_html__( 'Overlay Height', 'the-post-grid' ), |
| 4156 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 4157 | 'default' => 'default', |
| 4158 | 'options' => [ |
| 4159 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 4160 | 'full' => esc_html__( '100%', 'the-post-grid' ), |
| 4161 | 'auto' => esc_html__( 'Auto', 'the-post-grid' ), |
| 4162 | ], |
| 4163 | 'condition' => $overlay_height_condition, |
| 4164 | 'prefix_class' => 'grid-hover-overlay-height-', |
| 4165 | ] |
| 4166 | ); |
| 4167 | |
| 4168 | $ref->add_control( |
| 4169 | 'on_hover_overlay', |
| 4170 | [ |
| 4171 | 'label' => esc_html__( 'Overlay Height on hover', 'the-post-grid' ), |
| 4172 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 4173 | 'default' => 'default', |
| 4174 | 'options' => [ |
| 4175 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 4176 | 'full' => esc_html__( '100%', 'the-post-grid' ), |
| 4177 | 'auto' => esc_html__( 'Auto', 'the-post-grid' ), |
| 4178 | ], |
| 4179 | 'condition' => $overlay_height_condition, |
| 4180 | 'prefix_class' => 'hover-overlay-height-', |
| 4181 | ] |
| 4182 | ); |
| 4183 | |
| 4184 | $ref->end_controls_section(); |
| 4185 | } |
| 4186 | |
| 4187 | |
| 4188 | /** |
| 4189 | * Post Title Style |
| 4190 | * |
| 4191 | * @param $ref |
| 4192 | */ |
| 4193 | public static function titleStyle( $ref ) { |
| 4194 | $prefix = $ref->prefix; |
| 4195 | |
| 4196 | $ref->start_controls_section( |
| 4197 | 'title_style', |
| 4198 | [ |
| 4199 | 'label' => esc_html__( 'Post Title', 'the-post-grid' ), |
| 4200 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 4201 | 'condition' => [ |
| 4202 | 'show_title' => 'show', |
| 4203 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 4204 | ], |
| 4205 | ] |
| 4206 | ); |
| 4207 | |
| 4208 | $ref->add_responsive_control( |
| 4209 | 'title_spacing', |
| 4210 | [ |
| 4211 | 'label' => esc_html__( 'Title Margin', 'the-post-grid' ), |
| 4212 | 'type' => Controls_Manager::DIMENSIONS, |
| 4213 | 'size_units' => [ 'px' ], |
| 4214 | 'selectors' => [ |
| 4215 | '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4216 | ], |
| 4217 | 'allowed_dimensions' => 'all', |
| 4218 | 'default' => [ |
| 4219 | 'top' => '', |
| 4220 | 'right' => '', |
| 4221 | 'bottom' => '', |
| 4222 | 'left' => '', |
| 4223 | 'isLinked' => false, |
| 4224 | ], |
| 4225 | ] |
| 4226 | ); |
| 4227 | |
| 4228 | $ref->add_responsive_control( |
| 4229 | 'title_padding', |
| 4230 | [ |
| 4231 | 'label' => esc_html__( 'Title Padding', 'the-post-grid' ), |
| 4232 | 'type' => Controls_Manager::DIMENSIONS, |
| 4233 | 'size_units' => [ 'px' ], |
| 4234 | 'selectors' => [ |
| 4235 | '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper .entry-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4236 | ], |
| 4237 | 'allowed_dimensions' => 'all', |
| 4238 | 'default' => [ |
| 4239 | 'top' => '', |
| 4240 | 'right' => '', |
| 4241 | 'bottom' => '', |
| 4242 | 'left' => '', |
| 4243 | 'isLinked' => false, |
| 4244 | ], |
| 4245 | ] |
| 4246 | ); |
| 4247 | |
| 4248 | $ref->add_responsive_control( |
| 4249 | 'title_min_height', |
| 4250 | [ |
| 4251 | 'label' => esc_html__( 'Title Minimum Height (Optional)', 'the-post-grid' ), |
| 4252 | 'type' => Controls_Manager::SLIDER, |
| 4253 | 'size_units' => [ 'px' ], |
| 4254 | 'range' => [ |
| 4255 | 'px' => [ |
| 4256 | 'min' => 0, |
| 4257 | 'max' => 300, |
| 4258 | 'step' => 1, |
| 4259 | ], |
| 4260 | ], |
| 4261 | 'selectors' => [ |
| 4262 | '{{WRAPPER}} .rt-tpg-container .entry-title-wrapper' => 'min-height: {{SIZE}}{{UNIT}};', |
| 4263 | ], |
| 4264 | ] |
| 4265 | ); |
| 4266 | |
| 4267 | $ref->add_group_control( |
| 4268 | \Elementor\Group_Control_Typography::get_type(), |
| 4269 | [ |
| 4270 | 'name' => 'title_typography', |
| 4271 | 'label' => esc_html__( 'Typography', 'the-post-grid' ), |
| 4272 | 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .entry-title-wrapper .entry-title', |
| 4273 | ] |
| 4274 | ); |
| 4275 | |
| 4276 | //Offset Title |
| 4277 | $ref->add_group_control( |
| 4278 | \Elementor\Group_Control_Typography::get_type(), |
| 4279 | [ |
| 4280 | 'name' => 'title_offset_typography', |
| 4281 | 'label' => esc_html__( 'Offset Typography', 'the-post-grid' ), |
| 4282 | 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .offset-left .entry-title-wrapper .entry-title', |
| 4283 | 'description' => esc_html__( 'You can overwrite offset title font style', 'the-post-grid' ), |
| 4284 | 'condition' => [ |
| 4285 | $prefix . '_layout' => [ |
| 4286 | 'grid-layout5', |
| 4287 | 'grid-layout5-2', |
| 4288 | 'grid-layout6', |
| 4289 | 'grid-layout6-2', |
| 4290 | 'list-layout2', |
| 4291 | 'list-layout3', |
| 4292 | 'list-layout2-2', |
| 4293 | 'list-layout3-2', |
| 4294 | 'grid_hover-layout4', |
| 4295 | 'grid_hover-layout4-2', |
| 4296 | 'grid_hover-layout5', |
| 4297 | 'grid_hover-layout5-2', |
| 4298 | 'grid_hover-layout6', |
| 4299 | 'grid_hover-layout6-2', |
| 4300 | 'grid_hover-layout7', |
| 4301 | 'grid_hover-layout7-2', |
| 4302 | 'grid_hover-layout9', |
| 4303 | 'grid_hover-layout9-2', |
| 4304 | ], |
| 4305 | ], |
| 4306 | ] |
| 4307 | ); |
| 4308 | |
| 4309 | $ref->add_control( |
| 4310 | 'title_border_visibility', |
| 4311 | [ |
| 4312 | 'label' => esc_html__( 'Title Border Bottom', 'the-post-grid' ), |
| 4313 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 4314 | 'default' => 'default', |
| 4315 | 'options' => [ |
| 4316 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 4317 | 'show' => esc_html__( 'Show', 'the-post-grid' ), |
| 4318 | 'hide' => esc_html__( 'Hide', 'the-post-grid' ), |
| 4319 | ], |
| 4320 | 'prefix_class' => 'tpg-title-border-', |
| 4321 | 'condition' => [ |
| 4322 | $prefix . '_layout' => 'grid_hover-layout3', |
| 4323 | ], |
| 4324 | ] |
| 4325 | ); |
| 4326 | |
| 4327 | $ref->add_responsive_control( |
| 4328 | 'title_alignment', |
| 4329 | [ |
| 4330 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 4331 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 4332 | 'options' => [ |
| 4333 | 'left' => [ |
| 4334 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 4335 | 'icon' => 'eicon-text-align-left', |
| 4336 | ], |
| 4337 | 'center' => [ |
| 4338 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 4339 | 'icon' => 'eicon-text-align-center', |
| 4340 | ], |
| 4341 | 'right' => [ |
| 4342 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 4343 | 'icon' => 'eicon-text-align-right', |
| 4344 | ], |
| 4345 | 'justify' => [ |
| 4346 | 'title' => esc_html__( 'Justify', 'the-post-grid' ), |
| 4347 | 'icon' => 'eicon-text-align-justify', |
| 4348 | ], |
| 4349 | ], |
| 4350 | 'prefix_class' => 'title-alignment-', |
| 4351 | 'toggle' => true, |
| 4352 | 'selectors' => [ |
| 4353 | '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'text-align: {{VALUE}};', |
| 4354 | ], |
| 4355 | ] |
| 4356 | ); |
| 4357 | |
| 4358 | //TODO: Start Title Style Tba |
| 4359 | $ref->start_controls_tabs( |
| 4360 | 'title_style_tabs' |
| 4361 | ); |
| 4362 | |
| 4363 | $ref->start_controls_tab( |
| 4364 | 'title_normal_tab', |
| 4365 | [ |
| 4366 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 4367 | ] |
| 4368 | ); |
| 4369 | //TODO: Normal Tab |
| 4370 | $ref->add_control( |
| 4371 | 'title_color', |
| 4372 | [ |
| 4373 | 'label' => esc_html__( 'Title Color', 'the-post-grid' ), |
| 4374 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4375 | 'selectors' => [ |
| 4376 | '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'color: {{VALUE}}', |
| 4377 | ], |
| 4378 | ] |
| 4379 | ); |
| 4380 | |
| 4381 | $ref->add_control( |
| 4382 | 'title_bg_color', |
| 4383 | [ |
| 4384 | 'label' => esc_html__( 'Title Background', 'the-post-grid' ), |
| 4385 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4386 | 'selectors' => [ |
| 4387 | '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'background-color: {{VALUE}}', |
| 4388 | ], |
| 4389 | ] |
| 4390 | ); |
| 4391 | |
| 4392 | $ref->add_control( |
| 4393 | 'title_border_color', |
| 4394 | [ |
| 4395 | 'label' => esc_html__( 'Title Separator Color', 'the-post-grid' ), |
| 4396 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4397 | 'selectors' => [ |
| 4398 | '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}', |
| 4399 | ], |
| 4400 | 'condition' => [ |
| 4401 | $prefix . '_layout' => 'grid_hover-layout3', |
| 4402 | 'title_border_visibility!' => 'hide', |
| 4403 | ], |
| 4404 | ] |
| 4405 | ); |
| 4406 | |
| 4407 | $ref->end_controls_tab(); |
| 4408 | |
| 4409 | $ref->start_controls_tab( |
| 4410 | 'title_hover_tab', |
| 4411 | [ |
| 4412 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 4413 | ] |
| 4414 | ); |
| 4415 | |
| 4416 | //TODO: Hover Tab |
| 4417 | $ref->add_control( |
| 4418 | 'title_hover_color', |
| 4419 | [ |
| 4420 | 'label' => esc_html__( 'Title Color on Hover', 'the-post-grid' ), |
| 4421 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4422 | 'selectors' => [ |
| 4423 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .entry-title:hover' => 'color: {{VALUE}} !important', |
| 4424 | ], |
| 4425 | ] |
| 4426 | ); |
| 4427 | |
| 4428 | $ref->add_control( |
| 4429 | 'title_bg_color_hover', |
| 4430 | [ |
| 4431 | 'label' => esc_html__( 'Title Background on hover', 'the-post-grid' ), |
| 4432 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4433 | 'selectors' => [ |
| 4434 | '{{WRAPPER}} .tpg-el-main-wrapper .entry-title:hover' => 'background-color: {{VALUE}} !important', |
| 4435 | ], |
| 4436 | ] |
| 4437 | ); |
| 4438 | |
| 4439 | $ref->add_control( |
| 4440 | 'title_hover_border_color', |
| 4441 | [ |
| 4442 | 'label' => esc_html__( 'Title Hover Border Color', 'the-post-grid' ), |
| 4443 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4444 | 'selectors' => [ |
| 4445 | '{{WRAPPER}}' => '--tpg-primary-color: {{VALUE}}', |
| 4446 | ], |
| 4447 | 'condition' => [ |
| 4448 | 'title_hover_underline' => 'enable', |
| 4449 | ], |
| 4450 | ] |
| 4451 | ); |
| 4452 | |
| 4453 | $ref->end_controls_tab(); |
| 4454 | |
| 4455 | $ref->start_controls_tab( |
| 4456 | 'title_box_hover_tab', |
| 4457 | [ |
| 4458 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 4459 | ] |
| 4460 | ); |
| 4461 | |
| 4462 | //TODO: Box Hover Tab |
| 4463 | $ref->add_control( |
| 4464 | 'title_color_box_hover', |
| 4465 | [ |
| 4466 | 'label' => esc_html__( 'Title color on boxhover', 'the-post-grid' ), |
| 4467 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4468 | 'selectors' => [ |
| 4469 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title' => 'color: {{VALUE}}', |
| 4470 | ], |
| 4471 | ] |
| 4472 | ); |
| 4473 | |
| 4474 | $ref->add_control( |
| 4475 | 'title_bg_color_box_hover', |
| 4476 | [ |
| 4477 | 'label' => esc_html__( 'Title Background on boxhover', 'the-post-grid' ), |
| 4478 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4479 | 'selectors' => [ |
| 4480 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title' => 'background-color: {{VALUE}}', |
| 4481 | ], |
| 4482 | ] |
| 4483 | ); |
| 4484 | |
| 4485 | $ref->add_control( |
| 4486 | 'title_border_color_hover', |
| 4487 | [ |
| 4488 | 'label' => esc_html__( 'Title Separator color - boxhover', 'the-post-grid' ), |
| 4489 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4490 | 'selectors' => [ |
| 4491 | '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}', |
| 4492 | ], |
| 4493 | 'condition' => [ |
| 4494 | $prefix . '_layout' => 'grid_hover-layout3', |
| 4495 | 'title_border_visibility!' => 'hide', |
| 4496 | ], |
| 4497 | ] |
| 4498 | ); |
| 4499 | |
| 4500 | $ref->end_controls_tab(); |
| 4501 | |
| 4502 | $ref->end_controls_tabs(); |
| 4503 | |
| 4504 | $ref->end_controls_section(); |
| 4505 | } |
| 4506 | |
| 4507 | /** |
| 4508 | * Content Style / Excerpt Style Tab |
| 4509 | * |
| 4510 | * @param $ref |
| 4511 | */ |
| 4512 | public static function contentStyle( $ref ) { |
| 4513 | $prefix = $ref->prefix; |
| 4514 | |
| 4515 | $ref->start_controls_section( |
| 4516 | 'excerpt_style', |
| 4517 | [ |
| 4518 | 'label' => esc_html__( 'Excerpt / Content', 'the-post-grid' ), |
| 4519 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 4520 | 'condition' => [ |
| 4521 | 'show_excerpt' => 'show', |
| 4522 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 4523 | ], |
| 4524 | ] |
| 4525 | ); |
| 4526 | |
| 4527 | $ref->add_group_control( |
| 4528 | \Elementor\Group_Control_Typography::get_type(), |
| 4529 | [ |
| 4530 | 'name' => 'content_typography', |
| 4531 | 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner', |
| 4532 | ] |
| 4533 | ); |
| 4534 | |
| 4535 | $ref->add_responsive_control( |
| 4536 | 'excerpt_spacing', |
| 4537 | [ |
| 4538 | 'label' => esc_html__( 'Excerpt Spacing', 'the-post-grid' ), |
| 4539 | 'type' => Controls_Manager::DIMENSIONS, |
| 4540 | 'size_units' => [ 'px' ], |
| 4541 | 'selectors' => [ |
| 4542 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4543 | ], |
| 4544 | 'allowed_dimensions' => 'all', |
| 4545 | 'default' => [ |
| 4546 | 'top' => '', |
| 4547 | 'right' => '', |
| 4548 | 'bottom' => '', |
| 4549 | 'left' => '', |
| 4550 | 'isLinked' => false, |
| 4551 | ], |
| 4552 | ] |
| 4553 | ); |
| 4554 | |
| 4555 | $ref->add_responsive_control( |
| 4556 | 'content_alignment', |
| 4557 | [ |
| 4558 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 4559 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 4560 | 'options' => [ |
| 4561 | 'left' => [ |
| 4562 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 4563 | 'icon' => 'eicon-text-align-left', |
| 4564 | ], |
| 4565 | 'center' => [ |
| 4566 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 4567 | 'icon' => 'eicon-text-align-center', |
| 4568 | ], |
| 4569 | 'right' => [ |
| 4570 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 4571 | 'icon' => 'eicon-text-align-right', |
| 4572 | ], |
| 4573 | 'justify' => [ |
| 4574 | 'title' => esc_html__( 'Justify', 'the-post-grid' ), |
| 4575 | 'icon' => 'eicon-text-align-justify', |
| 4576 | ], |
| 4577 | ], |
| 4578 | 'toggle' => true, |
| 4579 | 'selectors' => [ |
| 4580 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner' => 'text-align: {{VALUE}}', |
| 4581 | ], |
| 4582 | ] |
| 4583 | ); |
| 4584 | |
| 4585 | //TODO: Start Content Tab |
| 4586 | |
| 4587 | $ref->start_controls_tabs( |
| 4588 | 'excerpt_style_tabs' |
| 4589 | ); |
| 4590 | |
| 4591 | $ref->start_controls_tab( |
| 4592 | 'excerpt_normal_tab', |
| 4593 | [ |
| 4594 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 4595 | ] |
| 4596 | ); |
| 4597 | |
| 4598 | //TODO: Normal Tab |
| 4599 | $ref->add_control( |
| 4600 | 'excerpt_color', |
| 4601 | [ |
| 4602 | 'label' => esc_html__( 'Excerpt color', 'the-post-grid' ), |
| 4603 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4604 | 'selectors' => [ |
| 4605 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}}', |
| 4606 | ], |
| 4607 | ] |
| 4608 | ); |
| 4609 | |
| 4610 | $ref->add_control( |
| 4611 | 'excerpt_border', |
| 4612 | [ |
| 4613 | 'label' => esc_html__( 'Border color', 'the-post-grid' ), |
| 4614 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4615 | 'selectors' => [ |
| 4616 | '{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder .rt-el-post-meta::before' => 'background: {{VALUE}}', |
| 4617 | ], |
| 4618 | 'condition' => [ |
| 4619 | 'meta_position' => 'default', |
| 4620 | $prefix . '_layout' => [ 'grid-layout3' ], |
| 4621 | ], |
| 4622 | ] |
| 4623 | ); |
| 4624 | |
| 4625 | $ref->end_controls_tab(); |
| 4626 | |
| 4627 | $ref->start_controls_tab( |
| 4628 | 'excerpt_hover_tab', |
| 4629 | [ |
| 4630 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 4631 | ] |
| 4632 | ); |
| 4633 | |
| 4634 | //TODO: Hover Tab |
| 4635 | $ref->add_control( |
| 4636 | 'excerpt_hover_color', |
| 4637 | [ |
| 4638 | 'label' => esc_html__( 'Excerpt color on hover', 'the-post-grid' ), |
| 4639 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4640 | 'selectors' => [ |
| 4641 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}} !important', |
| 4642 | ], |
| 4643 | ] |
| 4644 | ); |
| 4645 | |
| 4646 | $ref->add_control( |
| 4647 | 'excerpt_border_hover', |
| 4648 | [ |
| 4649 | 'label' => esc_html__( 'Border color - Hover', 'the-post-grid' ), |
| 4650 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4651 | 'selectors' => [ |
| 4652 | '{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder:hover .rt-el-post-meta::before' => 'background: {{VALUE}}', |
| 4653 | ], |
| 4654 | 'condition' => [ |
| 4655 | 'meta_position' => 'default', |
| 4656 | $prefix . '_layout' => [ 'grid-layout3' ], |
| 4657 | ], |
| 4658 | ] |
| 4659 | ); |
| 4660 | |
| 4661 | $ref->end_controls_tab(); |
| 4662 | |
| 4663 | $ref->end_controls_tabs(); |
| 4664 | |
| 4665 | $ref->end_controls_section(); |
| 4666 | } |
| 4667 | |
| 4668 | /** |
| 4669 | * Post Meta Style |
| 4670 | * |
| 4671 | * @param $ref |
| 4672 | */ |
| 4673 | public static function metaInfoStyle( $ref ) { |
| 4674 | $prefix = $ref->prefix; |
| 4675 | |
| 4676 | $ref->start_controls_section( |
| 4677 | 'post_meta_style', |
| 4678 | [ |
| 4679 | 'label' => esc_html__( 'Meta Data', 'the-post-grid' ), |
| 4680 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 4681 | 'condition' => [ |
| 4682 | 'show_meta' => 'show', |
| 4683 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 4684 | ], |
| 4685 | ] |
| 4686 | ); |
| 4687 | |
| 4688 | $ref->add_group_control( |
| 4689 | \Elementor\Group_Control_Typography::get_type(), |
| 4690 | [ |
| 4691 | 'name' => 'post_meta_typography', |
| 4692 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-el-post-meta, {{WRAPPER}} .tpg-post-holder .tpg-separate-category .categories-links a', |
| 4693 | ] |
| 4694 | ); |
| 4695 | $ref->add_responsive_control( |
| 4696 | 'post_meta_alignment', |
| 4697 | [ |
| 4698 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 4699 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 4700 | 'options' => [ |
| 4701 | 'left' => [ |
| 4702 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 4703 | 'icon' => 'eicon-text-align-left', |
| 4704 | ], |
| 4705 | 'center' => [ |
| 4706 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 4707 | 'icon' => 'eicon-text-align-center', |
| 4708 | ], |
| 4709 | 'right' => [ |
| 4710 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 4711 | 'icon' => 'eicon-text-align-right', |
| 4712 | ], |
| 4713 | ], |
| 4714 | 'toggle' => true, |
| 4715 | 'selectors' => [ |
| 4716 | '{{WRAPPER}} .rt-tpg-container .rt-el-post-meta' => 'text-align: {{VALUE}}', |
| 4717 | ], |
| 4718 | ] |
| 4719 | ); |
| 4720 | |
| 4721 | |
| 4722 | $ref->add_responsive_control( |
| 4723 | 'meta_spacing', |
| 4724 | [ |
| 4725 | 'label' => esc_html__( 'Meta Spacing', 'the-post-grid' ), |
| 4726 | 'type' => Controls_Manager::DIMENSIONS, |
| 4727 | 'size_units' => [ 'px' ], |
| 4728 | 'selectors' => [ |
| 4729 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder .rt-el-post-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4730 | ], |
| 4731 | 'allowed_dimensions' => 'all', |
| 4732 | 'default' => [ |
| 4733 | 'top' => '', |
| 4734 | 'right' => '', |
| 4735 | 'bottom' => '', |
| 4736 | 'left' => '', |
| 4737 | 'isLinked' => false, |
| 4738 | ], |
| 4739 | ] |
| 4740 | ); |
| 4741 | |
| 4742 | |
| 4743 | //TODO: Start Content Tab |
| 4744 | |
| 4745 | $ref->start_controls_tabs( |
| 4746 | 'meta_info_style_tabs' |
| 4747 | ); |
| 4748 | |
| 4749 | $ref->start_controls_tab( |
| 4750 | 'meta_info_normal_tab', |
| 4751 | [ |
| 4752 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 4753 | ] |
| 4754 | ); |
| 4755 | |
| 4756 | //TODO: Normal Tab |
| 4757 | |
| 4758 | $ref->add_control( |
| 4759 | 'meta_info_color', |
| 4760 | [ |
| 4761 | 'label' => esc_html__( 'Meta Color', 'the-post-grid' ), |
| 4762 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4763 | 'selectors' => [ |
| 4764 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags span' => 'color: {{VALUE}}', |
| 4765 | ], |
| 4766 | ] |
| 4767 | ); |
| 4768 | |
| 4769 | $ref->add_control( |
| 4770 | 'meta_link_color', |
| 4771 | [ |
| 4772 | 'label' => esc_html__( 'Meta Link Color', 'the-post-grid' ), |
| 4773 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4774 | 'selectors' => [ |
| 4775 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags a' => 'color: {{VALUE}}', |
| 4776 | ], |
| 4777 | ] |
| 4778 | ); |
| 4779 | |
| 4780 | $ref->add_control( |
| 4781 | 'meta_separator_color', |
| 4782 | [ |
| 4783 | 'label' => esc_html__( 'Separator Color', 'the-post-grid' ), |
| 4784 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4785 | 'selectors' => [ |
| 4786 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .separator' => 'color: {{VALUE}}', |
| 4787 | ], |
| 4788 | 'condition' => [ |
| 4789 | 'meta_separator!' => 'default', |
| 4790 | ], |
| 4791 | ] |
| 4792 | ); |
| 4793 | |
| 4794 | $ref->add_control( |
| 4795 | 'meta_icon_color', |
| 4796 | [ |
| 4797 | 'label' => esc_html__( 'Icon Color', 'the-post-grid' ), |
| 4798 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4799 | 'selectors' => [ |
| 4800 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags i' => 'color: {{VALUE}}', |
| 4801 | ], |
| 4802 | ] |
| 4803 | ); |
| 4804 | |
| 4805 | |
| 4806 | $ref->end_controls_tab(); |
| 4807 | |
| 4808 | $ref->start_controls_tab( |
| 4809 | 'meta_info_hover_tab', |
| 4810 | [ |
| 4811 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 4812 | ] |
| 4813 | ); |
| 4814 | |
| 4815 | //TODO: Hover Tab |
| 4816 | |
| 4817 | |
| 4818 | $ref->add_control( |
| 4819 | 'meta_link_colo_hover', |
| 4820 | [ |
| 4821 | 'label' => esc_html__( 'Meta Link Color - Hover', 'the-post-grid' ), |
| 4822 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4823 | 'selectors' => [ |
| 4824 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .post-meta-tags a:hover' => 'color: {{VALUE}}', |
| 4825 | ], |
| 4826 | ] |
| 4827 | ); |
| 4828 | |
| 4829 | $ref->end_controls_tab(); |
| 4830 | |
| 4831 | $ref->start_controls_tab( |
| 4832 | 'meta_info_box_hover_tab', |
| 4833 | [ |
| 4834 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 4835 | ] |
| 4836 | ); |
| 4837 | |
| 4838 | //TODO: Box Hover Tab |
| 4839 | |
| 4840 | |
| 4841 | $ref->add_control( |
| 4842 | 'meta_link_colo_box_hover', |
| 4843 | [ |
| 4844 | 'label' => esc_html__( 'Meta Color - Box Hover', 'the-post-grid' ), |
| 4845 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4846 | 'selectors' => [ |
| 4847 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags *' => 'color: {{VALUE}}', |
| 4848 | ], |
| 4849 | ] |
| 4850 | ); |
| 4851 | |
| 4852 | $ref->end_controls_tab(); |
| 4853 | |
| 4854 | $ref->end_controls_tabs(); |
| 4855 | |
| 4856 | |
| 4857 | //Separate Category style |
| 4858 | |
| 4859 | $ref->add_control( |
| 4860 | 'separator_cat_heading', |
| 4861 | [ |
| 4862 | 'label' => esc_html__( 'Separate Category', 'the-post-grid' ), |
| 4863 | 'description' => esc_html__( 'Separate Category', 'the-post-grid' ), |
| 4864 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 4865 | 'classes' => 'tpg-control-type-heading', |
| 4866 | ] |
| 4867 | ); |
| 4868 | |
| 4869 | $ref->add_group_control( |
| 4870 | \Elementor\Group_Control_Typography::get_type(), |
| 4871 | [ |
| 4872 | 'name' => 'separator_cat_typography', |
| 4873 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .categories-links', |
| 4874 | ] |
| 4875 | ); |
| 4876 | |
| 4877 | $ref->add_control( |
| 4878 | 'category_margin_bottom', |
| 4879 | [ |
| 4880 | 'label' => esc_html__( 'Category Margin Bottom', 'the-post-grid' ), |
| 4881 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 4882 | 'min' => 0, |
| 4883 | 'max' => 50, |
| 4884 | 'step' => 1, |
| 4885 | 'condition' => [ |
| 4886 | 'category_position' => 'above_title', |
| 4887 | ], |
| 4888 | 'selectors' => [ |
| 4889 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.above_title' => 'margin-bottom: {{VALUE}}px;', |
| 4890 | ], |
| 4891 | ] |
| 4892 | ); |
| 4893 | |
| 4894 | |
| 4895 | $ref->add_responsive_control( |
| 4896 | 'category_radius', |
| 4897 | [ |
| 4898 | 'label' => esc_html__( 'Category Border Radius', 'the-post-grid' ), |
| 4899 | 'type' => Controls_Manager::DIMENSIONS, |
| 4900 | 'size_units' => [ 'px' ], |
| 4901 | 'selectors' => [ |
| 4902 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4903 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4904 | ], |
| 4905 | 'condition' => [ |
| 4906 | 'category_style!' => 'style3', |
| 4907 | ], |
| 4908 | ] |
| 4909 | ); |
| 4910 | |
| 4911 | $ref->start_controls_tabs( |
| 4912 | 'separate_cat_info_style_tabs' |
| 4913 | ); |
| 4914 | |
| 4915 | $ref->start_controls_tab( |
| 4916 | 'separate_cat_normal_tab', |
| 4917 | [ |
| 4918 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 4919 | ] |
| 4920 | ); |
| 4921 | |
| 4922 | //TODO: Normal Tab |
| 4923 | |
| 4924 | |
| 4925 | $ref->add_control( |
| 4926 | 'separate_category_color', |
| 4927 | [ |
| 4928 | 'label' => esc_html__( 'Category Color', 'the-post-grid' ), |
| 4929 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4930 | 'selectors' => [ |
| 4931 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links' => 'color: {{VALUE}}', |
| 4932 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links a' => 'color: {{VALUE}}', |
| 4933 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a' => 'color: {{VALUE}}', |
| 4934 | ], |
| 4935 | ] |
| 4936 | ); |
| 4937 | $ref->add_control( |
| 4938 | 'separate_category_bg', |
| 4939 | [ |
| 4940 | 'label' => esc_html__( 'Category Background', 'the-post-grid' ), |
| 4941 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4942 | 'selectors' => [ |
| 4943 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links a' => 'background-color: {{VALUE}};padding: 3px 8px 1px;', |
| 4944 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category:not(.style1) .categories-links a' => 'background-color: {{VALUE}}', |
| 4945 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category:not(.style1) .categories-links a:after' => 'border-top-color: {{VALUE}}', |
| 4946 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a' => 'background-color: {{VALUE}}', |
| 4947 | ], |
| 4948 | 'description' => rtTPG()->hasPro() ? esc_html__( 'If you use different background color then avoid this color', 'the-post-grid' ) : esc_html__( 'Choose separate category background', 'the-post-grid' ) |
| 4949 | ] |
| 4950 | ); |
| 4951 | $ref->add_control( |
| 4952 | 'separate_category_icon_color', |
| 4953 | [ |
| 4954 | 'label' => esc_html__( 'Category Icon Color', 'the-post-grid' ), |
| 4955 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4956 | 'selectors' => [ |
| 4957 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links i' => 'color: {{VALUE}}', |
| 4958 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links i' => 'color: {{VALUE}}', |
| 4959 | ], |
| 4960 | 'condition' => [ |
| 4961 | 'show_cat_icon' => 'yes', |
| 4962 | ], |
| 4963 | ] |
| 4964 | ); |
| 4965 | |
| 4966 | $ref->end_controls_tab(); |
| 4967 | |
| 4968 | $ref->start_controls_tab( |
| 4969 | 'separate_cat_hover_tab', |
| 4970 | [ |
| 4971 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 4972 | ] |
| 4973 | ); |
| 4974 | |
| 4975 | //TODO: Hover Tab |
| 4976 | |
| 4977 | |
| 4978 | $ref->add_control( |
| 4979 | 'separate_category_color_hover', |
| 4980 | [ |
| 4981 | 'label' => esc_html__( 'Category Color - Hover', 'the-post-grid' ), |
| 4982 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4983 | 'selectors' => [ |
| 4984 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links a:hover' => 'color: {{VALUE}} !important', |
| 4985 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a:hover' => 'color: {{VALUE}} !important', |
| 4986 | ], |
| 4987 | ] |
| 4988 | ); |
| 4989 | |
| 4990 | $ref->add_control( |
| 4991 | 'separate_category_bg_hover', |
| 4992 | [ |
| 4993 | 'label' => esc_html__( 'Category Background - Hover', 'the-post-grid' ), |
| 4994 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4995 | 'selectors' => [ |
| 4996 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links:hover' => 'background-color: {{VALUE}};padding: 3px 8px;', |
| 4997 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links:not(.style1) a:hover' => 'background-color: {{VALUE}}', |
| 4998 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links:not(.style1) a:hover::after' => 'border-top-color: {{VALUE}}', |
| 4999 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a:hover' => 'background-color: {{VALUE}}', |
| 5000 | ], |
| 5001 | ] |
| 5002 | ); |
| 5003 | |
| 5004 | $ref->end_controls_tab(); |
| 5005 | |
| 5006 | $ref->start_controls_tab( |
| 5007 | 'separate_cat_box_hover_tab', |
| 5008 | [ |
| 5009 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 5010 | ] |
| 5011 | ); |
| 5012 | |
| 5013 | //TODO: Box Hover Tab |
| 5014 | |
| 5015 | |
| 5016 | $ref->add_control( |
| 5017 | 'separate_category_color_box_hover', |
| 5018 | [ |
| 5019 | 'label' => esc_html__( 'Category Color - Hover', 'the-post-grid' ), |
| 5020 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5021 | 'selectors' => [ |
| 5022 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category .categories-links a' => 'color: {{VALUE}}', |
| 5023 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links a' => 'color: {{VALUE}}', |
| 5024 | ], |
| 5025 | ] |
| 5026 | ); |
| 5027 | $ref->add_control( |
| 5028 | 'separate_category_bg_box_hover', |
| 5029 | [ |
| 5030 | 'label' => esc_html__( 'Category Background - Box Hover', 'the-post-grid' ), |
| 5031 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5032 | 'selectors' => [ |
| 5033 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category.style1 .categories-links' => 'background-color: {{VALUE}};padding: 3px 8px;', |
| 5034 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category:not(.style1) .categories-links a' => 'background-color: {{VALUE}}', |
| 5035 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category:not(.style1) .categories-links a::after' => 'border-top-color: {{VALUE}}', |
| 5036 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links a' => 'background-color: {{VALUE}}', |
| 5037 | ], |
| 5038 | ] |
| 5039 | ); |
| 5040 | |
| 5041 | $ref->add_control( |
| 5042 | 'separate_category_icon_color_box_hover', |
| 5043 | [ |
| 5044 | 'label' => esc_html__( 'Category Icon Color - Box Hover', 'the-post-grid' ), |
| 5045 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5046 | 'selectors' => [ |
| 5047 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category .categories-links i' => 'color: {{VALUE}}', |
| 5048 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links i' => 'color: {{VALUE}}', |
| 5049 | ], |
| 5050 | 'condition' => [ |
| 5051 | 'show_cat_icon' => 'yes', |
| 5052 | ], |
| 5053 | ] |
| 5054 | ); |
| 5055 | |
| 5056 | $ref->end_controls_tab(); |
| 5057 | |
| 5058 | $ref->end_controls_tabs(); |
| 5059 | |
| 5060 | |
| 5061 | $ref->end_controls_section(); |
| 5062 | } |
| 5063 | |
| 5064 | |
| 5065 | /** |
| 5066 | * Read More style |
| 5067 | * |
| 5068 | * @param $ref |
| 5069 | */ |
| 5070 | public static function readmoreStyle( $ref ) { |
| 5071 | $prefix = $ref->prefix; |
| 5072 | |
| 5073 | $ref->start_controls_section( |
| 5074 | 'readmore_button_style', |
| 5075 | [ |
| 5076 | 'label' => esc_html__( 'Read More', 'the-post-grid' ), |
| 5077 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 5078 | 'condition' => [ |
| 5079 | 'show_read_more' => 'show', |
| 5080 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 5081 | ], |
| 5082 | ] |
| 5083 | ); |
| 5084 | |
| 5085 | $ref->add_group_control( |
| 5086 | \Elementor\Group_Control_Typography::get_type(), |
| 5087 | [ |
| 5088 | 'name' => 'readmore_typography', |
| 5089 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a', |
| 5090 | ] |
| 5091 | ); |
| 5092 | |
| 5093 | |
| 5094 | $ref->add_responsive_control( |
| 5095 | 'readmore_spacing', |
| 5096 | [ |
| 5097 | 'label' => esc_html__( 'Button Spacing', 'the-post-grid' ), |
| 5098 | 'type' => Controls_Manager::DIMENSIONS, |
| 5099 | 'size_units' => [ 'px' ], |
| 5100 | 'allowed_dimensions' => 'all', |
| 5101 | 'default' => [ |
| 5102 | 'top' => '', |
| 5103 | 'right' => '', |
| 5104 | 'bottom' => '', |
| 5105 | 'left' => '', |
| 5106 | 'isLinked' => false, |
| 5107 | ], |
| 5108 | 'selectors' => [ |
| 5109 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5110 | ], |
| 5111 | ] |
| 5112 | ); |
| 5113 | |
| 5114 | $ref->add_responsive_control( |
| 5115 | 'readmore_padding', |
| 5116 | [ |
| 5117 | 'label' => esc_html__( 'Button Padding', 'the-post-grid' ), |
| 5118 | 'type' => Controls_Manager::DIMENSIONS, |
| 5119 | 'size_units' => [ 'px' ], |
| 5120 | 'selectors' => [ |
| 5121 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5122 | ], |
| 5123 | 'condition' => [ |
| 5124 | 'readmore_btn_style' => 'default-style', |
| 5125 | ], |
| 5126 | ] |
| 5127 | ); |
| 5128 | |
| 5129 | |
| 5130 | $ref->add_responsive_control( |
| 5131 | 'readmore_btn_alignment', |
| 5132 | [ |
| 5133 | 'label' => esc_html__( 'Button Alignment', 'the-post-grid' ), |
| 5134 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5135 | 'options' => [ |
| 5136 | 'left' => [ |
| 5137 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 5138 | 'icon' => 'eicon-text-align-left', |
| 5139 | ], |
| 5140 | 'center' => [ |
| 5141 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 5142 | 'icon' => 'eicon-text-align-center', |
| 5143 | ], |
| 5144 | 'right' => [ |
| 5145 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 5146 | 'icon' => 'eicon-text-align-right', |
| 5147 | ], |
| 5148 | ], |
| 5149 | 'selectors' => [ |
| 5150 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more' => 'text-align:{{VALUE}}', |
| 5151 | ], |
| 5152 | 'toggle' => true, |
| 5153 | ] |
| 5154 | ); |
| 5155 | |
| 5156 | $ref->add_responsive_control( |
| 5157 | 'readmore_icon_size', |
| 5158 | [ |
| 5159 | 'label' => esc_html__( 'Icon Size', 'the-post-grid' ), |
| 5160 | 'type' => Controls_Manager::SLIDER, |
| 5161 | 'size_units' => [ 'px' ], |
| 5162 | 'range' => [ |
| 5163 | 'px' => [ |
| 5164 | 'min' => 10, |
| 5165 | 'max' => 50, |
| 5166 | 'step' => 1, |
| 5167 | ], |
| 5168 | ], |
| 5169 | 'selectors' => [ |
| 5170 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 5171 | ], |
| 5172 | 'condition' => [ |
| 5173 | 'show_btn_icon' => 'yes', |
| 5174 | ], |
| 5175 | ] |
| 5176 | ); |
| 5177 | |
| 5178 | $ref->add_responsive_control( |
| 5179 | 'readmore_icon_y_position', |
| 5180 | [ |
| 5181 | 'label' => esc_html__( 'Icon Vertical Position', 'the-post-grid' ), |
| 5182 | 'type' => Controls_Manager::SLIDER, |
| 5183 | 'size_units' => [ 'px' ], |
| 5184 | 'range' => [ |
| 5185 | 'px' => [ |
| 5186 | 'min' => - 20, |
| 5187 | 'max' => 20, |
| 5188 | 'step' => 1, |
| 5189 | ], |
| 5190 | ], |
| 5191 | 'selectors' => [ |
| 5192 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'transform: translateY( {{SIZE}}{{UNIT}} );', |
| 5193 | ], |
| 5194 | 'condition' => [ |
| 5195 | 'show_btn_icon' => 'yes', |
| 5196 | ], |
| 5197 | ] |
| 5198 | ); |
| 5199 | |
| 5200 | //TODO: Button style Tabs |
| 5201 | $ref->start_controls_tabs( |
| 5202 | 'readmore_style_tabs' |
| 5203 | ); |
| 5204 | |
| 5205 | $ref->start_controls_tab( |
| 5206 | 'readmore_style_normal_tab', |
| 5207 | [ |
| 5208 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 5209 | ] |
| 5210 | ); |
| 5211 | |
| 5212 | $ref->add_control( |
| 5213 | 'readmore_text_color', |
| 5214 | [ |
| 5215 | 'label' => esc_html__( 'Text Color', 'the-post-grid' ), |
| 5216 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5217 | 'selectors' => [ |
| 5218 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'color: {{VALUE}}', |
| 5219 | ], |
| 5220 | ] |
| 5221 | ); |
| 5222 | |
| 5223 | $ref->add_control( |
| 5224 | 'readmore_icon_color', |
| 5225 | [ |
| 5226 | 'label' => esc_html__( 'Icon Color', 'the-post-grid' ), |
| 5227 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5228 | 'selectors' => [ |
| 5229 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'color: {{VALUE}}', |
| 5230 | ], |
| 5231 | 'condition' => [ |
| 5232 | 'show_btn_icon' => 'yes', |
| 5233 | ], |
| 5234 | ] |
| 5235 | ); |
| 5236 | |
| 5237 | $ref->add_control( |
| 5238 | 'readmore_bg', |
| 5239 | [ |
| 5240 | 'label' => esc_html__( 'Background Color', 'the-post-grid' ), |
| 5241 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5242 | 'selectors' => [ |
| 5243 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'background-color: {{VALUE}}', |
| 5244 | ], |
| 5245 | 'condition' => [ |
| 5246 | 'readmore_btn_style' => 'default-style', |
| 5247 | ], |
| 5248 | ] |
| 5249 | ); |
| 5250 | |
| 5251 | $ref->add_responsive_control( |
| 5252 | 'readmore_icon_margin', |
| 5253 | [ |
| 5254 | 'label' => esc_html__( 'Icon Spacing', 'the-post-grid' ), |
| 5255 | 'type' => Controls_Manager::DIMENSIONS, |
| 5256 | 'size_units' => [ 'px' ], |
| 5257 | 'allowed_dimensions' => 'horizontal', |
| 5258 | 'default' => [ |
| 5259 | 'top' => '', |
| 5260 | 'right' => '', |
| 5261 | 'bottom' => '', |
| 5262 | 'left' => '', |
| 5263 | 'isLinked' => false, |
| 5264 | ], |
| 5265 | 'selectors' => [ |
| 5266 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5267 | ], |
| 5268 | 'condition' => [ |
| 5269 | 'show_btn_icon' => 'yes', |
| 5270 | ], |
| 5271 | ] |
| 5272 | ); |
| 5273 | |
| 5274 | $ref->add_responsive_control( |
| 5275 | 'border_radius', |
| 5276 | [ |
| 5277 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ), |
| 5278 | 'type' => Controls_Manager::DIMENSIONS, |
| 5279 | 'size_units' => [ 'px', '%', 'em' ], |
| 5280 | 'allowed_dimensions' => 'all', |
| 5281 | 'selectors' => [ |
| 5282 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5283 | ], |
| 5284 | 'condition' => [ |
| 5285 | 'readmore_btn_style' => 'default-style', |
| 5286 | ], |
| 5287 | ] |
| 5288 | ); |
| 5289 | |
| 5290 | $ref->add_group_control( |
| 5291 | \Elementor\Group_Control_Border::get_type(), |
| 5292 | [ |
| 5293 | 'name' => 'readmore_border', |
| 5294 | 'label' => esc_html__( 'Button Border', 'the-post-grid' ), |
| 5295 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a', |
| 5296 | 'fields_options' => [ |
| 5297 | 'border' => [ |
| 5298 | 'default' => 'solid', |
| 5299 | ], |
| 5300 | 'width' => [ |
| 5301 | 'default' => [ |
| 5302 | 'top' => '1', |
| 5303 | 'right' => '1', |
| 5304 | 'bottom' => '1', |
| 5305 | 'left' => '1', |
| 5306 | 'isLinked' => true, |
| 5307 | ], |
| 5308 | ], |
| 5309 | 'color' => [ |
| 5310 | 'default' => '#D4D4D4', |
| 5311 | ], |
| 5312 | ], |
| 5313 | 'condition' => [ |
| 5314 | 'readmore_btn_style' => 'default-style', |
| 5315 | ], |
| 5316 | ] |
| 5317 | ); |
| 5318 | |
| 5319 | $ref->end_controls_tab(); |
| 5320 | |
| 5321 | //TODO: Hover Tab |
| 5322 | |
| 5323 | $ref->start_controls_tab( |
| 5324 | 'readmore_style_hover_tab', |
| 5325 | [ |
| 5326 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 5327 | ] |
| 5328 | ); |
| 5329 | |
| 5330 | $ref->add_control( |
| 5331 | 'readmore_text_color_hover', |
| 5332 | [ |
| 5333 | 'label' => esc_html__( 'Text Color hover', 'the-post-grid' ), |
| 5334 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5335 | 'selectors' => [ |
| 5336 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'color: {{VALUE}}', |
| 5337 | ], |
| 5338 | ] |
| 5339 | ); |
| 5340 | |
| 5341 | $ref->add_control( |
| 5342 | 'readmore_icon_color_hover', |
| 5343 | [ |
| 5344 | 'label' => esc_html__( 'Icon Color Hover', 'the-post-grid' ), |
| 5345 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5346 | 'selectors' => [ |
| 5347 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover i' => 'color: {{VALUE}}', |
| 5348 | ], |
| 5349 | 'condition' => [ |
| 5350 | 'show_btn_icon' => 'yes', |
| 5351 | ], |
| 5352 | ] |
| 5353 | ); |
| 5354 | |
| 5355 | $ref->add_control( |
| 5356 | 'readmore_bg_hover', |
| 5357 | [ |
| 5358 | 'label' => esc_html__( 'Background Color hover', 'the-post-grid' ), |
| 5359 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5360 | 'selectors' => [ |
| 5361 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'background-color: {{VALUE}}', |
| 5362 | ], |
| 5363 | 'condition' => [ |
| 5364 | 'readmore_btn_style' => 'default-style', |
| 5365 | ], |
| 5366 | ] |
| 5367 | ); |
| 5368 | |
| 5369 | $ref->add_responsive_control( |
| 5370 | 'readmore_icon_margin_hover', |
| 5371 | [ |
| 5372 | 'label' => esc_html__( 'Icon Spacing - Hover', 'the-post-grid' ), |
| 5373 | 'type' => Controls_Manager::DIMENSIONS, |
| 5374 | 'size_units' => [ 'px' ], |
| 5375 | 'allowed_dimensions' => 'horizontal', |
| 5376 | 'default' => [ |
| 5377 | 'top' => '', |
| 5378 | 'right' => '', |
| 5379 | 'bottom' => '', |
| 5380 | 'left' => '', |
| 5381 | 'isLinked' => false, |
| 5382 | ], |
| 5383 | 'selectors' => [ |
| 5384 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5385 | ], |
| 5386 | 'condition' => [ |
| 5387 | 'show_btn_icon' => 'yes', |
| 5388 | ], |
| 5389 | ] |
| 5390 | ); |
| 5391 | |
| 5392 | $ref->add_responsive_control( |
| 5393 | 'border_radius_hover', |
| 5394 | [ |
| 5395 | 'label' => esc_html__( 'Border Radius - Hover', 'the-post-grid' ), |
| 5396 | 'type' => Controls_Manager::DIMENSIONS, |
| 5397 | 'size_units' => [ 'px', '%', 'em' ], |
| 5398 | 'allowed_dimensions' => 'all', |
| 5399 | 'selectors' => [ |
| 5400 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5401 | ], |
| 5402 | 'condition' => [ |
| 5403 | 'readmore_btn_style' => 'default-style', |
| 5404 | ], |
| 5405 | ] |
| 5406 | ); |
| 5407 | |
| 5408 | $ref->add_group_control( |
| 5409 | \Elementor\Group_Control_Border::get_type(), |
| 5410 | [ |
| 5411 | 'name' => 'readmore_border_hover', |
| 5412 | 'label' => esc_html__( 'Button Border - Hover', 'the-post-grid' ), |
| 5413 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover', |
| 5414 | 'fields_options' => [ |
| 5415 | 'border' => [ |
| 5416 | 'default' => 'solid', |
| 5417 | ], |
| 5418 | 'width' => [ |
| 5419 | 'default' => [ |
| 5420 | 'top' => '1', |
| 5421 | 'right' => '1', |
| 5422 | 'bottom' => '1', |
| 5423 | 'left' => '1', |
| 5424 | 'isLinked' => true, |
| 5425 | ], |
| 5426 | ], |
| 5427 | 'color' => [ |
| 5428 | 'default' => '#7a64f2', |
| 5429 | ], |
| 5430 | ], |
| 5431 | 'condition' => [ |
| 5432 | 'readmore_btn_style' => 'default-style', |
| 5433 | ], |
| 5434 | ] |
| 5435 | ); |
| 5436 | |
| 5437 | $ref->end_controls_tab(); |
| 5438 | |
| 5439 | |
| 5440 | //TODO: Box Hover Tab |
| 5441 | |
| 5442 | $ref->start_controls_tab( |
| 5443 | 'readmore_style_box_hover_tab', |
| 5444 | [ |
| 5445 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 5446 | ] |
| 5447 | ); |
| 5448 | |
| 5449 | $ref->add_control( |
| 5450 | 'readmore_text_color_box_hover', |
| 5451 | [ |
| 5452 | 'label' => esc_html__( 'Text Color - BoxHover', 'the-post-grid' ), |
| 5453 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5454 | 'selectors' => [ |
| 5455 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'color: {{VALUE}}', |
| 5456 | ], |
| 5457 | ] |
| 5458 | ); |
| 5459 | |
| 5460 | $ref->add_control( |
| 5461 | 'readmore_icon_color_box_hover', |
| 5462 | [ |
| 5463 | 'label' => esc_html__( 'Icon Color - BoxHover', 'the-post-grid' ), |
| 5464 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5465 | 'selectors' => [ |
| 5466 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a i' => 'color: {{VALUE}}', |
| 5467 | ], |
| 5468 | 'condition' => [ |
| 5469 | 'show_btn_icon' => 'yes', |
| 5470 | ], |
| 5471 | ] |
| 5472 | ); |
| 5473 | |
| 5474 | $ref->add_control( |
| 5475 | 'readmore_bg_box_hover', |
| 5476 | [ |
| 5477 | 'label' => esc_html__( 'Background Color - BoxHover', 'the-post-grid' ), |
| 5478 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5479 | 'selectors' => [ |
| 5480 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'background-color: {{VALUE}}', |
| 5481 | ], |
| 5482 | 'condition' => [ |
| 5483 | 'readmore_btn_style' => 'default-style', |
| 5484 | ], |
| 5485 | ] |
| 5486 | ); |
| 5487 | |
| 5488 | $ref->add_group_control( |
| 5489 | \Elementor\Group_Control_Border::get_type(), |
| 5490 | [ |
| 5491 | 'name' => 'readmore_border_box_hover', |
| 5492 | 'label' => esc_html__( 'Button Border - Box Hover', 'the-post-grid' ), |
| 5493 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a', |
| 5494 | 'condition' => [ |
| 5495 | 'readmore_btn_style' => 'default-style', |
| 5496 | ], |
| 5497 | ] |
| 5498 | ); |
| 5499 | |
| 5500 | |
| 5501 | $ref->end_controls_tab(); |
| 5502 | |
| 5503 | $ref->end_controls_tabs(); |
| 5504 | |
| 5505 | $ref->end_controls_section(); |
| 5506 | } |
| 5507 | |
| 5508 | |
| 5509 | /** |
| 5510 | * Pagination and Load more style tab |
| 5511 | * |
| 5512 | * @param $ref |
| 5513 | */ |
| 5514 | public static function paginationStyle( $ref ) { |
| 5515 | $ref->start_controls_section( |
| 5516 | 'pagination_loadmore_style', |
| 5517 | [ |
| 5518 | 'label' => esc_html__( 'Pagination / Load More', 'the-post-grid' ), |
| 5519 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 5520 | 'condition' => [ |
| 5521 | 'show_pagination' => 'show', |
| 5522 | ], |
| 5523 | ] |
| 5524 | ); |
| 5525 | |
| 5526 | $ref->add_group_control( |
| 5527 | \Elementor\Group_Control_Typography::get_type(), |
| 5528 | [ |
| 5529 | 'name' => 'pagination_typography', |
| 5530 | 'selector' => '{{WRAPPER}} .rt-pagination .pagination-list > li > a, {{WRAPPER}} .rt-pagination .pagination-list > li > span', |
| 5531 | |
| 5532 | ] |
| 5533 | ); |
| 5534 | |
| 5535 | $ref->add_responsive_control( |
| 5536 | 'pagination_text_align', |
| 5537 | [ |
| 5538 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 5539 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5540 | 'options' => [ |
| 5541 | 'flex-start' => [ |
| 5542 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 5543 | 'icon' => 'eicon-text-align-left', |
| 5544 | ], |
| 5545 | 'center' => [ |
| 5546 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 5547 | 'icon' => 'eicon-text-align-center', |
| 5548 | ], |
| 5549 | 'flex-end' => [ |
| 5550 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 5551 | 'icon' => 'eicon-text-align-right', |
| 5552 | ], |
| 5553 | ], |
| 5554 | 'selectors' => [ |
| 5555 | '{{WRAPPER}} .rt-pagination-wrap' => 'justify-content: {{VALUE}};', |
| 5556 | ], |
| 5557 | 'default' => 'center', |
| 5558 | 'toggle' => true, |
| 5559 | ] |
| 5560 | ); |
| 5561 | |
| 5562 | $ref->add_responsive_control( |
| 5563 | 'pagination_spacing', |
| 5564 | [ |
| 5565 | 'label' => esc_html__( 'Button Vertical Spacing', 'the-post-grid' ), |
| 5566 | 'type' => Controls_Manager::DIMENSIONS, |
| 5567 | 'size_units' => [ 'px' ], |
| 5568 | 'allowed_dimensions' => 'vertical', |
| 5569 | 'default' => [ |
| 5570 | 'top' => '', |
| 5571 | 'right' => '', |
| 5572 | 'bottom' => '', |
| 5573 | 'left' => '', |
| 5574 | 'isLinked' => false, |
| 5575 | ], |
| 5576 | 'selectors' => [ |
| 5577 | '{{WRAPPER}} .rt-pagination-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5578 | ], |
| 5579 | 'condition' => [ |
| 5580 | 'pagination_type!' => 'load_on_scroll', |
| 5581 | ], |
| 5582 | ] |
| 5583 | ); |
| 5584 | |
| 5585 | $ref->add_responsive_control( |
| 5586 | 'pagination_padding', |
| 5587 | [ |
| 5588 | 'label' => esc_html__( 'Button Padding', 'the-post-grid' ), |
| 5589 | 'type' => Controls_Manager::DIMENSIONS, |
| 5590 | 'size_units' => [ 'px' ], |
| 5591 | 'allowed_dimensions' => 'all', |
| 5592 | 'selectors' => [ |
| 5593 | '{{WRAPPER}} .rt-pagination .pagination-list > li > a, {{WRAPPER}} .rt-pagination .pagination-list > li > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5594 | ], |
| 5595 | 'condition' => [ |
| 5596 | 'pagination_type!' => 'load_on_scroll', |
| 5597 | ], |
| 5598 | ] |
| 5599 | ); |
| 5600 | |
| 5601 | $ref->add_responsive_control( |
| 5602 | 'pagination_border_radius', |
| 5603 | [ |
| 5604 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ), |
| 5605 | 'type' => Controls_Manager::SLIDER, |
| 5606 | 'size_units' => [ 'px', '%' ], |
| 5607 | 'range' => [ |
| 5608 | 'px' => [ |
| 5609 | 'min' => 0, |
| 5610 | 'max' => 100, |
| 5611 | 'step' => 1, |
| 5612 | ], |
| 5613 | '%' => [ |
| 5614 | 'min' => 0, |
| 5615 | 'max' => 100, |
| 5616 | ], |
| 5617 | ], |
| 5618 | 'selectors' => [ |
| 5619 | '{{WRAPPER}} .rt-pagination .pagination-list > li:first-child > a, {{WRAPPER}} .rt-pagination .pagination-list > li:first-child > span' => 'border-bottom-left-radius: {{SIZE}}{{UNIT}}; border-top-left-radius: {{SIZE}}{{UNIT}};', |
| 5620 | '{{WRAPPER}} .rt-pagination .pagination-list > li:last-child > a, {{WRAPPER}} .rt-pagination .pagination-list > li:last-child > span' => 'border-bottom-right-radius: {{SIZE}}{{UNIT}}; border-top-right-radius: {{SIZE}}{{UNIT}};', |
| 5621 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 5622 | ], |
| 5623 | 'condition' => [ |
| 5624 | 'pagination_type!' => 'load_on_scroll', |
| 5625 | ], |
| 5626 | ] |
| 5627 | ); |
| 5628 | |
| 5629 | //Button style Tabs |
| 5630 | $ref->start_controls_tabs( |
| 5631 | 'pagination_style_tabs', |
| 5632 | [ |
| 5633 | 'condition' => [ |
| 5634 | 'pagination_type!' => 'load_on_scroll', |
| 5635 | ], |
| 5636 | ] |
| 5637 | ); |
| 5638 | |
| 5639 | |
| 5640 | //TODO: Normal Tab |
| 5641 | $ref->start_controls_tab( |
| 5642 | 'pagination_style_normal_tab', |
| 5643 | [ |
| 5644 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 5645 | ] |
| 5646 | ); |
| 5647 | |
| 5648 | $ref->add_control( |
| 5649 | 'pagination_color', |
| 5650 | [ |
| 5651 | 'label' => esc_html__( 'Color', 'the-post-grid' ), |
| 5652 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5653 | 'selectors' => [ |
| 5654 | '{{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > a, {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'color: {{VALUE}}', |
| 5655 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'color: {{VALUE}}', |
| 5656 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover)' => 'color: {{VALUE}}', |
| 5657 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'color: {{VALUE}}', |
| 5658 | ], |
| 5659 | ] |
| 5660 | ); |
| 5661 | |
| 5662 | $ref->add_control( |
| 5663 | 'pagination_bg', |
| 5664 | [ |
| 5665 | 'label' => esc_html__( 'Background Color', 'the-post-grid' ), |
| 5666 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5667 | 'selectors' => [ |
| 5668 | '{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'background-color: {{VALUE}}', |
| 5669 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'background-color: {{VALUE}}', |
| 5670 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'background-color: {{VALUE}}', |
| 5671 | ], |
| 5672 | |
| 5673 | ] |
| 5674 | ); |
| 5675 | |
| 5676 | $ref->add_control( |
| 5677 | 'pagination_border_color', |
| 5678 | [ |
| 5679 | 'label' => esc_html__( 'Border Color', 'the-post-grid' ), |
| 5680 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5681 | 'selectors' => [ |
| 5682 | '{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'border-color: {{VALUE}}', |
| 5683 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'border-color: {{VALUE}}', |
| 5684 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'border-color: {{VALUE}}', |
| 5685 | ], |
| 5686 | ] |
| 5687 | ); |
| 5688 | |
| 5689 | $ref->end_controls_tab(); |
| 5690 | |
| 5691 | //TODO: Hover Tab |
| 5692 | $ref->start_controls_tab( |
| 5693 | 'pagination_style_hover_tab', |
| 5694 | [ |
| 5695 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 5696 | ] |
| 5697 | ); |
| 5698 | |
| 5699 | $ref->add_control( |
| 5700 | 'pagination_color_hover', |
| 5701 | [ |
| 5702 | 'label' => esc_html__( 'Color - hover', 'the-post-grid' ), |
| 5703 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5704 | 'selectors' => [ |
| 5705 | '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'color: {{VALUE}} !important', |
| 5706 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'color: {{VALUE}} !important', |
| 5707 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'color: {{VALUE}} !important', |
| 5708 | ], |
| 5709 | ] |
| 5710 | ); |
| 5711 | |
| 5712 | $ref->add_control( |
| 5713 | 'pagination_bg_hover', |
| 5714 | [ |
| 5715 | 'label' => esc_html__( 'Background Color - Hover', 'the-post-grid' ), |
| 5716 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5717 | 'selectors' => [ |
| 5718 | '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'background-color: {{VALUE}} !important', |
| 5719 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'background-color: {{VALUE}} !important', |
| 5720 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'background-color: {{VALUE}} !important', |
| 5721 | ], |
| 5722 | ] |
| 5723 | ); |
| 5724 | |
| 5725 | $ref->add_control( |
| 5726 | 'pagination_border_color_hover', |
| 5727 | [ |
| 5728 | 'label' => esc_html__( 'Border Color - Hover', 'the-post-grid' ), |
| 5729 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5730 | 'selectors' => [ |
| 5731 | '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'border-color: {{VALUE}} !important', |
| 5732 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'border-color: {{VALUE}} !important', |
| 5733 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'border-color: {{VALUE}} !important', |
| 5734 | ], |
| 5735 | ] |
| 5736 | ); |
| 5737 | |
| 5738 | $ref->end_controls_tab(); |
| 5739 | |
| 5740 | |
| 5741 | //TODO: Active Tab |
| 5742 | $ref->start_controls_tab( |
| 5743 | 'pagination_style_active_tab', |
| 5744 | [ |
| 5745 | 'label' => esc_html__( 'Active', 'the-post-grid' ), |
| 5746 | ] |
| 5747 | ); |
| 5748 | |
| 5749 | $ref->add_control( |
| 5750 | 'pagination_color_active', |
| 5751 | [ |
| 5752 | 'label' => esc_html__( 'Color - Active', 'the-post-grid' ), |
| 5753 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5754 | 'selectors' => [ |
| 5755 | '{{WRAPPER}} .rt-pagination .pagination-list > .active > a, |
| 5756 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span, |
| 5757 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover, |
| 5758 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover, |
| 5759 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus, |
| 5760 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'color: {{VALUE}} !important', |
| 5761 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'color: {{VALUE}}', |
| 5762 | ], |
| 5763 | ] |
| 5764 | ); |
| 5765 | |
| 5766 | |
| 5767 | $ref->add_control( |
| 5768 | 'pagination_bg_active', |
| 5769 | [ |
| 5770 | 'label' => esc_html__( 'Background Color - Active', 'the-post-grid' ), |
| 5771 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5772 | 'selectors' => [ |
| 5773 | '{{WRAPPER}} .rt-pagination .pagination-list > .active > a, |
| 5774 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span, |
| 5775 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover, |
| 5776 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover, |
| 5777 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus, |
| 5778 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'background-color: {{VALUE}} !important', |
| 5779 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'background-color: {{VALUE}}', |
| 5780 | ], |
| 5781 | ] |
| 5782 | ); |
| 5783 | |
| 5784 | $ref->add_control( |
| 5785 | 'pagination_border_color_active', |
| 5786 | [ |
| 5787 | 'label' => esc_html__( 'Border Color - Active', 'the-post-grid' ), |
| 5788 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5789 | 'selectors' => [ |
| 5790 | '{{WRAPPER}} .rt-pagination .pagination-list > .active > a, |
| 5791 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span, |
| 5792 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover, |
| 5793 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover, |
| 5794 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus, |
| 5795 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'border-color: {{VALUE}} !important', |
| 5796 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'border-color: {{VALUE}}', |
| 5797 | ], |
| 5798 | ] |
| 5799 | ); |
| 5800 | |
| 5801 | $ref->end_controls_tab(); |
| 5802 | |
| 5803 | $ref->end_controls_tabs(); |
| 5804 | |
| 5805 | $ref->end_controls_section(); |
| 5806 | } |
| 5807 | |
| 5808 | |
| 5809 | /** |
| 5810 | * Front-end Filter style / frontend style |
| 5811 | * |
| 5812 | * @param $ref |
| 5813 | */ |
| 5814 | public static function frontEndFilter( $ref ) { |
| 5815 | if ( ! rtTPG()->hasPro() ) { |
| 5816 | return; |
| 5817 | } |
| 5818 | $ref->start_controls_section( |
| 5819 | 'front_end_filter_style', |
| 5820 | [ |
| 5821 | 'label' => esc_html__( 'Front-End Filter', 'the-post-grid' ), |
| 5822 | 'tab' => Controls_Manager::TAB_STYLE, |
| 5823 | 'conditions' => [ |
| 5824 | 'relation' => 'or', |
| 5825 | 'terms' => [ |
| 5826 | [ |
| 5827 | 'name' => 'show_taxonomy_filter', |
| 5828 | 'operator' => '==', |
| 5829 | 'value' => 'show', |
| 5830 | ], |
| 5831 | [ |
| 5832 | 'name' => 'show_author_filter', |
| 5833 | 'operator' => '==', |
| 5834 | 'value' => 'show', |
| 5835 | ], |
| 5836 | [ |
| 5837 | 'name' => 'show_order_by', |
| 5838 | 'operator' => '==', |
| 5839 | 'value' => 'show', |
| 5840 | ], |
| 5841 | [ |
| 5842 | 'name' => 'show_sort_order', |
| 5843 | 'operator' => '==', |
| 5844 | 'value' => 'show', |
| 5845 | ], |
| 5846 | [ |
| 5847 | 'name' => 'show_search', |
| 5848 | 'operator' => '==', |
| 5849 | 'value' => 'show', |
| 5850 | ], |
| 5851 | ], |
| 5852 | ], |
| 5853 | ] |
| 5854 | ); |
| 5855 | |
| 5856 | $ref->add_group_control( |
| 5857 | \Elementor\Group_Control_Typography::get_type(), |
| 5858 | [ |
| 5859 | 'name' => 'front_filter_typography', |
| 5860 | 'label' => esc_html__( 'Filter Typography', 'the-post-grid' ), |
| 5861 | 'selector' => '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap, {{WRAPPER}} .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide', |
| 5862 | ] |
| 5863 | ); |
| 5864 | |
| 5865 | $ref->add_responsive_control( |
| 5866 | 'filter_text_alignment', |
| 5867 | [ |
| 5868 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 5869 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5870 | 'options' => [ |
| 5871 | 'left' => [ |
| 5872 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 5873 | 'icon' => 'eicon-text-align-left', |
| 5874 | ], |
| 5875 | 'center' => [ |
| 5876 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 5877 | 'icon' => 'eicon-text-align-center', |
| 5878 | ], |
| 5879 | 'right' => [ |
| 5880 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 5881 | 'icon' => 'eicon-text-align-right', |
| 5882 | ], |
| 5883 | ], |
| 5884 | 'condition' => [ |
| 5885 | 'filter_type' => 'button', |
| 5886 | 'filter_btn_style' => 'default', |
| 5887 | ], |
| 5888 | 'toggle' => true, |
| 5889 | 'selectors' => [ |
| 5890 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-layout-filter-container .rt-filter-wrap' => 'text-align: {{VALUE}};justify-content:{{VALUE}}', |
| 5891 | ], |
| 5892 | ] |
| 5893 | ); |
| 5894 | |
| 5895 | $ref->add_control( |
| 5896 | 'filter_v_alignment', |
| 5897 | [ |
| 5898 | 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ), |
| 5899 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5900 | 'options' => [ |
| 5901 | 'left' => [ |
| 5902 | 'title' => esc_html__( 'Top', 'the-post-grid' ), |
| 5903 | 'icon' => 'eicon-v-align-top', |
| 5904 | ], |
| 5905 | 'center' => [ |
| 5906 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 5907 | 'icon' => 'eicon-v-align-middle', |
| 5908 | ], |
| 5909 | 'right' => [ |
| 5910 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 5911 | 'icon' => 'eicon-v-align-bottom', |
| 5912 | ], |
| 5913 | ], |
| 5914 | 'condition' => [ |
| 5915 | 'filter_type' => 'button', |
| 5916 | 'filter_btn_style' => 'default', |
| 5917 | ], |
| 5918 | 'prefix_class' => 'tpg-filter-alignment-', |
| 5919 | 'toggle' => true, |
| 5920 | ] |
| 5921 | ); |
| 5922 | |
| 5923 | $ref->add_responsive_control( |
| 5924 | 'filter_button_width', |
| 5925 | [ |
| 5926 | 'label' => esc_html__( 'Filter Width', 'the-post-grid' ), |
| 5927 | 'type' => Controls_Manager::SLIDER, |
| 5928 | 'size_units' => [ 'px', '%' ], |
| 5929 | 'range' => [ |
| 5930 | 'px' => [ |
| 5931 | 'min' => 0, |
| 5932 | 'max' => 1000, |
| 5933 | 'step' => 5, |
| 5934 | ], |
| 5935 | '%' => [ |
| 5936 | 'min' => 0, |
| 5937 | 'max' => 100, |
| 5938 | ], |
| 5939 | ], |
| 5940 | 'selectors' => [ |
| 5941 | '{{WRAPPER}} .tpg-header-wrapper.carousel .rt-layout-filter-container' => 'flex: 0 0 {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};', |
| 5942 | ], |
| 5943 | 'condition' => [ |
| 5944 | 'filter_type' => 'button', |
| 5945 | 'filter_btn_style' => 'carousel', |
| 5946 | ], |
| 5947 | ] |
| 5948 | ); |
| 5949 | |
| 5950 | |
| 5951 | $ref->add_control( |
| 5952 | 'border_style', |
| 5953 | [ |
| 5954 | 'label' => esc_html__( 'Filter Border', 'the-post-grid' ), |
| 5955 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 5956 | 'default' => 'disable', |
| 5957 | 'options' => [ |
| 5958 | 'disable' => esc_html__( 'Disable', 'the-post-grid' ), |
| 5959 | 'enable' => esc_html__( 'Enable', 'the-post-grid' ), |
| 5960 | ], |
| 5961 | 'condition' => [ |
| 5962 | 'filter_type' => 'button', |
| 5963 | 'filter_btn_style' => 'carousel', |
| 5964 | 'section_title_style!' => [ 'style2', 'style3' ], |
| 5965 | ], |
| 5966 | 'prefix_class' => 'filter-button-border-', |
| 5967 | ] |
| 5968 | ); |
| 5969 | |
| 5970 | $ref->add_control( |
| 5971 | 'filter_next_prev_btn', |
| 5972 | [ |
| 5973 | 'label' => esc_html__( 'Next/Prev Button', 'the-post-grid' ), |
| 5974 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 5975 | 'default' => 'visible', |
| 5976 | 'options' => [ |
| 5977 | 'visible' => esc_html__( 'Visible', 'the-post-grid' ), |
| 5978 | 'hidden' => esc_html__( 'Hidden', 'the-post-grid' ), |
| 5979 | ], |
| 5980 | 'condition' => [ |
| 5981 | 'filter_type' => 'button', |
| 5982 | 'filter_btn_style' => 'carousel', |
| 5983 | ], |
| 5984 | 'prefix_class' => 'filter-nex-prev-btn-', |
| 5985 | ] |
| 5986 | ); |
| 5987 | |
| 5988 | $ref->add_control( |
| 5989 | 'filter_h_alignment', |
| 5990 | [ |
| 5991 | 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ), |
| 5992 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5993 | 'options' => [ |
| 5994 | 'left' => [ |
| 5995 | 'title' => esc_html__( 'Top', 'the-post-grid' ), |
| 5996 | 'icon' => 'eicon-justify-start-h', |
| 5997 | ], |
| 5998 | 'center' => [ |
| 5999 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 6000 | 'icon' => 'eicon-justify-center-h', |
| 6001 | ], |
| 6002 | 'right' => [ |
| 6003 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 6004 | 'icon' => 'eicon-justify-end-h', |
| 6005 | ], |
| 6006 | 'space-between' => [ |
| 6007 | 'title' => esc_html__( 'Space Between', 'the-post-grid' ), |
| 6008 | 'icon' => 'eicon-justify-space-between-h', |
| 6009 | ], |
| 6010 | ], |
| 6011 | 'condition' => [ |
| 6012 | 'filter_type!' => 'button', |
| 6013 | ], |
| 6014 | 'prefix_class' => 'tpg-filter-h-alignment-', |
| 6015 | 'toggle' => true, |
| 6016 | ] |
| 6017 | ); |
| 6018 | |
| 6019 | $ref->add_responsive_control( |
| 6020 | 'filter_btn_radius', |
| 6021 | [ |
| 6022 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ), |
| 6023 | 'type' => Controls_Manager::DIMENSIONS, |
| 6024 | 'size_units' => [ 'px' ], |
| 6025 | 'selectors' => [ |
| 6026 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6027 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6028 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6029 | ], |
| 6030 | 'condition' => [ |
| 6031 | 'filter_btn_style' => 'default', |
| 6032 | ], |
| 6033 | ] |
| 6034 | ); |
| 6035 | |
| 6036 | $ref->add_responsive_control( |
| 6037 | 'filter_btn_spacing', |
| 6038 | [ |
| 6039 | 'label' => esc_html__( 'Filter wrapper Spacing', 'the-post-grid' ), |
| 6040 | 'type' => Controls_Manager::DIMENSIONS, |
| 6041 | 'size_units' => [ 'px' ], |
| 6042 | 'selectors' => [ |
| 6043 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap ' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6044 | ], |
| 6045 | 'condition' => [ |
| 6046 | 'filter_btn_style' => 'default', |
| 6047 | ], |
| 6048 | ] |
| 6049 | ); |
| 6050 | |
| 6051 | |
| 6052 | //TODO: Start Tab |
| 6053 | $ref->start_controls_tabs( |
| 6054 | 'frontend_filter_style_tabs' |
| 6055 | ); |
| 6056 | |
| 6057 | $ref->start_controls_tab( |
| 6058 | 'frontend_filter_style_normal_tab', |
| 6059 | [ |
| 6060 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 6061 | ] |
| 6062 | ); |
| 6063 | |
| 6064 | $ref->add_control( |
| 6065 | 'filter_color', |
| 6066 | [ |
| 6067 | 'label' => esc_html__( 'Filter Color', 'the-post-grid' ), |
| 6068 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6069 | 'selectors' => [ |
| 6070 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'color: {{VALUE}}', |
| 6071 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'color: {{VALUE}}', |
| 6072 | '{{WRAPPER}} .rt-filter-item-wrap.rt-sort-order-action .rt-sort-order-action-arrow > span:before, {{WRAPPER}} .rt-filter-item-wrap.rt-sort-order-action .rt-sort-order-action-arrow > span:after' => 'background-color: {{VALUE}}', |
| 6073 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'color: {{VALUE}}', |
| 6074 | ], |
| 6075 | ] |
| 6076 | ); |
| 6077 | |
| 6078 | $ref->add_control( |
| 6079 | 'filter_bg_color', |
| 6080 | [ |
| 6081 | 'label' => esc_html__( 'Filter Background Color', 'the-post-grid' ), |
| 6082 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6083 | 'selectors' => [ |
| 6084 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'background-color: {{VALUE}}', |
| 6085 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'background-color: {{VALUE}}', |
| 6086 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action' => 'background-color: {{VALUE}}', |
| 6087 | ], |
| 6088 | ] |
| 6089 | ); |
| 6090 | |
| 6091 | $ref->add_control( |
| 6092 | 'filter_border_color', |
| 6093 | [ |
| 6094 | 'label' => esc_html__( 'Filter Border Color', 'the-post-grid' ), |
| 6095 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6096 | 'selectors' => [ |
| 6097 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'border-color: {{VALUE}}', |
| 6098 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'border-color: {{VALUE}}', |
| 6099 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action' => 'border-color: {{VALUE}}', |
| 6100 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'border-color: {{VALUE}}', |
| 6101 | '{{WRAPPER}}.filter-button-border-enable .tpg-header-wrapper.carousel .rt-layout-filter-container' => 'border-color: {{VALUE}}', |
| 6102 | ], |
| 6103 | ] |
| 6104 | ); |
| 6105 | |
| 6106 | $ref->add_control( |
| 6107 | 'filter_search_bg', |
| 6108 | [ |
| 6109 | 'label' => esc_html__( 'Search Background', 'the-post-grid' ), |
| 6110 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6111 | 'selectors' => [ |
| 6112 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'background-color: {{VALUE}}', |
| 6113 | ], |
| 6114 | 'condition' => [ |
| 6115 | 'show_search' => 'show', |
| 6116 | 'filter_btn_style' => 'default', |
| 6117 | ], |
| 6118 | ] |
| 6119 | ); |
| 6120 | |
| 6121 | $ref->add_control( |
| 6122 | 'sub_menu_color_heading', |
| 6123 | [ |
| 6124 | 'label' => esc_html__( 'Sub Menu Options', 'the-post-grid' ), |
| 6125 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 6126 | 'separator' => 'before', |
| 6127 | 'classes' => 'tpg-control-type-heading', |
| 6128 | 'condition' => [ |
| 6129 | 'filter_type' => 'dropdown', |
| 6130 | ], |
| 6131 | ] |
| 6132 | ); |
| 6133 | |
| 6134 | $ref->add_control( |
| 6135 | 'sub_menu_bg_color', |
| 6136 | [ |
| 6137 | 'label' => esc_html__( 'Submenu Background', 'the-post-grid' ), |
| 6138 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6139 | 'selectors' => [ |
| 6140 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown' => 'background-color: {{VALUE}}', |
| 6141 | ], |
| 6142 | 'condition' => [ |
| 6143 | 'filter_type' => 'dropdown', |
| 6144 | ], |
| 6145 | ] |
| 6146 | ); |
| 6147 | |
| 6148 | $ref->add_control( |
| 6149 | 'sub_menu_color', |
| 6150 | [ |
| 6151 | 'label' => esc_html__( 'Submenu Color', 'the-post-grid' ), |
| 6152 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6153 | 'selectors' => [ |
| 6154 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'color: {{VALUE}}', |
| 6155 | ], |
| 6156 | 'condition' => [ |
| 6157 | 'filter_type' => 'dropdown', |
| 6158 | ], |
| 6159 | ] |
| 6160 | ); |
| 6161 | |
| 6162 | $ref->add_control( |
| 6163 | 'sub_menu_border_bottom', |
| 6164 | [ |
| 6165 | 'label' => esc_html__( 'Submenu Border', 'the-post-grid' ), |
| 6166 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6167 | 'selectors' => [ |
| 6168 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'border-bottom-color: {{VALUE}}', |
| 6169 | ], |
| 6170 | 'condition' => [ |
| 6171 | 'filter_type' => 'dropdown', |
| 6172 | ], |
| 6173 | ] |
| 6174 | ); |
| 6175 | |
| 6176 | $ref->add_control( |
| 6177 | 'filter_nav_color', |
| 6178 | [ |
| 6179 | 'label' => esc_html__( 'Filter Nav Color', 'the-post-grid' ), |
| 6180 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6181 | 'selectors' => [ |
| 6182 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'color: {{VALUE}}', |
| 6183 | ], |
| 6184 | 'condition' => [ |
| 6185 | 'filter_btn_style' => 'carousel', |
| 6186 | 'filter_next_prev_btn' => 'visible', |
| 6187 | ], |
| 6188 | ] |
| 6189 | ); |
| 6190 | |
| 6191 | $ref->add_control( |
| 6192 | 'filter_nav_bg', |
| 6193 | [ |
| 6194 | 'label' => esc_html__( 'Filter Nav Background', 'the-post-grid' ), |
| 6195 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6196 | 'selectors' => [ |
| 6197 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'background-color: {{VALUE}}', |
| 6198 | ], |
| 6199 | 'condition' => [ |
| 6200 | 'filter_btn_style' => 'carousel', |
| 6201 | 'filter_next_prev_btn' => 'visible', |
| 6202 | ], |
| 6203 | ] |
| 6204 | ); |
| 6205 | |
| 6206 | $ref->add_control( |
| 6207 | 'filter_nav_border', |
| 6208 | [ |
| 6209 | 'label' => esc_html__( 'Filter Nav Border', 'the-post-grid' ), |
| 6210 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6211 | 'selectors' => [ |
| 6212 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'border-color: {{VALUE}}', |
| 6213 | ], |
| 6214 | 'condition' => [ |
| 6215 | 'filter_btn_style' => 'carousel', |
| 6216 | 'filter_next_prev_btn' => 'visible', |
| 6217 | ], |
| 6218 | ] |
| 6219 | ); |
| 6220 | |
| 6221 | $ref->end_controls_tab(); |
| 6222 | |
| 6223 | //TODO: Start Tab Hover |
| 6224 | $ref->start_controls_tab( |
| 6225 | 'frontend_filter_style_hover_tab', |
| 6226 | [ |
| 6227 | 'label' => esc_html__( 'Hover / Active', 'the-post-grid' ), |
| 6228 | ] |
| 6229 | ); |
| 6230 | |
| 6231 | $ref->add_control( |
| 6232 | 'filter_color_hover', |
| 6233 | [ |
| 6234 | 'label' => esc_html__( 'Filter Color - Hover', 'the-post-grid' ), |
| 6235 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6236 | 'selectors' => [ |
| 6237 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'color: {{VALUE}}', |
| 6238 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'color: {{VALUE}}', |
| 6239 | '{{WRAPPER}} .rt-filter-item-wrap.rt-sort-order-action:hover .rt-sort-order-action-arrow > span:before, {{WRAPPER}} .rt-filter-item-wrap.rt-sort-order-action:hover .rt-sort-order-action-arrow > span:after' => 'background-color: {{VALUE}}', |
| 6240 | ], |
| 6241 | ] |
| 6242 | ); |
| 6243 | |
| 6244 | $ref->add_control( |
| 6245 | 'filter_bg_color_hover', |
| 6246 | [ |
| 6247 | 'label' => esc_html__( 'Filter Background Color - Hover', 'the-post-grid' ), |
| 6248 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6249 | 'selectors' => [ |
| 6250 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'background-color: {{VALUE}}', |
| 6251 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'background-color: {{VALUE}}', |
| 6252 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action:hover' => 'background-color: {{VALUE}}', |
| 6253 | ], |
| 6254 | ] |
| 6255 | ); |
| 6256 | |
| 6257 | $ref->add_control( |
| 6258 | 'filter_border_color_hover', |
| 6259 | [ |
| 6260 | 'label' => esc_html__( 'Filter Border Color - Hover', 'the-post-grid' ), |
| 6261 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6262 | 'selectors' => [ |
| 6263 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'border-color: {{VALUE}}', |
| 6264 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'border-color: {{VALUE}}', |
| 6265 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action:hover' => 'border-color: {{VALUE}}', |
| 6266 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input:hover' => 'border-color: {{VALUE}}', |
| 6267 | '{{WRAPPER}}.filter-button-border-enable .tpg-header-wrapper.carousel .rt-layout-filter-container:hover' => 'border-color: {{VALUE}}', |
| 6268 | ], |
| 6269 | ] |
| 6270 | ); |
| 6271 | |
| 6272 | $ref->add_control( |
| 6273 | 'filter_search_bg_hover', |
| 6274 | [ |
| 6275 | 'label' => esc_html__( 'Search Background - Hover', 'the-post-grid' ), |
| 6276 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6277 | 'selectors' => [ |
| 6278 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input:hover' => 'background-color: {{VALUE}}', |
| 6279 | ], |
| 6280 | 'condition' => [ |
| 6281 | 'show_search' => 'show', |
| 6282 | 'filter_btn_style' => 'default', |
| 6283 | ], |
| 6284 | ] |
| 6285 | ); |
| 6286 | |
| 6287 | $ref->add_control( |
| 6288 | 'sub_menu_color_heading_hover', |
| 6289 | [ |
| 6290 | 'label' => esc_html__( 'Sub Menu Options - Hover', 'the-post-grid' ), |
| 6291 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 6292 | 'separator' => 'before', |
| 6293 | 'classes' => 'tpg-control-type-heading', |
| 6294 | 'condition' => [ |
| 6295 | 'filter_type' => 'dropdown', |
| 6296 | ], |
| 6297 | ] |
| 6298 | ); |
| 6299 | |
| 6300 | $ref->add_control( |
| 6301 | 'sub_menu_bg_color_hover', |
| 6302 | [ |
| 6303 | 'label' => esc_html__( 'Submenu Background - Hover', 'the-post-grid' ), |
| 6304 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6305 | 'selectors' => [ |
| 6306 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'background-color: {{VALUE}}', |
| 6307 | ], |
| 6308 | 'condition' => [ |
| 6309 | 'filter_type' => 'dropdown', |
| 6310 | ], |
| 6311 | ] |
| 6312 | ); |
| 6313 | |
| 6314 | $ref->add_control( |
| 6315 | 'sub_menu_color_hover', |
| 6316 | [ |
| 6317 | 'label' => esc_html__( 'Submenu Color - Hover', 'the-post-grid' ), |
| 6318 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6319 | 'selectors' => [ |
| 6320 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'color: {{VALUE}}', |
| 6321 | ], |
| 6322 | 'condition' => [ |
| 6323 | 'filter_type' => 'dropdown', |
| 6324 | ], |
| 6325 | ] |
| 6326 | ); |
| 6327 | |
| 6328 | $ref->add_control( |
| 6329 | 'sub_menu_border_bottom_hover', |
| 6330 | [ |
| 6331 | 'label' => esc_html__( 'Submenu Border - Hover', 'the-post-grid' ), |
| 6332 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6333 | 'selectors' => [ |
| 6334 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'border-bottom-color: {{VALUE}}', |
| 6335 | ], |
| 6336 | 'condition' => [ |
| 6337 | 'filter_type' => 'dropdown', |
| 6338 | ], |
| 6339 | ] |
| 6340 | ); |
| 6341 | |
| 6342 | $ref->add_control( |
| 6343 | 'filter_nav_color_hover', |
| 6344 | [ |
| 6345 | 'label' => esc_html__( 'Filter Nav Color - Hover', 'the-post-grid' ), |
| 6346 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6347 | 'selectors' => [ |
| 6348 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'color: {{VALUE}}', |
| 6349 | ], |
| 6350 | 'condition' => [ |
| 6351 | 'filter_btn_style' => 'carousel', |
| 6352 | 'filter_next_prev_btn' => 'visible', |
| 6353 | ], |
| 6354 | ] |
| 6355 | ); |
| 6356 | |
| 6357 | $ref->add_control( |
| 6358 | 'filter_nav_bg_hover', |
| 6359 | [ |
| 6360 | 'label' => esc_html__( 'Filter Nav Background - Hover', 'the-post-grid' ), |
| 6361 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6362 | 'selectors' => [ |
| 6363 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'background-color: {{VALUE}}', |
| 6364 | ], |
| 6365 | 'condition' => [ |
| 6366 | 'filter_btn_style' => 'carousel', |
| 6367 | 'filter_next_prev_btn' => 'visible', |
| 6368 | ], |
| 6369 | ] |
| 6370 | ); |
| 6371 | |
| 6372 | $ref->add_control( |
| 6373 | 'filter_nav_border_hover', |
| 6374 | [ |
| 6375 | 'label' => esc_html__( 'Filter Nav Border - Hover', 'the-post-grid' ), |
| 6376 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6377 | 'selectors' => [ |
| 6378 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'border-color: {{VALUE}}', |
| 6379 | ], |
| 6380 | 'condition' => [ |
| 6381 | 'filter_btn_style' => 'carousel', |
| 6382 | 'filter_next_prev_btn' => 'visible', |
| 6383 | ], |
| 6384 | ] |
| 6385 | ); |
| 6386 | |
| 6387 | |
| 6388 | $ref->end_controls_tab(); |
| 6389 | |
| 6390 | $ref->end_controls_tabs(); |
| 6391 | //TODO: End Tab |
| 6392 | |
| 6393 | |
| 6394 | $ref->end_controls_section(); |
| 6395 | } |
| 6396 | |
| 6397 | |
| 6398 | /** |
| 6399 | * Social Share Style |
| 6400 | * |
| 6401 | * @param $ref |
| 6402 | */ |
| 6403 | public static function socialShareStyle( $ref ) { |
| 6404 | $prefix = $ref->prefix; |
| 6405 | $ref->start_controls_section( |
| 6406 | 'social_share_style', |
| 6407 | [ |
| 6408 | 'label' => esc_html__( 'Social Share', 'the-post-grid' ), |
| 6409 | 'tab' => Controls_Manager::TAB_STYLE, |
| 6410 | 'condition' => [ |
| 6411 | 'show_social_share' => 'show', |
| 6412 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 6413 | ], |
| 6414 | ] |
| 6415 | ); |
| 6416 | |
| 6417 | self::get_social_share_control( $ref ); |
| 6418 | |
| 6419 | $ref->end_controls_section(); |
| 6420 | } |
| 6421 | |
| 6422 | /** |
| 6423 | * Get Social Share |
| 6424 | * |
| 6425 | * @param $ref |
| 6426 | * @param $prefix |
| 6427 | */ |
| 6428 | public static function get_social_share_control( $ref ) { |
| 6429 | $settings = get_option( rtTPG()->options['settings'] ); |
| 6430 | $ssList = ! empty( $settings['social_share_items'] ) ? $settings['social_share_items'] : []; |
| 6431 | |
| 6432 | $ref->add_responsive_control( |
| 6433 | 'social_icon_margin', |
| 6434 | [ |
| 6435 | 'label' => esc_html__( 'Icon Margin', 'the-post-grid' ), |
| 6436 | 'type' => Controls_Manager::DIMENSIONS, |
| 6437 | 'size_units' => [ 'px' ], |
| 6438 | 'allowed_dimensions' => 'all', |
| 6439 | 'selectors' => [ |
| 6440 | '{{WRAPPER}} .rt-tpg-social-share a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6441 | ], |
| 6442 | ] |
| 6443 | ); |
| 6444 | |
| 6445 | $ref->add_responsive_control( |
| 6446 | 'social_wrapper_margin', |
| 6447 | [ |
| 6448 | 'label' => esc_html__( 'Icon Wrapper Spacing', 'the-post-grid' ), |
| 6449 | 'type' => Controls_Manager::DIMENSIONS, |
| 6450 | 'size_units' => [ 'px' ], |
| 6451 | 'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ] |
| 6452 | 'default' => [ |
| 6453 | 'top' => '', |
| 6454 | 'right' => '', |
| 6455 | 'bottom' => '', |
| 6456 | 'left' => '', |
| 6457 | 'isLinked' => false, |
| 6458 | ], |
| 6459 | 'selectors' => [ |
| 6460 | '{{WRAPPER}} .rt-tpg-social-share' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6461 | ], |
| 6462 | ] |
| 6463 | ); |
| 6464 | |
| 6465 | $ref->add_responsive_control( |
| 6466 | 'social_icon_radius', |
| 6467 | [ |
| 6468 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ), |
| 6469 | 'type' => Controls_Manager::DIMENSIONS, |
| 6470 | 'size_units' => [ 'px', '%', 'em' ], |
| 6471 | 'allowed_dimensions' => 'all', |
| 6472 | 'default' => [ |
| 6473 | 'top' => '', |
| 6474 | 'right' => '', |
| 6475 | 'bottom' => '', |
| 6476 | 'left' => '', |
| 6477 | 'isLinked' => true, |
| 6478 | ], |
| 6479 | 'selectors' => [ |
| 6480 | '{{WRAPPER}} .rt-tpg-social-share i' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6481 | ], |
| 6482 | ] |
| 6483 | ); |
| 6484 | |
| 6485 | $ref->add_control( |
| 6486 | 'icon_width_height', |
| 6487 | [ |
| 6488 | 'label' => esc_html__( 'Icon Dimension', 'the-post-grid' ), |
| 6489 | 'type' => \Elementor\Controls_Manager::IMAGE_DIMENSIONS, |
| 6490 | 'default' => [ |
| 6491 | 'width' => '', |
| 6492 | 'height' => '', |
| 6493 | ], |
| 6494 | 'selectors' => [ |
| 6495 | '{{WRAPPER}} .rt-tpg-social-share a i' => 'width:{{width}}px; height:{{height}}px; line-height:{{height}}px; text-align:center', |
| 6496 | ], |
| 6497 | 'description' => esc_html__( 'Just write number. Don\'t use (px or em).', 'the-post-grid' ), |
| 6498 | 'classes' => 'should-show-title', |
| 6499 | ] |
| 6500 | ); |
| 6501 | |
| 6502 | $ref->add_responsive_control( |
| 6503 | 'icon_font_size', |
| 6504 | [ |
| 6505 | 'label' => esc_html__( 'Icon Font Size', 'the-post-grid' ), |
| 6506 | 'type' => Controls_Manager::SLIDER, |
| 6507 | 'size_units' => [ 'px' ], |
| 6508 | 'range' => [ |
| 6509 | 'px' => [ |
| 6510 | 'min' => 12, |
| 6511 | 'max' => 50, |
| 6512 | 'step' => 1, |
| 6513 | ], |
| 6514 | ], |
| 6515 | 'selectors' => [ |
| 6516 | '{{WRAPPER}} .rt-tpg-social-share a i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 6517 | ], |
| 6518 | ] |
| 6519 | ); |
| 6520 | |
| 6521 | $ref->add_control( |
| 6522 | 'social_icon_color_heading', |
| 6523 | [ |
| 6524 | 'label' => esc_html__( 'Icon Color:', 'the-post-grid' ), |
| 6525 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 6526 | 'separator' => 'before', |
| 6527 | 'classes' => 'tpg-control-type-heading', |
| 6528 | ] |
| 6529 | ); |
| 6530 | |
| 6531 | $ref->add_control( |
| 6532 | 'social_icon_style', |
| 6533 | [ |
| 6534 | 'label' => esc_html__( 'Icon Color Style', 'the-post-grid' ), |
| 6535 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 6536 | 'default' => 'default', |
| 6537 | 'options' => [ |
| 6538 | 'default' => esc_html__( 'Default (Brand Color)', 'the-post-grid' ), |
| 6539 | 'different_color' => esc_html__( 'Different Color for each', 'the-post-grid' ), |
| 6540 | 'custom' => esc_html__( 'Custom color', 'the-post-grid' ), |
| 6541 | ], |
| 6542 | 'description' => esc_html__( 'Select Custom for your own customize', 'the-post-grid' ), |
| 6543 | ] |
| 6544 | ); |
| 6545 | |
| 6546 | //TODO: Start Social Share Tabs Tab |
| 6547 | $ref->start_controls_tabs( |
| 6548 | 'social_share_style_tabs' |
| 6549 | ); |
| 6550 | |
| 6551 | $ref->start_controls_tab( |
| 6552 | 'social_share_normal_tab', |
| 6553 | [ |
| 6554 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 6555 | ] |
| 6556 | ); |
| 6557 | //TODO: Normal Tab |
| 6558 | |
| 6559 | |
| 6560 | $ref->add_control( |
| 6561 | 'social_icon_color', |
| 6562 | [ |
| 6563 | 'label' => esc_html__( 'Social Icon color', 'the-post-grid' ), |
| 6564 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6565 | 'selectors' => [ |
| 6566 | '{{WRAPPER}} .rt-tpg-social-share a i' => 'color: {{VALUE}}', |
| 6567 | ], |
| 6568 | 'condition' => [ |
| 6569 | 'social_icon_style' => 'custom', |
| 6570 | ], |
| 6571 | ] |
| 6572 | ); |
| 6573 | |
| 6574 | $ref->add_control( |
| 6575 | 'social_icon_bg_color', |
| 6576 | [ |
| 6577 | 'label' => esc_html__( 'Social Icon Background', 'the-post-grid' ), |
| 6578 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6579 | 'selectors' => [ |
| 6580 | '{{WRAPPER}} .rt-tpg-social-share a i' => 'background-color: {{VALUE}}', |
| 6581 | ], |
| 6582 | 'condition' => [ |
| 6583 | 'social_icon_style' => 'custom', |
| 6584 | ], |
| 6585 | ] |
| 6586 | ); |
| 6587 | |
| 6588 | |
| 6589 | foreach ( $ssList as $ss ) { |
| 6590 | $ref->add_control( |
| 6591 | $ss . '_social_icon_color', |
| 6592 | [ |
| 6593 | 'label' => ucwords( $ss ) . esc_html__( ' color', 'the-post-grid' ), |
| 6594 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6595 | 'selectors' => [ |
| 6596 | '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'color: {{VALUE}}', |
| 6597 | ], |
| 6598 | 'condition' => [ |
| 6599 | 'social_icon_style' => 'different_color', |
| 6600 | ], |
| 6601 | ] |
| 6602 | ); |
| 6603 | |
| 6604 | $ref->add_control( |
| 6605 | $ss . '_social_icon_bg_color', |
| 6606 | [ |
| 6607 | 'label' => ucwords( $ss ) . esc_html__( ' Background', 'the-post-grid' ), |
| 6608 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6609 | 'selectors' => [ |
| 6610 | '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'background-color: {{VALUE}}', |
| 6611 | ], |
| 6612 | 'condition' => [ |
| 6613 | 'social_icon_style' => 'different_color', |
| 6614 | ], |
| 6615 | ] |
| 6616 | ); |
| 6617 | } |
| 6618 | |
| 6619 | |
| 6620 | $ref->add_group_control( |
| 6621 | \Elementor\Group_Control_Border::get_type(), |
| 6622 | [ |
| 6623 | 'name' => 'social_icon_border', |
| 6624 | 'label' => esc_html__( 'Icon Border', 'the-post-grid' ), |
| 6625 | 'selector' => '{{WRAPPER}} .rt-tpg-social-share a i', |
| 6626 | ] |
| 6627 | ); |
| 6628 | |
| 6629 | $ref->end_controls_tab(); |
| 6630 | |
| 6631 | $ref->start_controls_tab( |
| 6632 | 'socia_hover_tab', |
| 6633 | [ |
| 6634 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 6635 | ] |
| 6636 | ); |
| 6637 | |
| 6638 | //TODO: Hover Tab |
| 6639 | |
| 6640 | $ref->add_control( |
| 6641 | 'social_icon_color_hover', |
| 6642 | [ |
| 6643 | 'label' => esc_html__( 'Icon color', 'the-post-grid' ), |
| 6644 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6645 | 'selectors' => [ |
| 6646 | '{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'color: {{VALUE}} !important', |
| 6647 | ], |
| 6648 | // 'condition' => [ |
| 6649 | // 'social_icon_style' => 'custom', |
| 6650 | // ], |
| 6651 | ] |
| 6652 | ); |
| 6653 | |
| 6654 | $ref->add_control( |
| 6655 | 'social_icon_bg_color_hover', |
| 6656 | [ |
| 6657 | 'label' => esc_html__( 'Icon Background', 'the-post-grid' ), |
| 6658 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6659 | 'selectors' => [ |
| 6660 | '{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'background-color: {{VALUE}} !important', |
| 6661 | ], |
| 6662 | // 'condition' => [ |
| 6663 | // 'social_icon_style' => 'custom', |
| 6664 | // ], |
| 6665 | ] |
| 6666 | ); |
| 6667 | |
| 6668 | // foreach ( $ssList as $ss ) { |
| 6669 | // $ref->add_control( |
| 6670 | // $ss . '_social_icon_color_hover', |
| 6671 | // [ |
| 6672 | // 'label' => ucwords( $ss ) . esc_html__( ' color - Hover', 'the-post-grid' ), |
| 6673 | // 'type' => \Elementor\Controls_Manager::COLOR, |
| 6674 | // 'selectors' => [ |
| 6675 | // '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ':hover i' => 'color: {{VALUE}}', |
| 6676 | // ], |
| 6677 | // 'condition' => [ |
| 6678 | // 'social_icon_style' => 'different_color', |
| 6679 | // ], |
| 6680 | // ] |
| 6681 | // ); |
| 6682 | // |
| 6683 | // $ref->add_control( |
| 6684 | // $ss . '_social_icon_bg_color_hover', |
| 6685 | // [ |
| 6686 | // 'label' => ucwords( $ss ) . esc_html__( ' Background - Hover', 'the-post-grid' ), |
| 6687 | // 'type' => \Elementor\Controls_Manager::COLOR, |
| 6688 | // 'selectors' => [ |
| 6689 | // '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ':hover i' => 'background-color: {{VALUE}}', |
| 6690 | // ], |
| 6691 | // 'condition' => [ |
| 6692 | // 'social_icon_style' => 'different_color', |
| 6693 | // ], |
| 6694 | // ] |
| 6695 | // ); |
| 6696 | // } |
| 6697 | |
| 6698 | $ref->add_group_control( |
| 6699 | \Elementor\Group_Control_Border::get_type(), |
| 6700 | [ |
| 6701 | 'name' => 'social_icon_border_hover', |
| 6702 | 'label' => esc_html__( 'Icon Border - Hover', 'the-post-grid' ), |
| 6703 | 'selector' => '{{WRAPPER}} .rt-tpg-social-share a:hover i', |
| 6704 | ] |
| 6705 | ); |
| 6706 | |
| 6707 | $ref->end_controls_tab(); |
| 6708 | |
| 6709 | //TODO: ============================ |
| 6710 | $ref->start_controls_tab( |
| 6711 | 'socia_box_hover_tab', |
| 6712 | [ |
| 6713 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 6714 | ] |
| 6715 | ); |
| 6716 | |
| 6717 | $ref->add_control( |
| 6718 | 'social_icon_color_box_hover', |
| 6719 | [ |
| 6720 | 'label' => esc_html__( 'Icon color - BoxHover', 'the-post-grid' ), |
| 6721 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6722 | 'selectors' => [ |
| 6723 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .rt-tpg-social-share a i' => 'color: {{VALUE}}', |
| 6724 | ], |
| 6725 | ] |
| 6726 | ); |
| 6727 | |
| 6728 | $ref->add_control( |
| 6729 | 'social_icon_bg_color_box_hover', |
| 6730 | [ |
| 6731 | 'label' => esc_html__( 'Icon Background - BoxHover', 'the-post-grid' ), |
| 6732 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6733 | 'selectors' => [ |
| 6734 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .rt-tpg-social-share a i' => 'background-color: {{VALUE}}', |
| 6735 | ], |
| 6736 | ] |
| 6737 | ); |
| 6738 | |
| 6739 | $ref->end_controls_tab(); |
| 6740 | |
| 6741 | $ref->end_controls_tabs(); |
| 6742 | } |
| 6743 | |
| 6744 | /** |
| 6745 | * Box style / Card style |
| 6746 | * |
| 6747 | * @param $ref |
| 6748 | */ |
| 6749 | public static function articlBoxSettings( $ref ) { |
| 6750 | $prefix = $ref->prefix; |
| 6751 | $ref->start_controls_section( |
| 6752 | 'article_box_settings', |
| 6753 | [ |
| 6754 | 'label' => esc_html__( 'Card (Post Item)', 'the-post-grid' ), |
| 6755 | 'tab' => Controls_Manager::TAB_STYLE, |
| 6756 | ] |
| 6757 | ); |
| 6758 | |
| 6759 | if ( 'slider' !== $prefix ) { |
| 6760 | $ref->add_responsive_control( |
| 6761 | 'box_margin', |
| 6762 | [ |
| 6763 | 'label' => esc_html__( 'Card Gap', 'the-post-grid' ), |
| 6764 | 'type' => Controls_Manager::DIMENSIONS, |
| 6765 | 'size_units' => [ 'px' ], |
| 6766 | 'render_type' => 'template', |
| 6767 | 'selectors' => [ |
| 6768 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-row [class*="rt-col"]' => 'padding-left: {{LEFT}}{{UNIT}} !important; padding-right: {{RIGHT}}{{UNIT}} !important; padding-bottom: calc(2 * {{BOTTOM}}{{UNIT}}) !important;', |
| 6769 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-row' => 'margin-left: -{{LEFT}}{{UNIT}}; margin-right: -{{RIGHT}}{{UNIT}}', |
| 6770 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-row .rt-row' => 'margin-bottom: -{{RIGHT}}{{UNIT}}', |
| 6771 | '{{WRAPPER}} .rt-tpg-container .grid_hover-layout8 .display-grid-wrapper' => 'grid-gap: {{TOP}}{{UNIT}};margin-bottom: {{TOP}}{{UNIT}}', |
| 6772 | ], |
| 6773 | 'condition' => [ |
| 6774 | $prefix . '_layout!' => [ |
| 6775 | 'grid-layout2', |
| 6776 | 'grid-layout5', |
| 6777 | 'grid-layout5-2', |
| 6778 | 'grid-layout6', |
| 6779 | 'grid-layout6-2', |
| 6780 | 'list-layout4', |
| 6781 | ], |
| 6782 | ], |
| 6783 | ] |
| 6784 | ); |
| 6785 | } |
| 6786 | |
| 6787 | |
| 6788 | if ( in_array( $prefix, [ 'grid', 'list', 'slider' ] ) ) { |
| 6789 | if ( 'slider' == $prefix ) { |
| 6790 | $box_padding = [ |
| 6791 | $prefix . '_layout' => [ |
| 6792 | 'slider-layout1', |
| 6793 | 'slider-layout2', |
| 6794 | 'slider-layout3', |
| 6795 | ], |
| 6796 | ]; |
| 6797 | } else { |
| 6798 | $box_padding = [ |
| 6799 | $prefix . '_layout!' => [ |
| 6800 | 'grid-layout5', |
| 6801 | 'grid-layout5-2', |
| 6802 | 'grid-layout6', |
| 6803 | 'grid-layout6-2', |
| 6804 | 'grid-layout7', |
| 6805 | 'list-layout1', |
| 6806 | 'list-layout2', |
| 6807 | 'list-layout2-2', |
| 6808 | 'list-layout3', |
| 6809 | 'list-layout3-2', |
| 6810 | 'list-layout4', |
| 6811 | 'list-layout5', |
| 6812 | 'slider-layout1', |
| 6813 | 'slider-layout2', |
| 6814 | 'slider-layout3', |
| 6815 | ], |
| 6816 | ]; |
| 6817 | } |
| 6818 | $ref->add_responsive_control( |
| 6819 | 'content_box_padding', |
| 6820 | [ |
| 6821 | 'label' => esc_html__( 'Content Padding', 'the-post-grid' ), |
| 6822 | 'type' => Controls_Manager::DIMENSIONS, |
| 6823 | 'size_units' => [ 'px' ], |
| 6824 | 'allowed_dimensions' => 'all', |
| 6825 | 'selectors' => [ |
| 6826 | 'body {{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6827 | 'body {{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper-flex .post-right-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6828 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-holder .rt-el-content-wrapper .tpg-el-image-wrap' => 'margin-left: -{{LEFT}}{{UNIT}}; margin-right: -{{RIGHT}}{{UNIT}};', |
| 6829 | ], |
| 6830 | 'condition' => $box_padding, |
| 6831 | ] |
| 6832 | ); |
| 6833 | |
| 6834 | |
| 6835 | $ref->add_responsive_control( |
| 6836 | 'content_box_padding_offset', |
| 6837 | [ |
| 6838 | 'label' => esc_html__( 'Content Padding', 'the-post-grid' ), |
| 6839 | 'type' => Controls_Manager::DIMENSIONS, |
| 6840 | 'size_units' => [ 'px' ], |
| 6841 | 'allowed_dimensions' => 'all', |
| 6842 | 'selectors' => [ |
| 6843 | 'body {{WRAPPER}} .tpg-el-main-wrapper .offset-left .tpg-post-holder .offset-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6844 | '{{WRAPPER}} .rt-tpg-container .list-layout4 .post-right-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6845 | ], |
| 6846 | 'condition' => [ |
| 6847 | $prefix . '_layout' => [ |
| 6848 | 'grid-layout5', |
| 6849 | 'grid-layout5-2', |
| 6850 | 'list-layout4', |
| 6851 | ], |
| 6852 | ], |
| 6853 | ] |
| 6854 | ); |
| 6855 | } |
| 6856 | |
| 6857 | $ref->add_responsive_control( |
| 6858 | 'content_box_padding_2', |
| 6859 | [ |
| 6860 | 'label' => esc_html__( 'Content Padding', 'the-post-grid' ), |
| 6861 | 'type' => Controls_Manager::DIMENSIONS, |
| 6862 | 'size_units' => [ 'px' ], |
| 6863 | 'allowed_dimensions' => 'all', |
| 6864 | 'selectors' => [ |
| 6865 | 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6866 | ], |
| 6867 | 'condition' => [ |
| 6868 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 6869 | ], |
| 6870 | ] |
| 6871 | ); |
| 6872 | |
| 6873 | $ref->add_responsive_control( |
| 6874 | 'box_radius', |
| 6875 | [ |
| 6876 | 'label' => esc_html__( 'Card Border Radius', 'the-post-grid' ), |
| 6877 | 'type' => Controls_Manager::DIMENSIONS, |
| 6878 | 'size_units' => [ 'px', '%' ], |
| 6879 | 'selectors' => [ |
| 6880 | 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};overflow:hidden;', |
| 6881 | 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};overflow:hidden;', |
| 6882 | ], |
| 6883 | 'condition' => [ |
| 6884 | $prefix . '_layout!' => [ |
| 6885 | 'list-layout2', |
| 6886 | 'list-layout2-2', |
| 6887 | 'list-layout3', |
| 6888 | 'list-layout3-2', |
| 6889 | 'list-layout4', |
| 6890 | 'list-layout4-2', |
| 6891 | 'list-layout5', |
| 6892 | 'list-layout5-2', |
| 6893 | 'slider-layout11', |
| 6894 | 'slider-layout12', |
| 6895 | 'slider-layout13', |
| 6896 | ], |
| 6897 | ], |
| 6898 | ] |
| 6899 | ); |
| 6900 | |
| 6901 | if ( in_array( $prefix, [ 'grid', 'list' ] ) ) { |
| 6902 | $ref->add_control( |
| 6903 | 'is_box_border', |
| 6904 | [ |
| 6905 | 'label' => esc_html__( 'Enable Border & Box Shadow', 'the-post-grid' ), |
| 6906 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 6907 | 'default' => 'enable', |
| 6908 | 'options' => [ |
| 6909 | 'enable' => esc_html__( 'Enable', 'the-post-grid' ), |
| 6910 | 'disable' => esc_html__( 'Disable', 'the-post-grid' ), |
| 6911 | ], |
| 6912 | 'prefix_class' => 'tpg-el-box-border-', |
| 6913 | 'condition' => [ |
| 6914 | $prefix . '_layout!' => [ |
| 6915 | 'slider-layout11', |
| 6916 | 'slider-layout12', |
| 6917 | 'slider-layout13', |
| 6918 | ], |
| 6919 | ], |
| 6920 | ] |
| 6921 | ); |
| 6922 | } |
| 6923 | |
| 6924 | if ( 'slider' ) { |
| 6925 | $ref->add_control( |
| 6926 | 'box_border_bottom', |
| 6927 | [ |
| 6928 | 'label' => esc_html__( 'Enable Border Bottom', 'the-post-grid' ), |
| 6929 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 6930 | 'default' => 'disable', |
| 6931 | 'options' => [ |
| 6932 | 'enable' => esc_html__( 'Enable', 'the-post-grid' ), |
| 6933 | 'disable' => esc_html__( 'Disable', 'the-post-grid' ), |
| 6934 | ], |
| 6935 | 'prefix_class' => 'tpg-border-bottom-', |
| 6936 | 'condition' => [ |
| 6937 | $prefix . '_layout!' => [ |
| 6938 | 'slider-layout11', |
| 6939 | 'slider-layout12', |
| 6940 | 'slider-layout13', |
| 6941 | ], |
| 6942 | ], |
| 6943 | ] |
| 6944 | ); |
| 6945 | } |
| 6946 | |
| 6947 | $ref->add_control( |
| 6948 | 'box_border_bottom_color', |
| 6949 | [ |
| 6950 | 'label' => esc_html__( 'Border Bottom Color', 'the-post-grid' ), |
| 6951 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6952 | 'selectors' => [ |
| 6953 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border-bottom-color: {{VALUE}}', |
| 6954 | ], |
| 6955 | 'condition' => [ |
| 6956 | 'box_border_bottom' => 'enable' |
| 6957 | ], |
| 6958 | ] |
| 6959 | ); |
| 6960 | |
| 6961 | $ref->add_responsive_control( |
| 6962 | 'box_border_spacing', |
| 6963 | [ |
| 6964 | 'label' => esc_html__( 'Border Spacing Bottom', 'the-post-grid' ), |
| 6965 | 'type' => Controls_Manager::SLIDER, |
| 6966 | 'size_units' => [ 'px' ], |
| 6967 | 'range' => [ |
| 6968 | 'px' => [ |
| 6969 | 'min' => 0, |
| 6970 | 'max' => 200, |
| 6971 | 'step' => 1, |
| 6972 | ], |
| 6973 | ], |
| 6974 | 'selectors' => [ |
| 6975 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'padding-bottom: {{SIZE}}{{UNIT}};', |
| 6976 | ], |
| 6977 | 'condition' => [ |
| 6978 | 'box_border_bottom' => 'enable' |
| 6979 | ], |
| 6980 | ] |
| 6981 | ); |
| 6982 | |
| 6983 | if ( 'grid_hover' !== $prefix ) { |
| 6984 | //TODO: Start Tab |
| 6985 | $ref->start_controls_tabs( |
| 6986 | 'box_style_tabs' |
| 6987 | ); |
| 6988 | |
| 6989 | //TODO: Normal Tab |
| 6990 | $ref->start_controls_tab( |
| 6991 | 'box_style_normal_tab', |
| 6992 | [ |
| 6993 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 6994 | ] |
| 6995 | ); |
| 6996 | |
| 6997 | $ref->add_group_control( |
| 6998 | \Elementor\Group_Control_Background::get_type(), |
| 6999 | [ |
| 7000 | 'name' => 'box_background', |
| 7001 | 'label' => esc_html__( 'Background', 'the-post-grid' ), |
| 7002 | 'fields_options' => [ |
| 7003 | 'background' => [ |
| 7004 | 'label' => esc_html__( 'Card Background', 'the-post-grid' ), |
| 7005 | ], |
| 7006 | ], |
| 7007 | 'types' => [ 'classic', 'gradient' ], |
| 7008 | 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder', |
| 7009 | 'condition' => [ |
| 7010 | $prefix . '_layout!' => [ 'slider-layout13' ], |
| 7011 | ], |
| 7012 | ] |
| 7013 | ); |
| 7014 | |
| 7015 | $ref->add_group_control( |
| 7016 | \Elementor\Group_Control_Background::get_type(), |
| 7017 | [ |
| 7018 | 'name' => 'box_background2', |
| 7019 | 'label' => esc_html__( 'Background', 'the-post-grid' ), |
| 7020 | 'fields_options' => [ |
| 7021 | 'background' => [ |
| 7022 | 'label' => esc_html__( 'Card Background', 'the-post-grid' ), |
| 7023 | ], |
| 7024 | ], |
| 7025 | 'types' => [ 'classic', 'gradient' ], |
| 7026 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content', |
| 7027 | 'condition' => [ |
| 7028 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 7029 | ], |
| 7030 | ] |
| 7031 | ); |
| 7032 | |
| 7033 | if ( in_array( $prefix, [ 'grid', 'list' ] ) ) { |
| 7034 | $ref->add_control( |
| 7035 | 'box_border', |
| 7036 | [ |
| 7037 | 'label' => esc_html__( 'Border Color', 'the-post-grid' ), |
| 7038 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 7039 | 'selectors' => [ |
| 7040 | 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border: 1px solid {{VALUE}}', |
| 7041 | ], |
| 7042 | 'condition' => [ |
| 7043 | 'is_box_border' => 'enable' |
| 7044 | ], |
| 7045 | ] |
| 7046 | ); |
| 7047 | |
| 7048 | |
| 7049 | $ref->add_group_control( |
| 7050 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 7051 | [ |
| 7052 | 'name' => 'box_box_shadow', |
| 7053 | 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ), |
| 7054 | 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder', |
| 7055 | 'condition' => [ |
| 7056 | 'is_box_border' => 'enable' |
| 7057 | ], |
| 7058 | ] |
| 7059 | ); |
| 7060 | } |
| 7061 | |
| 7062 | $ref->add_group_control( |
| 7063 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 7064 | [ |
| 7065 | 'name' => 'box_box_shadow2', |
| 7066 | 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ), |
| 7067 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content', |
| 7068 | 'condition' => [ |
| 7069 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 7070 | ], |
| 7071 | ] |
| 7072 | ); |
| 7073 | |
| 7074 | |
| 7075 | $ref->end_controls_tab(); |
| 7076 | |
| 7077 | |
| 7078 | //TODO: Hover Tab |
| 7079 | $ref->start_controls_tab( |
| 7080 | 'box_style_hover_tab', |
| 7081 | [ |
| 7082 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 7083 | ] |
| 7084 | ); |
| 7085 | |
| 7086 | $ref->add_group_control( |
| 7087 | \Elementor\Group_Control_Background::get_type(), |
| 7088 | [ |
| 7089 | 'name' => 'box_background_hover', |
| 7090 | 'label' => esc_html__( 'Background - Hover', 'the-post-grid' ), |
| 7091 | 'fields_options' => [ |
| 7092 | 'background' => [ |
| 7093 | 'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ), |
| 7094 | ], |
| 7095 | ], |
| 7096 | 'types' => [ 'classic', 'gradient' ], |
| 7097 | 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover', |
| 7098 | 'condition' => [ |
| 7099 | $prefix . '_layout!' => [ 'slider-layout13' ], |
| 7100 | ], |
| 7101 | ] |
| 7102 | ); |
| 7103 | |
| 7104 | $ref->add_group_control( |
| 7105 | \Elementor\Group_Control_Background::get_type(), |
| 7106 | [ |
| 7107 | 'name' => 'box_background_hover2', |
| 7108 | 'label' => esc_html__( 'Background - Hover', 'the-post-grid' ), |
| 7109 | 'fields_options' => [ |
| 7110 | 'background' => [ |
| 7111 | 'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ), |
| 7112 | ], |
| 7113 | ], |
| 7114 | 'types' => [ 'classic', 'gradient' ], |
| 7115 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content', |
| 7116 | 'condition' => [ |
| 7117 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 7118 | ], |
| 7119 | ] |
| 7120 | ); |
| 7121 | |
| 7122 | if ( in_array( $prefix, [ 'grid', 'list' ] ) ) { |
| 7123 | $ref->add_control( |
| 7124 | 'box_border_hover', |
| 7125 | [ |
| 7126 | 'label' => esc_html__( 'Border Color - Hover', 'the-post-grid' ), |
| 7127 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 7128 | 'selectors' => [ |
| 7129 | 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover' => 'border: 1px solid {{VALUE}}', |
| 7130 | ], |
| 7131 | 'condition' => [ |
| 7132 | 'is_box_border' => 'enable', |
| 7133 | ], |
| 7134 | ] |
| 7135 | ); |
| 7136 | |
| 7137 | $ref->add_group_control( |
| 7138 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 7139 | [ |
| 7140 | 'name' => 'box_box_shadow_hover', |
| 7141 | 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ), |
| 7142 | 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover', |
| 7143 | 'condition' => [ |
| 7144 | 'is_box_border' => 'enable', |
| 7145 | ], |
| 7146 | ] |
| 7147 | ); |
| 7148 | } |
| 7149 | |
| 7150 | |
| 7151 | $ref->add_group_control( |
| 7152 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 7153 | [ |
| 7154 | 'name' => 'box_box_shadow_hover2', |
| 7155 | 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ), |
| 7156 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content', |
| 7157 | 'condition' => [ |
| 7158 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 7159 | ], |
| 7160 | ] |
| 7161 | ); |
| 7162 | |
| 7163 | |
| 7164 | $ref->end_controls_tab(); |
| 7165 | |
| 7166 | $ref->end_controls_tabs(); |
| 7167 | //TODO: End Tab |
| 7168 | |
| 7169 | } |
| 7170 | |
| 7171 | $ref->end_controls_section(); |
| 7172 | } |
| 7173 | |
| 7174 | |
| 7175 | /** |
| 7176 | * Slider Settings |
| 7177 | * |
| 7178 | * @param $ref |
| 7179 | */ |
| 7180 | |
| 7181 | public static function slider_settings( $ref, $layout_type = '' ) { |
| 7182 | $slider_condition = ''; |
| 7183 | if ( 'single' === $layout_type ) { |
| 7184 | $slider_condition = [ |
| 7185 | 'enable_related_slider!' => '', |
| 7186 | ]; |
| 7187 | } |
| 7188 | $prefix = $ref->prefix; |
| 7189 | $ref->start_controls_section( |
| 7190 | 'slider_settings', |
| 7191 | [ |
| 7192 | 'label' => esc_html__( 'Slider', 'the-post-grid' ), |
| 7193 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 7194 | 'condition' => $slider_condition, |
| 7195 | ] |
| 7196 | ); |
| 7197 | |
| 7198 | $ref->add_responsive_control( |
| 7199 | 'slider_gap', |
| 7200 | [ |
| 7201 | 'label' => esc_html__( 'Slider Gap', 'the-post-grid' ), |
| 7202 | 'type' => Controls_Manager::SLIDER, |
| 7203 | 'size_units' => [ 'px' ], |
| 7204 | 'range' => [ |
| 7205 | 'px' => [ |
| 7206 | 'min' => 0, |
| 7207 | 'max' => 100, |
| 7208 | 'step' => 1, |
| 7209 | ], |
| 7210 | ], |
| 7211 | 'selectors' => [ |
| 7212 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-slider-item' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};', |
| 7213 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-swiper-holder' => 'margin-left: calc(-{{SIZE}}{{UNIT}} - 5px);margin-right: -{{SIZE}}{{UNIT}};', |
| 7214 | '{{WRAPPER}} .rt-tpg-container .slider-column.swiper-slide .rt-slider-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', |
| 7215 | ], |
| 7216 | 'condition' => [ |
| 7217 | $prefix . '_layout!' => [ |
| 7218 | 'slider-layout10', |
| 7219 | 'slider-layout11', |
| 7220 | 'slider-layout12', |
| 7221 | 'slider-layout13' |
| 7222 | ], |
| 7223 | ], |
| 7224 | ] |
| 7225 | ); |
| 7226 | |
| 7227 | |
| 7228 | $ref->add_control( |
| 7229 | 'arrows', |
| 7230 | [ |
| 7231 | 'label' => esc_html__( 'Arrow Visibility', 'the-post-grid' ), |
| 7232 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7233 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 7234 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 7235 | 'return_value' => 'yes', |
| 7236 | 'default' => 'yes', |
| 7237 | 'condition' => [ |
| 7238 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7239 | ], |
| 7240 | ] |
| 7241 | ); |
| 7242 | |
| 7243 | |
| 7244 | $ref->add_control( |
| 7245 | 'arrow_position', |
| 7246 | [ |
| 7247 | 'label' => esc_html__( 'Arrow Position', 'the-post-grid' ), |
| 7248 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 7249 | 'default' => 'default', |
| 7250 | 'options' => [ |
| 7251 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 7252 | 'top-right' => esc_html__( 'Top Right', 'the-post-grid' ), |
| 7253 | 'top-left' => esc_html__( 'Top Left', 'the-post-grid' ), |
| 7254 | 'show-hover' => esc_html__( 'Center (Show on hover)', 'the-post-grid' ), |
| 7255 | ], |
| 7256 | 'condition' => [ |
| 7257 | 'arrows' => 'yes', |
| 7258 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7259 | ], |
| 7260 | 'prefix_class' => 'slider-arrow-position-', |
| 7261 | ] |
| 7262 | ); |
| 7263 | |
| 7264 | $ref->add_control( |
| 7265 | 'dots', |
| 7266 | [ |
| 7267 | 'label' => esc_html__( 'Dots Visibility', 'the-post-grid' ), |
| 7268 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7269 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 7270 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 7271 | 'return_value' => 'yes', |
| 7272 | 'default' => 'yes', |
| 7273 | 'prefix_class' => 'slider-dot-enable-', |
| 7274 | 'render_type' => 'template', |
| 7275 | 'condition' => [ |
| 7276 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7277 | ], |
| 7278 | ] |
| 7279 | ); |
| 7280 | |
| 7281 | $ref->add_control( |
| 7282 | 'dynamic_dots', |
| 7283 | [ |
| 7284 | 'label' => esc_html__( 'Enable Dynamic Dots', 'the-post-grid' ), |
| 7285 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7286 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 7287 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 7288 | 'return_value' => 'yes', |
| 7289 | 'default' => 'no', |
| 7290 | 'render_type' => 'template', |
| 7291 | 'condition' => [ |
| 7292 | 'dots' => 'yes', |
| 7293 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7294 | ], |
| 7295 | ] |
| 7296 | ); |
| 7297 | |
| 7298 | $ref->add_control( |
| 7299 | 'dots_style', |
| 7300 | [ |
| 7301 | 'label' => esc_html__( 'Dots Style', 'the-post-grid' ), |
| 7302 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 7303 | 'default' => 'default', |
| 7304 | 'options' => [ |
| 7305 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 7306 | 'background' => esc_html__( 'With Background', 'the-post-grid' ), |
| 7307 | ], |
| 7308 | 'condition' => [ |
| 7309 | 'dots' => 'yes', |
| 7310 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7311 | ], |
| 7312 | 'prefix_class' => 'slider-dots-style-', |
| 7313 | ] |
| 7314 | ); |
| 7315 | |
| 7316 | $ref->add_control( |
| 7317 | 'infinite', |
| 7318 | [ |
| 7319 | 'label' => esc_html__( 'Infinite', 'the-post-grid' ), |
| 7320 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7321 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7322 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7323 | 'return_value' => 'yes', |
| 7324 | 'default' => 'yes', |
| 7325 | ] |
| 7326 | ); |
| 7327 | |
| 7328 | $ref->add_control( |
| 7329 | 'autoplay', |
| 7330 | [ |
| 7331 | 'label' => esc_html__( 'Autoplay', 'the-post-grid' ), |
| 7332 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7333 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7334 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7335 | 'return_value' => 'yes', |
| 7336 | 'default' => false, |
| 7337 | ] |
| 7338 | ); |
| 7339 | |
| 7340 | $ref->add_control( |
| 7341 | 'autoplaySpeed', |
| 7342 | [ |
| 7343 | 'label' => esc_html__( 'Autoplay Speed', 'the-post-grid' ), |
| 7344 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 7345 | 'min' => 1000, |
| 7346 | 'max' => 10000, |
| 7347 | 'step' => 500, |
| 7348 | 'default' => 3000, |
| 7349 | 'condition' => [ |
| 7350 | 'autoplay' => 'yes', |
| 7351 | ], |
| 7352 | ] |
| 7353 | ); |
| 7354 | |
| 7355 | $ref->add_control( |
| 7356 | 'stopOnHover', |
| 7357 | [ |
| 7358 | 'label' => esc_html__( 'Stop On Hover', 'the-post-grid' ), |
| 7359 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7360 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7361 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7362 | 'return_value' => 'yes', |
| 7363 | 'default' => 'yes', |
| 7364 | 'condition' => [ |
| 7365 | 'autoplay' => 'yes', |
| 7366 | ], |
| 7367 | ] |
| 7368 | ); |
| 7369 | |
| 7370 | $ref->add_control( |
| 7371 | 'grabCursor', |
| 7372 | [ |
| 7373 | 'label' => esc_html__( 'Allow Touch Move', 'the-post-grid' ), |
| 7374 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7375 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7376 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7377 | 'return_value' => 'yes', |
| 7378 | 'default' => 'yes', |
| 7379 | ] |
| 7380 | ); |
| 7381 | |
| 7382 | |
| 7383 | $ref->add_control( |
| 7384 | 'autoHeight', |
| 7385 | [ |
| 7386 | 'label' => esc_html__( 'Auto Height', 'the-post-grid' ), |
| 7387 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7388 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7389 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7390 | 'return_value' => 'yes', |
| 7391 | 'default' => false, |
| 7392 | 'condition' => [ |
| 7393 | 'enable_2_rows!' => 'yes', |
| 7394 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7395 | ], |
| 7396 | ] |
| 7397 | ); |
| 7398 | |
| 7399 | $ref->add_control( |
| 7400 | 'lazyLoad', |
| 7401 | [ |
| 7402 | 'label' => esc_html__( 'lazy Load', 'the-post-grid' ), |
| 7403 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7404 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7405 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7406 | 'return_value' => 'yes', |
| 7407 | 'default' => false, |
| 7408 | 'prefix_class' => 'is-lazy-load-', |
| 7409 | 'render_type' => 'template', |
| 7410 | ] |
| 7411 | ); |
| 7412 | |
| 7413 | $ref->add_control( |
| 7414 | 'speed', |
| 7415 | [ |
| 7416 | 'label' => esc_html__( 'Speed', 'the-post-grid' ), |
| 7417 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 7418 | 'min' => 100, |
| 7419 | 'max' => 3000, |
| 7420 | 'step' => 100, |
| 7421 | 'default' => 500, |
| 7422 | ] |
| 7423 | ); |
| 7424 | |
| 7425 | $ref->add_control( |
| 7426 | 'enable_2_rows', |
| 7427 | [ |
| 7428 | 'label' => esc_html__( 'Enable 2 Rows', 'the-post-grid' ), |
| 7429 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7430 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 7431 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 7432 | 'return_value' => 'yes', |
| 7433 | 'default' => false, |
| 7434 | 'prefix_class' => 'enable-two-rows-', |
| 7435 | 'render_type' => 'template', |
| 7436 | 'description' => esc_html__( 'If you use 2 rows then you have to put an even number for post limit', 'the-post-grid' ), |
| 7437 | 'condition' => [ |
| 7438 | $prefix . '_layout!' => [ |
| 7439 | 'slider-layout13', |
| 7440 | 'slider-layout11', |
| 7441 | 'slider-layout12', |
| 7442 | 'slider-layout10' |
| 7443 | ], |
| 7444 | ], |
| 7445 | ] |
| 7446 | ); |
| 7447 | |
| 7448 | $ref->add_control( |
| 7449 | 'carousel_overflow', |
| 7450 | [ |
| 7451 | 'label' => esc_html__( 'Slider Overflow', 'the-post-grid' ), |
| 7452 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 7453 | 'default' => 'hidden', |
| 7454 | 'options' => [ |
| 7455 | 'hidden' => esc_html__( 'Hidden', 'the-post-grid' ), |
| 7456 | 'none' => esc_html__( 'None', 'the-post-grid' ), |
| 7457 | ], |
| 7458 | 'render_type' => 'template', |
| 7459 | 'prefix_class' => 'is-carousel-overflow-', |
| 7460 | 'condition' => [ |
| 7461 | 'lazyLoad!' => 'yes', |
| 7462 | ], |
| 7463 | ] |
| 7464 | ); |
| 7465 | |
| 7466 | $ref->add_control( |
| 7467 | 'slider_direction', |
| 7468 | [ |
| 7469 | 'label' => esc_html__( 'Direction', 'the-post-grid' ), |
| 7470 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 7471 | 'default' => 'ltr', |
| 7472 | 'options' => [ |
| 7473 | 'ltr' => esc_html__( 'LTR', 'the-post-grid' ), |
| 7474 | 'rtl' => esc_html__( 'RTL', 'the-post-grid' ), |
| 7475 | ], |
| 7476 | 'prefix_class' => 'slider-direction-', |
| 7477 | 'render_type' => 'template', |
| 7478 | ] |
| 7479 | ); |
| 7480 | |
| 7481 | $ref->end_controls_section(); |
| 7482 | } |
| 7483 | |
| 7484 | /** |
| 7485 | * Slider Style |
| 7486 | * |
| 7487 | * @param $ref |
| 7488 | */ |
| 7489 | |
| 7490 | public static function slider_style( $ref, $layout_type = '' ) { |
| 7491 | $prefix = $ref->prefix; |
| 7492 | if ( 'single' === $layout_type ) { |
| 7493 | $slider_condition = [ |
| 7494 | 'enable_related_slider!' => '', |
| 7495 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7496 | ]; |
| 7497 | } else { |
| 7498 | $slider_condition = [ |
| 7499 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7500 | ]; |
| 7501 | } |
| 7502 | |
| 7503 | $ref->start_controls_section( |
| 7504 | 'slider_style', |
| 7505 | [ |
| 7506 | 'label' => esc_html__( 'Slider', 'the-post-grid' ), |
| 7507 | 'tab' => Controls_Manager::TAB_STYLE, |
| 7508 | 'condition' => $slider_condition, |
| 7509 | ] |
| 7510 | ); |
| 7511 | |
| 7512 | $ref->add_control( |
| 7513 | 'arrow_style_heading', |
| 7514 | [ |
| 7515 | 'label' => esc_html__( 'Arrow Style', 'the-post-grid' ), |
| 7516 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 7517 | 'separator' => 'before', |
| 7518 | 'classes' => 'tpg-control-type-heading', |
| 7519 | 'condition' => [ |
| 7520 | 'arrows' => 'yes', |
| 7521 | ], |
| 7522 | ] |
| 7523 | ); |
| 7524 | |
| 7525 | $ref->add_responsive_control( |
| 7526 | 'arrow_font_size', |
| 7527 | [ |
| 7528 | 'label' => esc_html__( 'Arrow Font Size', 'the-post-grid' ), |
| 7529 | 'type' => Controls_Manager::SLIDER, |
| 7530 | 'size_units' => [ 'px' ], |
| 7531 | 'range' => [ |
| 7532 | 'px' => [ |
| 7533 | 'min' => 0, |
| 7534 | 'max' => 100, |
| 7535 | 'step' => 1, |
| 7536 | ], |
| 7537 | ], |
| 7538 | 'selectors' => [ |
| 7539 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'font-size: {{SIZE}}{{UNIT}};', |
| 7540 | ], |
| 7541 | 'condition' => [ |
| 7542 | 'arrows' => 'yes', |
| 7543 | ], |
| 7544 | ] |
| 7545 | ); |
| 7546 | |
| 7547 | $ref->add_responsive_control( |
| 7548 | 'arrow_border_radius', |
| 7549 | [ |
| 7550 | 'label' => esc_html__( 'Arrow Radius', 'the-post-grid' ), |
| 7551 | 'type' => Controls_Manager::SLIDER, |
| 7552 | 'size_units' => [ 'px', '%' ], |
| 7553 | 'range' => [ |
| 7554 | 'px' => [ |
| 7555 | 'min' => 0, |
| 7556 | 'max' => 100, |
| 7557 | 'step' => 1, |
| 7558 | ], |
| 7559 | '%' => [ |
| 7560 | 'min' => 0, |
| 7561 | 'max' => 100, |
| 7562 | 'step' => 1, |
| 7563 | ], |
| 7564 | ], |
| 7565 | 'selectors' => [ |
| 7566 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 7567 | ], |
| 7568 | 'condition' => [ |
| 7569 | 'arrows' => 'yes', |
| 7570 | ], |
| 7571 | ] |
| 7572 | ); |
| 7573 | |
| 7574 | $ref->add_responsive_control( |
| 7575 | 'arrow_width', |
| 7576 | [ |
| 7577 | 'label' => esc_html__( 'Arrow Width', 'the-post-grid' ), |
| 7578 | 'type' => Controls_Manager::SLIDER, |
| 7579 | 'size_units' => [ 'px' ], |
| 7580 | 'range' => [ |
| 7581 | 'px' => [ |
| 7582 | 'min' => 0, |
| 7583 | 'max' => 200, |
| 7584 | 'step' => 1, |
| 7585 | ], |
| 7586 | ], |
| 7587 | 'selectors' => [ |
| 7588 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'width: {{SIZE}}{{UNIT}};', |
| 7589 | ], |
| 7590 | 'condition' => [ |
| 7591 | 'arrows' => 'yes', |
| 7592 | ], |
| 7593 | ] |
| 7594 | ); |
| 7595 | |
| 7596 | $ref->add_responsive_control( |
| 7597 | 'arrow_height', |
| 7598 | [ |
| 7599 | 'label' => esc_html__( 'Arrow Height', 'the-post-grid' ), |
| 7600 | 'type' => Controls_Manager::SLIDER, |
| 7601 | 'size_units' => [ 'px' ], |
| 7602 | 'range' => [ |
| 7603 | 'px' => [ |
| 7604 | 'min' => 0, |
| 7605 | 'max' => 200, |
| 7606 | 'step' => 1, |
| 7607 | ], |
| 7608 | ], |
| 7609 | 'selectors' => [ |
| 7610 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'height: {{SIZE}}{{UNIT}}; line-height:{{SIZE}}{{UNIT}};', |
| 7611 | ], |
| 7612 | 'condition' => [ |
| 7613 | 'arrows' => 'yes', |
| 7614 | ], |
| 7615 | ] |
| 7616 | ); |
| 7617 | |
| 7618 | $ref->add_responsive_control( |
| 7619 | 'arrow_x_position', |
| 7620 | [ |
| 7621 | 'label' => esc_html__( 'Arrow X Position', 'the-post-grid' ), |
| 7622 | 'type' => Controls_Manager::SLIDER, |
| 7623 | 'size_units' => [ 'px' ], |
| 7624 | 'range' => [ |
| 7625 | 'px' => [ |
| 7626 | 'min' => - 300, |
| 7627 | 'max' => 300, |
| 7628 | 'step' => 1, |
| 7629 | ], |
| 7630 | ], |
| 7631 | 'selectors' => [ |
| 7632 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn.swiper-button-prev' => 'left: {{SIZE}}{{UNIT}};', |
| 7633 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn.swiper-button-next' => 'right: {{SIZE}}{{UNIT}};', |
| 7634 | '{{WRAPPER}}.slider-arrow-position-top-right .swiper-navigation' => 'right: {{SIZE}}{{UNIT}};', |
| 7635 | '{{WRAPPER}}.slider-arrow-position-top-left .swiper-navigation' => 'left: {{SIZE}}{{UNIT}};', |
| 7636 | ], |
| 7637 | 'condition' => [ |
| 7638 | 'arrows' => 'yes', |
| 7639 | ], |
| 7640 | ] |
| 7641 | ); |
| 7642 | |
| 7643 | $ref->add_responsive_control( |
| 7644 | 'arrow_y_position', |
| 7645 | [ |
| 7646 | 'label' => esc_html__( 'Arrow Y Position', 'the-post-grid' ), |
| 7647 | 'type' => Controls_Manager::SLIDER, |
| 7648 | 'size_units' => [ 'px', '%' ], |
| 7649 | 'range' => [ |
| 7650 | 'px' => [ |
| 7651 | 'min' => - 150, |
| 7652 | 'max' => 500, |
| 7653 | 'step' => 1, |
| 7654 | ], |
| 7655 | ], |
| 7656 | 'selectors' => [ |
| 7657 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'top: {{SIZE}}{{UNIT}};', |
| 7658 | '{{WRAPPER}}.slider-arrow-position-top-right .swiper-navigation, {{WRAPPER}}.slider-arrow-position-top-left .swiper-navigation' => 'top: {{SIZE}}{{UNIT}};', |
| 7659 | ], |
| 7660 | 'condition' => [ |
| 7661 | 'arrows' => 'yes', |
| 7662 | ], |
| 7663 | ] |
| 7664 | ); |
| 7665 | |
| 7666 | //TODO: Arrow Tabs Start |
| 7667 | $ref->start_controls_tabs( |
| 7668 | 'arrow_style_tabs', |
| 7669 | [ |
| 7670 | 'condition' => [ |
| 7671 | 'arrows' => 'yes', |
| 7672 | ], |
| 7673 | ] |
| 7674 | ); |
| 7675 | |
| 7676 | $ref->start_controls_tab( |
| 7677 | 'arrow_style_normal_tab', |
| 7678 | [ |
| 7679 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 7680 | ] |
| 7681 | ); |
| 7682 | |
| 7683 | $ref->add_control( |
| 7684 | 'arrow_color', |
| 7685 | [ |
| 7686 | 'type' => Controls_Manager::COLOR, |
| 7687 | 'label' => esc_html__( 'Arrow Icon Color', 'the-post-grid' ), |
| 7688 | 'selectors' => [ |
| 7689 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'color: {{VALUE}}', |
| 7690 | ], |
| 7691 | ] |
| 7692 | ); |
| 7693 | |
| 7694 | $ref->add_control( |
| 7695 | 'arrow_arrow_bg_color', |
| 7696 | [ |
| 7697 | 'type' => Controls_Manager::COLOR, |
| 7698 | 'label' => esc_html__( 'Arrow Background', 'the-post-grid' ), |
| 7699 | 'selectors' => [ |
| 7700 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'background-color: {{VALUE}}', |
| 7701 | ], |
| 7702 | ] |
| 7703 | ); |
| 7704 | |
| 7705 | $ref->add_group_control( |
| 7706 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 7707 | [ |
| 7708 | 'name' => 'arrow_box_shadow', |
| 7709 | 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ), |
| 7710 | 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn', |
| 7711 | ] |
| 7712 | ); |
| 7713 | |
| 7714 | $ref->add_group_control( |
| 7715 | \Elementor\Group_Control_Border::get_type(), |
| 7716 | [ |
| 7717 | 'name' => 'border', |
| 7718 | 'label' => esc_html__( 'Border', 'the-post-grid' ), |
| 7719 | 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn', |
| 7720 | ] |
| 7721 | ); |
| 7722 | |
| 7723 | $ref->end_controls_tab(); |
| 7724 | |
| 7725 | $ref->start_controls_tab( |
| 7726 | 'arrow_style_hover_tab', |
| 7727 | [ |
| 7728 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 7729 | ] |
| 7730 | ); |
| 7731 | |
| 7732 | $ref->add_control( |
| 7733 | 'arrow_hover_color', |
| 7734 | [ |
| 7735 | 'type' => Controls_Manager::COLOR, |
| 7736 | 'label' => esc_html__( 'Arrow Icon Color - Hover', 'the-post-grid' ), |
| 7737 | 'selectors' => [ |
| 7738 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'color: {{VALUE}}', |
| 7739 | ], |
| 7740 | ] |
| 7741 | ); |
| 7742 | |
| 7743 | $ref->add_control( |
| 7744 | 'arrow_bg_hover_color', |
| 7745 | [ |
| 7746 | 'type' => Controls_Manager::COLOR, |
| 7747 | 'label' => esc_html__( 'Arrow Background - Hover', 'the-post-grid' ), |
| 7748 | 'selectors' => [ |
| 7749 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'background-color: {{VALUE}}', |
| 7750 | ], |
| 7751 | ] |
| 7752 | ); |
| 7753 | |
| 7754 | $ref->add_group_control( |
| 7755 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 7756 | [ |
| 7757 | 'name' => 'arrow_box_shadow_hover', |
| 7758 | 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ), |
| 7759 | 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover', |
| 7760 | ] |
| 7761 | ); |
| 7762 | |
| 7763 | $ref->add_group_control( |
| 7764 | \Elementor\Group_Control_Border::get_type(), |
| 7765 | [ |
| 7766 | 'name' => 'border_hover', |
| 7767 | 'label' => esc_html__( 'Border - Hover', 'the-post-grid' ), |
| 7768 | 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover', |
| 7769 | ] |
| 7770 | ); |
| 7771 | |
| 7772 | $ref->end_controls_tab(); |
| 7773 | |
| 7774 | $ref->end_controls_tabs(); |
| 7775 | //TODO: Arrow Tabs End |
| 7776 | |
| 7777 | |
| 7778 | //TODO: Dots style Start |
| 7779 | |
| 7780 | $ref->add_control( |
| 7781 | 'dot_style_heading', |
| 7782 | [ |
| 7783 | 'label' => esc_html__( 'Dots Style', 'the-post-grid' ), |
| 7784 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 7785 | 'separator' => 'before', |
| 7786 | 'classes' => 'tpg-control-type-heading', |
| 7787 | 'condition' => [ |
| 7788 | 'dots' => 'yes', |
| 7789 | ], |
| 7790 | ] |
| 7791 | ); |
| 7792 | |
| 7793 | $ref->add_control( |
| 7794 | 'dots_text_align', |
| 7795 | [ |
| 7796 | 'label' => esc_html__( 'Dots Alignment', 'the-post-grid' ), |
| 7797 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 7798 | 'options' => [ |
| 7799 | 'left' => [ |
| 7800 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 7801 | 'icon' => 'eicon-text-align-left', |
| 7802 | ], |
| 7803 | 'center' => [ |
| 7804 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 7805 | 'icon' => 'eicon-text-align-center', |
| 7806 | ], |
| 7807 | 'right' => [ |
| 7808 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 7809 | 'icon' => 'eicon-text-align-right', |
| 7810 | ], |
| 7811 | ], |
| 7812 | 'toggle' => true, |
| 7813 | 'condition' => [ |
| 7814 | 'dots' => 'yes', |
| 7815 | ], |
| 7816 | 'prefix_class' => 'slider-dots-align-', |
| 7817 | ] |
| 7818 | ); |
| 7819 | |
| 7820 | |
| 7821 | $ref->add_responsive_control( |
| 7822 | 'dot_wrapper_radius', |
| 7823 | [ |
| 7824 | 'label' => esc_html__( 'Dots Wrapper Radius', 'the-post-grid' ), |
| 7825 | 'type' => Controls_Manager::SLIDER, |
| 7826 | 'size_units' => [ 'px', '%' ], |
| 7827 | 'range' => [ |
| 7828 | 'px' => [ |
| 7829 | 'min' => 0, |
| 7830 | 'max' => 1000, |
| 7831 | 'step' => 5, |
| 7832 | ], |
| 7833 | ], |
| 7834 | 'selectors' => [ |
| 7835 | '{{WRAPPER}}.slider-dots-style-background .tpg-el-main-wrapper .swiper-pagination' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 7836 | ], |
| 7837 | 'condition' => [ |
| 7838 | 'dots_style' => 'background', |
| 7839 | 'dots' => 'yes', |
| 7840 | ], |
| 7841 | ] |
| 7842 | ); |
| 7843 | |
| 7844 | $ref->add_responsive_control( |
| 7845 | 'dots_border_radius', |
| 7846 | [ |
| 7847 | 'label' => esc_html__( 'Dots Radius', 'the-post-grid' ), |
| 7848 | 'type' => Controls_Manager::SLIDER, |
| 7849 | 'size_units' => [ 'px', '%' ], |
| 7850 | 'range' => [ |
| 7851 | 'px' => [ |
| 7852 | 'min' => 0, |
| 7853 | 'max' => 100, |
| 7854 | 'step' => 1, |
| 7855 | ], |
| 7856 | '%' => [ |
| 7857 | 'min' => 0, |
| 7858 | 'max' => 100, |
| 7859 | 'step' => 1, |
| 7860 | ], |
| 7861 | ], |
| 7862 | 'selectors' => [ |
| 7863 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 7864 | ], |
| 7865 | 'condition' => [ |
| 7866 | 'dots' => 'yes', |
| 7867 | ], |
| 7868 | ] |
| 7869 | ); |
| 7870 | |
| 7871 | $ref->add_responsive_control( |
| 7872 | 'dots_width', |
| 7873 | [ |
| 7874 | 'label' => esc_html__( 'Dots Width', 'the-post-grid' ), |
| 7875 | 'type' => Controls_Manager::SLIDER, |
| 7876 | 'size_units' => [ 'px' ], |
| 7877 | 'range' => [ |
| 7878 | 'px' => [ |
| 7879 | 'min' => 0, |
| 7880 | 'max' => 200, |
| 7881 | 'step' => 1, |
| 7882 | ], |
| 7883 | ], |
| 7884 | 'selectors' => [ |
| 7885 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'width: {{SIZE}}{{UNIT}};', |
| 7886 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active' => 'width: calc({{SIZE}}{{UNIT}} + 15px);', |
| 7887 | ], |
| 7888 | 'condition' => [ |
| 7889 | 'dots' => 'yes', |
| 7890 | ], |
| 7891 | ] |
| 7892 | ); |
| 7893 | |
| 7894 | $ref->add_responsive_control( |
| 7895 | 'dots_height', |
| 7896 | [ |
| 7897 | 'label' => esc_html__( 'Dots Height', 'the-post-grid' ), |
| 7898 | 'type' => Controls_Manager::SLIDER, |
| 7899 | 'size_units' => [ 'px' ], |
| 7900 | 'range' => [ |
| 7901 | 'px' => [ |
| 7902 | 'min' => 0, |
| 7903 | 'max' => 200, |
| 7904 | 'step' => 1, |
| 7905 | ], |
| 7906 | ], |
| 7907 | 'selectors' => [ |
| 7908 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'height: {{SIZE}}{{UNIT}}', |
| 7909 | ], |
| 7910 | 'condition' => [ |
| 7911 | 'dots' => 'yes', |
| 7912 | ], |
| 7913 | ] |
| 7914 | ); |
| 7915 | |
| 7916 | |
| 7917 | $ref->add_responsive_control( |
| 7918 | 'dots_margin', |
| 7919 | [ |
| 7920 | 'label' => esc_html__( 'Dots Margin', 'the-post-grid' ), |
| 7921 | 'type' => Controls_Manager::SLIDER, |
| 7922 | 'size_units' => [ 'px' ], |
| 7923 | 'range' => [ |
| 7924 | 'px' => [ |
| 7925 | 'min' => 0, |
| 7926 | 'max' => 50, |
| 7927 | 'step' => 1, |
| 7928 | ], |
| 7929 | ], |
| 7930 | 'selectors' => [ |
| 7931 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'margin-left: {{SIZE}}{{UNIT}}; margin-right: {{SIZE}}{{UNIT}}', |
| 7932 | ], |
| 7933 | 'condition' => [ |
| 7934 | 'dots' => 'yes', |
| 7935 | ], |
| 7936 | ] |
| 7937 | ); |
| 7938 | |
| 7939 | $ref->add_responsive_control( |
| 7940 | 'dots_position', |
| 7941 | [ |
| 7942 | 'label' => esc_html__( 'Dots Y Position', 'the-post-grid' ), |
| 7943 | 'type' => Controls_Manager::SLIDER, |
| 7944 | 'size_units' => [ 'px' ], |
| 7945 | 'range' => [ |
| 7946 | 'px' => [ |
| 7947 | 'min' => - 150, |
| 7948 | 'max' => 150, |
| 7949 | 'step' => 1, |
| 7950 | ], |
| 7951 | ], |
| 7952 | 'selectors' => [ |
| 7953 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination' => 'bottom: {{SIZE}}{{UNIT}} !important ;', |
| 7954 | ], |
| 7955 | 'condition' => [ |
| 7956 | 'dots' => 'yes', |
| 7957 | ], |
| 7958 | ] |
| 7959 | ); |
| 7960 | |
| 7961 | |
| 7962 | //TODO: Dots Tab Start |
| 7963 | $ref->start_controls_tabs( |
| 7964 | 'dots_style_tabs', |
| 7965 | [ |
| 7966 | 'condition' => [ |
| 7967 | 'dots' => 'yes', |
| 7968 | ], |
| 7969 | ] |
| 7970 | ); |
| 7971 | |
| 7972 | $ref->start_controls_tab( |
| 7973 | 'dots_style_normal_tab', |
| 7974 | [ |
| 7975 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 7976 | ] |
| 7977 | ); |
| 7978 | |
| 7979 | $ref->add_control( |
| 7980 | 'dots_color', |
| 7981 | [ |
| 7982 | 'type' => Controls_Manager::COLOR, |
| 7983 | 'label' => esc_html__( 'Dots Color', 'the-post-grid' ), |
| 7984 | 'selectors' => [ |
| 7985 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'background-color: {{VALUE}}', |
| 7986 | ], |
| 7987 | 'condition' => [ |
| 7988 | 'dots' => 'yes', |
| 7989 | ], |
| 7990 | ] |
| 7991 | ); |
| 7992 | |
| 7993 | $ref->add_control( |
| 7994 | 'dots_border_color', |
| 7995 | [ |
| 7996 | 'type' => Controls_Manager::COLOR, |
| 7997 | 'label' => esc_html__( 'Active Dots Color', 'the-post-grid' ), |
| 7998 | 'selectors' => [ |
| 7999 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active' => 'background-color: {{VALUE}}', |
| 8000 | ], |
| 8001 | 'condition' => [ |
| 8002 | 'dots' => 'yes', |
| 8003 | ], |
| 8004 | ] |
| 8005 | ); |
| 8006 | |
| 8007 | $ref->add_control( |
| 8008 | 'dots_wrap_bg', |
| 8009 | [ |
| 8010 | 'type' => Controls_Manager::COLOR, |
| 8011 | 'label' => esc_html__( 'Dots Wrapper Background', 'the-post-grid' ), |
| 8012 | 'selectors' => [ |
| 8013 | '{{WRAPPER}}.slider-dots-style-background .tpg-el-main-wrapper .swiper-pagination' => 'background-color: {{VALUE}}', |
| 8014 | ], |
| 8015 | 'condition' => [ |
| 8016 | 'dots' => 'yes', |
| 8017 | 'dots_style' => 'background', |
| 8018 | ], |
| 8019 | ] |
| 8020 | ); |
| 8021 | |
| 8022 | |
| 8023 | $ref->end_controls_tab(); |
| 8024 | |
| 8025 | $ref->start_controls_tab( |
| 8026 | 'dots_style_hover_tab', |
| 8027 | [ |
| 8028 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 8029 | ] |
| 8030 | ); |
| 8031 | |
| 8032 | $ref->add_control( |
| 8033 | 'dots_color_hover', |
| 8034 | [ |
| 8035 | 'type' => Controls_Manager::COLOR, |
| 8036 | 'label' => esc_html__( 'Dots Color - Hover', 'the-post-grid' ), |
| 8037 | 'selectors' => [ |
| 8038 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet:hover' => 'background-color: {{VALUE}}', |
| 8039 | ], |
| 8040 | 'condition' => [ |
| 8041 | 'dots' => 'yes', |
| 8042 | ], |
| 8043 | ] |
| 8044 | ); |
| 8045 | |
| 8046 | $ref->end_controls_tab(); |
| 8047 | |
| 8048 | $ref->end_controls_tabs(); |
| 8049 | |
| 8050 | $ref->end_controls_section(); |
| 8051 | } |
| 8052 | |
| 8053 | |
| 8054 | /** |
| 8055 | * Link Style |
| 8056 | * |
| 8057 | * @param $ref |
| 8058 | */ |
| 8059 | |
| 8060 | public static function linkStyle( $ref ) { |
| 8061 | $ref->start_controls_section( |
| 8062 | 'linkStyle', |
| 8063 | [ |
| 8064 | 'label' => esc_html__( 'Popup Style', 'the-post-grid' ), |
| 8065 | 'tab' => Controls_Manager::TAB_STYLE, |
| 8066 | 'condition' => [ |
| 8067 | 'post_link_type' => [ 'popup', 'multi_popup' ], |
| 8068 | ], |
| 8069 | ] |
| 8070 | ); |
| 8071 | |
| 8072 | $ref->add_control( |
| 8073 | 'popup_head_bg', |
| 8074 | [ |
| 8075 | 'label' => esc_html__( 'Header Background', 'the-post-grid' ), |
| 8076 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8077 | 'selectors' => [ |
| 8078 | 'body .rt-popup-wrap .rt-popup-navigation-wrap' => 'background-color: {{VALUE}}', |
| 8079 | ], |
| 8080 | ] |
| 8081 | ); |
| 8082 | |
| 8083 | $ref->add_control( |
| 8084 | 'popup_head_txt_color', |
| 8085 | [ |
| 8086 | 'label' => esc_html__( 'Header Text Color', 'the-post-grid' ), |
| 8087 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8088 | 'selectors' => [ |
| 8089 | 'body #rt-popup-wrap .rt-popup-singlePage-counter' => 'color: {{VALUE}}', |
| 8090 | ], |
| 8091 | ] |
| 8092 | ); |
| 8093 | |
| 8094 | $ref->add_control( |
| 8095 | 'popup_title_color', |
| 8096 | [ |
| 8097 | 'label' => esc_html__( 'Popup Title Color', 'the-post-grid' ), |
| 8098 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8099 | 'selectors' => [ |
| 8100 | 'body .md-content .rt-md-content-holder > .md-header .entry-title' => 'color: {{VALUE}}', |
| 8101 | 'body .rt-popup-content .rt-tpg-container h1.entry-title' => 'color: {{VALUE}}', |
| 8102 | ], |
| 8103 | |
| 8104 | ] |
| 8105 | ); |
| 8106 | |
| 8107 | |
| 8108 | $ref->add_control( |
| 8109 | 'popup_meta_color', |
| 8110 | [ |
| 8111 | 'label' => esc_html__( 'Popup Meta Color', 'the-post-grid' ), |
| 8112 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8113 | 'selectors' => [ |
| 8114 | 'body .md-content .rt-md-content-holder > .md-header .post-meta-user *' => 'color: {{VALUE}}', |
| 8115 | 'body .rt-popup-content .rt-tpg-container .post-meta-user *' => 'color: {{VALUE}}', |
| 8116 | ], |
| 8117 | |
| 8118 | ] |
| 8119 | ); |
| 8120 | |
| 8121 | $ref->add_control( |
| 8122 | 'popup_content_color', |
| 8123 | [ |
| 8124 | 'label' => esc_html__( 'Popup Content Color', 'the-post-grid' ), |
| 8125 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8126 | 'selectors' => [ |
| 8127 | 'body .md-content .rt-md-content *' => 'color: {{VALUE}}', |
| 8128 | 'body .rt-popup-content .rt-tpg-container .tpg-content *' => 'color: {{VALUE}}', |
| 8129 | ], |
| 8130 | |
| 8131 | ] |
| 8132 | ); |
| 8133 | |
| 8134 | $ref->add_control( |
| 8135 | 'popup_bg', |
| 8136 | [ |
| 8137 | 'label' => esc_html__( 'Popup Background', 'the-post-grid' ), |
| 8138 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8139 | 'selectors' => [ |
| 8140 | 'body .md-content, body #rt-popup-wrap .rt-popup-content' => 'background-color: {{VALUE}}', |
| 8141 | ], |
| 8142 | |
| 8143 | ] |
| 8144 | ); |
| 8145 | |
| 8146 | |
| 8147 | $ref->end_controls_section(); |
| 8148 | } |
| 8149 | |
| 8150 | |
| 8151 | /** |
| 8152 | * Slider thumb Settings for layout- 11, 12 |
| 8153 | * |
| 8154 | * @param $ref |
| 8155 | */ |
| 8156 | |
| 8157 | public static function slider_thumb_style( $ref ) { |
| 8158 | $ref->start_controls_section( |
| 8159 | 'slider_thumb_style', |
| 8160 | [ |
| 8161 | 'label' => esc_html__( 'Slider', 'the-post-grid' ), |
| 8162 | 'tab' => Controls_Manager::TAB_STYLE, |
| 8163 | 'condition' => [ |
| 8164 | 'slider_layout' => [ 'slider-layout11', 'slider-layout12' ], |
| 8165 | ], |
| 8166 | ] |
| 8167 | ); |
| 8168 | |
| 8169 | //TODO: Crative slider style: |
| 8170 | $ref->add_control( |
| 8171 | 'scroll_bar_color', |
| 8172 | [ |
| 8173 | 'type' => Controls_Manager::COLOR, |
| 8174 | 'label' => esc_html__( 'Scroll Foreground Color', 'the-post-grid' ), |
| 8175 | 'selectors' => [ |
| 8176 | '{{WRAPPER}} .tpg-el-main-wrapper .swiper-thumb-pagination .swiper-pagination-progressbar-fill' => 'background-color: {{VALUE}}', |
| 8177 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper .post-thumbnail-wrap .p-thumbnail::before' => 'background-color: {{VALUE}}', |
| 8178 | ], |
| 8179 | ] |
| 8180 | ); |
| 8181 | |
| 8182 | |
| 8183 | $ref->add_control( |
| 8184 | 'scroll_bar_bg_color', |
| 8185 | [ |
| 8186 | 'type' => Controls_Manager::COLOR, |
| 8187 | 'label' => esc_html__( 'Scroll Background Color', 'the-post-grid' ), |
| 8188 | 'selectors' => [ |
| 8189 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-thumb-main-wrapper .swiper-pagination-progressbar' => 'background-color: {{VALUE}}', |
| 8190 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper::before' => 'background-color: {{VALUE}};opacity:1;', |
| 8191 | ], |
| 8192 | ] |
| 8193 | ); |
| 8194 | |
| 8195 | $ref->add_control( |
| 8196 | 'thumb_font_color', |
| 8197 | [ |
| 8198 | 'type' => Controls_Manager::COLOR, |
| 8199 | 'label' => esc_html__( 'Thumb Font Color', 'the-post-grid' ), |
| 8200 | 'selectors' => [ |
| 8201 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .p-content *' => 'color: {{VALUE}}', |
| 8202 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .swiper-thumb-wrapper .swiper-wrapper .p-content *' => 'color: {{VALUE}}', |
| 8203 | ], |
| 8204 | ] |
| 8205 | ); |
| 8206 | |
| 8207 | $ref->add_control( |
| 8208 | 'slider_thumb_bg', |
| 8209 | [ |
| 8210 | 'type' => Controls_Manager::COLOR, |
| 8211 | 'label' => esc_html__( 'Thumb Background', 'the-post-grid' ), |
| 8212 | 'selectors' => [ |
| 8213 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .p-thumbnail img' => 'background-color: {{VALUE}}', |
| 8214 | ], |
| 8215 | 'condition' => [ |
| 8216 | 'slider_layout' => [ 'slider-layout11' ], |
| 8217 | ], |
| 8218 | ] |
| 8219 | ); |
| 8220 | $ref->add_control( |
| 8221 | 'slider_thumb_bg_active', |
| 8222 | [ |
| 8223 | 'type' => Controls_Manager::COLOR, |
| 8224 | 'label' => esc_html__( 'Thumb Active/Hover Background', 'the-post-grid' ), |
| 8225 | 'selectors' => [ |
| 8226 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .swiper-slide:hover .p-thumbnail img' => 'background-color: {{VALUE}}', |
| 8227 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .swiper-slide-thumb-active .p-thumbnail img' => 'background-color: {{VALUE}}', |
| 8228 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .post-thumbnail-wrap::before' => 'background-color: {{VALUE}}', |
| 8229 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper .post-thumbnail-wrap .p-thumbnail' => 'background-color: {{VALUE}}', |
| 8230 | ], |
| 8231 | ] |
| 8232 | ); |
| 8233 | |
| 8234 | $ref->add_group_control( |
| 8235 | \Elementor\Group_Control_Background::get_type(), |
| 8236 | [ |
| 8237 | 'name' => 'thumb_wrapper_bg', |
| 8238 | 'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ), |
| 8239 | 'fields_options' => [ |
| 8240 | 'background' => [ |
| 8241 | 'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ), |
| 8242 | ], |
| 8243 | ], |
| 8244 | 'types' => [ 'classic', 'gradient' ], |
| 8245 | 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .slider-thumb-main-wrapper, {{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper', |
| 8246 | 'exclude' => [ 'image' ], |
| 8247 | ] |
| 8248 | ); |
| 8249 | |
| 8250 | $ref->end_controls_section(); |
| 8251 | } |
| 8252 | |
| 8253 | |
| 8254 | /** |
| 8255 | * Advanced Custom Field ACF Style |
| 8256 | * |
| 8257 | * @param $ref |
| 8258 | */ |
| 8259 | |
| 8260 | public static function tpg_acf_style( $ref ) { |
| 8261 | $cf = Fns::is_acf(); |
| 8262 | if ( ! $cf || ! rtTPG()->hasPro() ) { |
| 8263 | return; |
| 8264 | } |
| 8265 | |
| 8266 | $prefix = $ref->prefix; |
| 8267 | $ref->start_controls_section( |
| 8268 | 'tgp_acf_style', |
| 8269 | [ |
| 8270 | 'label' => esc_html__( 'Advanced Custom Field (ACF)', 'the-post-grid' ), |
| 8271 | 'tab' => Controls_Manager::TAB_STYLE, |
| 8272 | 'condition' => [ |
| 8273 | 'show_acf' => 'show', |
| 8274 | $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 8275 | ], |
| 8276 | ] |
| 8277 | ); |
| 8278 | |
| 8279 | self::get_tpg_acf_style( $ref ); |
| 8280 | |
| 8281 | $ref->end_controls_section(); |
| 8282 | } |
| 8283 | |
| 8284 | public static function get_tpg_acf_style( $ref, $hover_control = true ) { |
| 8285 | $ref->add_group_control( |
| 8286 | \Elementor\Group_Control_Typography::get_type(), |
| 8287 | [ |
| 8288 | 'name' => 'acf_group_title_typography', |
| 8289 | 'label' => esc_html__( 'Group Title Typography', 'the-post-grid' ), |
| 8290 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-group-title', |
| 8291 | ] |
| 8292 | ); |
| 8293 | |
| 8294 | $ref->add_group_control( |
| 8295 | \Elementor\Group_Control_Typography::get_type(), |
| 8296 | [ |
| 8297 | 'name' => 'acf_typography', |
| 8298 | 'label' => esc_html__( 'ACF Fields Typography', 'the-post-grid' ), |
| 8299 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-fields', |
| 8300 | ] |
| 8301 | ); |
| 8302 | |
| 8303 | $ref->add_control( |
| 8304 | 'acf_label_style', |
| 8305 | [ |
| 8306 | 'label' => esc_html__( 'Label Style', 'the-post-grid' ), |
| 8307 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 8308 | 'default' => 'inline', |
| 8309 | 'options' => [ |
| 8310 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 8311 | 'inline' => esc_html__( 'Inline', 'the-post-grid' ), |
| 8312 | 'block' => esc_html__( 'Block', 'the-post-grid' ), |
| 8313 | ], |
| 8314 | 'condition' => [ |
| 8315 | 'cf_show_only_value' => 'yes', |
| 8316 | ], |
| 8317 | 'render_type' => 'template', |
| 8318 | 'prefix_class' => 'act-label-style-', |
| 8319 | ] |
| 8320 | ); |
| 8321 | |
| 8322 | $ref->add_responsive_control( |
| 8323 | 'acf_label_width', |
| 8324 | [ |
| 8325 | 'label' => esc_html__( 'Label Min Width', 'the-post-grid' ), |
| 8326 | 'type' => Controls_Manager::SLIDER, |
| 8327 | 'size_units' => [ 'px' ], |
| 8328 | 'range' => [ |
| 8329 | 'px' => [ |
| 8330 | 'min' => 0, |
| 8331 | 'max' => 500, |
| 8332 | 'step' => 1, |
| 8333 | ], |
| 8334 | ], |
| 8335 | 'condition' => [ |
| 8336 | 'acf_label_style' => 'default', |
| 8337 | ], |
| 8338 | 'selectors' => [ |
| 8339 | '{{WRAPPER}} .tgp-cf-field-label' => 'min-width: {{SIZE}}{{UNIT}};', |
| 8340 | ], |
| 8341 | ] |
| 8342 | ); |
| 8343 | |
| 8344 | $ref->add_control( |
| 8345 | 'acf_alignment', |
| 8346 | [ |
| 8347 | 'label' => esc_html__( 'Text Align', 'the-post-grid' ), |
| 8348 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 8349 | 'options' => [ |
| 8350 | 'left' => [ |
| 8351 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 8352 | 'icon' => 'eicon-text-align-left', |
| 8353 | ], |
| 8354 | 'center' => [ |
| 8355 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 8356 | 'icon' => 'eicon-text-align-center', |
| 8357 | ], |
| 8358 | 'right' => [ |
| 8359 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 8360 | 'icon' => 'eicon-text-align-right', |
| 8361 | ], |
| 8362 | ], |
| 8363 | 'prefix_class' => 'tpg-acf-align-', |
| 8364 | 'toggle' => true, |
| 8365 | 'condition' => [ |
| 8366 | 'grid_layout!' => [ 'grid-layout7', 'slider-layout4' ], |
| 8367 | ], |
| 8368 | |
| 8369 | ] |
| 8370 | ); |
| 8371 | |
| 8372 | |
| 8373 | if ( $hover_control ) { |
| 8374 | //Start Tab |
| 8375 | $ref->start_controls_tabs( |
| 8376 | 'acf_style_tabs' |
| 8377 | ); |
| 8378 | |
| 8379 | //Normal Tab |
| 8380 | $ref->start_controls_tab( |
| 8381 | 'acf_style_normal_tab', |
| 8382 | [ |
| 8383 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 8384 | ] |
| 8385 | ); |
| 8386 | } |
| 8387 | $ref->add_control( |
| 8388 | 'acf_group_title_color', |
| 8389 | [ |
| 8390 | 'label' => esc_html__( 'Group Title Color', 'the-post-grid' ), |
| 8391 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8392 | 'selectors' => [ |
| 8393 | '{{WRAPPER}} .acf-custom-field-wrap .tpg-cf-group-title' => 'color: {{VALUE}}', |
| 8394 | ], |
| 8395 | 'condition' => [ |
| 8396 | 'cf_hide_group_title' => 'yes', |
| 8397 | ], |
| 8398 | ] |
| 8399 | ); |
| 8400 | |
| 8401 | $ref->add_control( |
| 8402 | 'acf_label_color', |
| 8403 | [ |
| 8404 | 'label' => esc_html__( 'Label Color', 'the-post-grid' ), |
| 8405 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8406 | 'selectors' => [ |
| 8407 | '{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-label' => 'color: {{VALUE}}', |
| 8408 | ], |
| 8409 | 'condition' => [ |
| 8410 | 'cf_show_only_value' => 'yes', |
| 8411 | ], |
| 8412 | ] |
| 8413 | ); |
| 8414 | |
| 8415 | $ref->add_control( |
| 8416 | 'acf_value_color', |
| 8417 | [ |
| 8418 | 'label' => esc_html__( 'Value Color', 'the-post-grid' ), |
| 8419 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8420 | 'selectors' => [ |
| 8421 | '{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-value' => 'color: {{VALUE}}', |
| 8422 | ], |
| 8423 | ] |
| 8424 | ); |
| 8425 | |
| 8426 | if ( $hover_control ) { |
| 8427 | $ref->end_controls_tab(); |
| 8428 | |
| 8429 | //Hover Tab |
| 8430 | $ref->start_controls_tab( |
| 8431 | 'acf_style_hover_tab', |
| 8432 | [ |
| 8433 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 8434 | ] |
| 8435 | ); |
| 8436 | |
| 8437 | $ref->add_control( |
| 8438 | 'acf_group_title_color_hover', |
| 8439 | [ |
| 8440 | 'label' => esc_html__( 'Group Title Color - Hover', 'the-post-grid' ), |
| 8441 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8442 | 'selectors' => [ |
| 8443 | '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tpg-cf-group-title' => 'color: {{VALUE}}', |
| 8444 | ], |
| 8445 | 'condition' => [ |
| 8446 | 'cf_hide_group_title' => 'yes', |
| 8447 | ], |
| 8448 | ] |
| 8449 | ); |
| 8450 | |
| 8451 | $ref->add_control( |
| 8452 | 'acf_label_color_hover', |
| 8453 | [ |
| 8454 | 'label' => esc_html__( 'Label Color - Hover', 'the-post-grid' ), |
| 8455 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8456 | 'selectors' => [ |
| 8457 | '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-label' => 'color: {{VALUE}}', |
| 8458 | ], |
| 8459 | 'condition' => [ |
| 8460 | 'cf_show_only_value' => 'yes', |
| 8461 | ], |
| 8462 | ] |
| 8463 | ); |
| 8464 | |
| 8465 | $ref->add_control( |
| 8466 | 'acf_value_color_hover', |
| 8467 | [ |
| 8468 | 'label' => esc_html__( 'Value Color - Hover', 'the-post-grid' ), |
| 8469 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8470 | 'selectors' => [ |
| 8471 | '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-value' => 'color: {{VALUE}}', |
| 8472 | ], |
| 8473 | ] |
| 8474 | ); |
| 8475 | |
| 8476 | $ref->end_controls_tab(); |
| 8477 | |
| 8478 | $ref->end_controls_tabs(); |
| 8479 | //End Tab |
| 8480 | } |
| 8481 | } |
| 8482 | } |