widgets
3 years ago
base.php
3 years ago
rtTPGElementorHelper.php
3 years ago
rtTPGElementorQuery.php
3 years ago
rtTPGElementorHelper.php
8145 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 Settings |
| 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 | //TODO: Advance Filter. |
| 105 | $ref->add_control( |
| 106 | 'advanced_filters_heading', |
| 107 | [ |
| 108 | 'label' => esc_html__( 'Advanced Filters:', 'the-post-grid' ), |
| 109 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 110 | 'separator' => 'before', |
| 111 | 'classes' => 'tpg-control-type-heading', |
| 112 | ] |
| 113 | ); |
| 114 | |
| 115 | foreach ( $taxonomies as $taxonomy => $object ) { |
| 116 | if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) ) |
| 117 | || in_array( $taxonomy, Custom_Widget_Base::get_excluded_taxonomy() ) |
| 118 | ) { |
| 119 | continue; |
| 120 | } |
| 121 | $ref->add_control( |
| 122 | $taxonomy . '_ids', |
| 123 | [ |
| 124 | 'label' => esc_html__( "By ", 'the-post-grid' ) . $object->label, |
| 125 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 126 | 'label_block' => true, |
| 127 | 'multiple' => true, |
| 128 | 'options' => $ref->tpg_get_categories_by_id( $taxonomy ), |
| 129 | 'condition' => [ |
| 130 | 'post_type' => $object->object_type, |
| 131 | ], |
| 132 | ] |
| 133 | ); |
| 134 | } |
| 135 | |
| 136 | $ref->add_control( |
| 137 | 'relation', |
| 138 | [ |
| 139 | 'label' => esc_html__( 'Taxonomies Relation', 'the-post-grid' ), |
| 140 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 141 | 'default' => 'OR', |
| 142 | 'options' => [ |
| 143 | 'OR' => esc_html__( 'OR', 'the-post-grid' ), |
| 144 | 'AND' => esc_html__( 'AND', 'the-post-grid' ), |
| 145 | 'NOT IN' => esc_html__( 'NOT IN', '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 | |
| 201 | if ( rtTPG()->hasPro() ) { |
| 202 | $prderby_pro_opt = [ |
| 203 | 'rand' => esc_html__( 'Random order', 'the-post-grid' ), |
| 204 | ]; |
| 205 | $orderby_opt = array_merge( $orderby_opt, $prderby_pro_opt ); |
| 206 | } |
| 207 | |
| 208 | $ref->add_control( |
| 209 | 'orderby', |
| 210 | [ |
| 211 | 'label' => esc_html__( 'Order by', 'the-post-grid' ), |
| 212 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 213 | 'options' => $orderby_opt, |
| 214 | 'default' => 'date', |
| 215 | 'description' => $ref->get_pro_message( 'Random Order.' ), |
| 216 | ] |
| 217 | ); |
| 218 | |
| 219 | $ref->add_control( |
| 220 | 'order', |
| 221 | [ |
| 222 | 'label' => esc_html__( 'Sort order', 'the-post-grid' ), |
| 223 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 224 | 'options' => [ |
| 225 | 'ASC' => esc_html__( 'ASC', 'the-post-grid' ), |
| 226 | 'DESC' => esc_html__( 'DESC', 'the-post-grid' ), |
| 227 | ], |
| 228 | 'default' => 'DESC', |
| 229 | 'condition' => [ |
| 230 | 'orderby!' => 'menu_order', |
| 231 | ], |
| 232 | ] |
| 233 | ); |
| 234 | |
| 235 | $ref->add_control( |
| 236 | 'post_status', |
| 237 | [ |
| 238 | 'label' => esc_html__( 'Post Status', 'the-post-grid' ), |
| 239 | 'type' => Controls_Manager::SELECT, |
| 240 | 'options' => Options::rtTPGPostStatus(), |
| 241 | 'default' => 'publish', |
| 242 | ] |
| 243 | ); |
| 244 | |
| 245 | |
| 246 | $ref->add_control( |
| 247 | 'ignore_sticky_posts', |
| 248 | [ |
| 249 | 'label' => esc_html__( 'Ignore sticky posts at the top', 'the-post-grid' ) . $ref->pro_label, |
| 250 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 251 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 252 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 253 | 'return_value' => 'yes', |
| 254 | 'default' => 'no', |
| 255 | 'disabled' => true, |
| 256 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 257 | ] |
| 258 | ); |
| 259 | |
| 260 | $ref->add_control( |
| 261 | 'no_posts_found_text', |
| 262 | [ |
| 263 | 'label' => esc_html__( 'No post found Text', 'the-post-grid' ), |
| 264 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 265 | 'default' => esc_html__( 'No posts found.', 'the-post-grid' ), |
| 266 | 'placeholder' => esc_html__( 'Enter No post found', 'the-post-grid' ), |
| 267 | 'separator' => 'before', |
| 268 | ] |
| 269 | ); |
| 270 | |
| 271 | |
| 272 | $ref->end_controls_section(); |
| 273 | } |
| 274 | |
| 275 | |
| 276 | /** |
| 277 | * @param $ref |
| 278 | * @param $layout_type |
| 279 | * |
| 280 | * @return void |
| 281 | */ |
| 282 | public static function query_builder( $ref, $layout_type = '' ) { |
| 283 | $post_types = Fns::get_post_types(); |
| 284 | |
| 285 | $taxonomies = get_object_taxonomies( 'post', 'object' ); |
| 286 | |
| 287 | do_action( 'rt_tpg_el_query_build', $ref ); |
| 288 | $ref->start_controls_section( |
| 289 | 'rt_post_query', |
| 290 | [ |
| 291 | 'label' => esc_html__( 'Query Build', 'the-post-grid' ), |
| 292 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 293 | ] |
| 294 | ); |
| 295 | |
| 296 | $ref->add_control( |
| 297 | 'post_limit', |
| 298 | [ |
| 299 | 'label' => esc_html__( 'Posts per page', 'the-post-grid' ), |
| 300 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 301 | 'description' => esc_html__( 'The number of posts to show. Enter -1 to show all found posts.', 'the-post-grid' ), |
| 302 | ] |
| 303 | ); |
| 304 | |
| 305 | |
| 306 | if ( 'single' == $layout_type ) { |
| 307 | $get_all_taxonomy = []; |
| 308 | foreach ( $taxonomies as $taxonomy => $object ) { |
| 309 | if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) ) |
| 310 | || in_array( $taxonomy, Custom_Widget_Base::get_excluded_taxonomy() ) |
| 311 | ) { |
| 312 | continue; |
| 313 | } |
| 314 | $get_all_taxonomy[ $object->name ] = $object->label; |
| 315 | } |
| 316 | |
| 317 | $ref->add_control( |
| 318 | 'taxonomy_lists', |
| 319 | [ |
| 320 | 'label' => esc_html__( 'Select a Taxonomy for relation', 'the-post-grid' ), |
| 321 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 322 | 'default' => 'category', |
| 323 | 'options' => $get_all_taxonomy, |
| 324 | ] |
| 325 | ); |
| 326 | |
| 327 | $orderby_opt = [ |
| 328 | 'date' => esc_html__( 'Date', 'the-post-grid' ), |
| 329 | 'ID' => esc_html__( 'Order by post ID', 'the-post-grid' ), |
| 330 | 'author' => esc_html__( 'Author', 'the-post-grid' ), |
| 331 | 'title' => esc_html__( 'Title', 'the-post-grid' ), |
| 332 | 'modified' => esc_html__( 'Last modified date', 'the-post-grid' ), |
| 333 | 'parent' => esc_html__( 'Post parent ID', 'the-post-grid' ), |
| 334 | 'comment_count' => esc_html__( 'Number of comments', 'the-post-grid' ), |
| 335 | 'menu_order' => esc_html__( 'Menu order', 'the-post-grid' ), |
| 336 | 'rand' => esc_html__( 'Random order', 'the-post-grid' ), |
| 337 | |
| 338 | ]; |
| 339 | |
| 340 | $ref->add_control( |
| 341 | 'orderby', |
| 342 | [ |
| 343 | 'label' => esc_html__( 'Order by', 'the-post-grid' ), |
| 344 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 345 | 'options' => $orderby_opt, |
| 346 | 'default' => 'date', |
| 347 | ] |
| 348 | ); |
| 349 | |
| 350 | $ref->add_control( |
| 351 | 'order', |
| 352 | [ |
| 353 | 'label' => esc_html__( 'Sort order', 'the-post-grid' ), |
| 354 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 355 | 'options' => [ |
| 356 | 'ASC' => esc_html__( 'ASC', 'the-post-grid' ), |
| 357 | 'DESC' => esc_html__( 'DESC', 'the-post-grid' ), |
| 358 | ], |
| 359 | 'default' => 'DESC', |
| 360 | 'condition' => [ |
| 361 | 'orderby!' => 'menu_order', |
| 362 | ], |
| 363 | ] |
| 364 | ); |
| 365 | } else { |
| 366 | $ref->add_control( |
| 367 | 'post_id', |
| 368 | [ |
| 369 | 'label' => esc_html__( 'Include only', 'the-post-grid' ), |
| 370 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 371 | 'description' => esc_html__( 'Enter the post IDs separated by comma for include', 'the-post-grid' ), |
| 372 | 'placeholder' => 'Eg. 10, 15, 17', |
| 373 | ] |
| 374 | ); |
| 375 | |
| 376 | $ref->add_control( |
| 377 | 'exclude', |
| 378 | [ |
| 379 | 'label' => esc_html__( 'Exclude', 'the-post-grid' ), |
| 380 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 381 | 'description' => esc_html__( 'Enter the post IDs separated by comma for exclude', 'the-post-grid' ), |
| 382 | 'placeholder' => 'Eg. 12, 13', |
| 383 | ] |
| 384 | ); |
| 385 | |
| 386 | $ref->add_control( |
| 387 | 'offset', |
| 388 | [ |
| 389 | 'label' => esc_html__( 'Offset', 'the-post-grid' ), |
| 390 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 391 | 'placeholder' => esc_html__( 'Enter Post offset', 'the-post-grid' ), |
| 392 | 'description' => esc_html__( 'Number of posts to skip. The offset parameter is ignored when post limit => -1 is used.', 'the-post-grid' ), |
| 393 | ] |
| 394 | ); |
| 395 | |
| 396 | $ref->add_control( |
| 397 | 'no_posts_found_text_archive', |
| 398 | [ |
| 399 | 'label' => esc_html__( 'No post found Text', 'the-post-grid' ), |
| 400 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 401 | 'default' => esc_html__( 'No posts found.', 'the-post-grid' ), |
| 402 | 'placeholder' => esc_html__( 'Enter No post found', 'the-post-grid' ), |
| 403 | 'separator' => 'before', |
| 404 | ] |
| 405 | ); |
| 406 | } |
| 407 | $ref->end_controls_section(); |
| 408 | } |
| 409 | |
| 410 | /** |
| 411 | * Grid Layout Settings |
| 412 | * |
| 413 | * @param $ref |
| 414 | */ |
| 415 | public static function grid_layouts( $ref, $layout_type = '' ) { |
| 416 | $prefix = $ref->prefix; |
| 417 | |
| 418 | $ref->start_controls_section( |
| 419 | $prefix . '_layout_settings', |
| 420 | [ |
| 421 | 'label' => esc_html__( 'Layout', 'the-post-grid' ), |
| 422 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 423 | ] |
| 424 | ); |
| 425 | |
| 426 | if ( 'grid' === $prefix ) { |
| 427 | $layout_class = 'grid-layout'; |
| 428 | $layout_options = [ |
| 429 | $prefix . '-layout1' => [ |
| 430 | 'title' => esc_html__( 'Layout 1', 'the-post-grid' ), |
| 431 | ], |
| 432 | $prefix . '-layout3' => [ |
| 433 | 'title' => esc_html__( 'Layout 2', 'the-post-grid' ), |
| 434 | ], |
| 435 | $prefix . '-layout4' => [ |
| 436 | 'title' => esc_html__( 'Layout 3', 'the-post-grid' ), |
| 437 | ], |
| 438 | $prefix . '-layout2' => [ |
| 439 | 'title' => esc_html__( 'Layout 4', 'the-post-grid' ), |
| 440 | ], |
| 441 | $prefix . '-layout5' => [ |
| 442 | 'title' => esc_html__( 'Layout 5', 'the-post-grid' ), |
| 443 | ], |
| 444 | $prefix . '-layout5-2' => [ |
| 445 | 'title' => esc_html__( 'Layout 6', 'the-post-grid' ), |
| 446 | ], |
| 447 | $prefix . '-layout6' => [ |
| 448 | 'title' => esc_html__( 'Layout 7', 'the-post-grid' ), |
| 449 | ], |
| 450 | $prefix . '-layout6-2' => [ |
| 451 | 'title' => esc_html__( 'Layout 8', 'the-post-grid' ), |
| 452 | ], |
| 453 | $prefix . '-layout7' => [ |
| 454 | 'title' => esc_html__( 'Gallery', 'the-post-grid' ), |
| 455 | ], |
| 456 | ]; |
| 457 | } |
| 458 | |
| 459 | if ( 'grid_hover' === $prefix ) { |
| 460 | $layout_class = 'grid-hover-layout'; |
| 461 | $layout_options = [ |
| 462 | $prefix . '-layout1' => [ |
| 463 | 'title' => esc_html__( 'Layout 1', 'the-post-grid' ), |
| 464 | ], |
| 465 | $prefix . '-layout2' => [ |
| 466 | 'title' => esc_html__( 'Layout 2', 'the-post-grid' ), |
| 467 | ], |
| 468 | $prefix . '-layout3' => [ |
| 469 | 'title' => esc_html__( 'Layout 3', 'the-post-grid' ), |
| 470 | ], |
| 471 | $prefix . '-layout4' => [ |
| 472 | 'title' => esc_html__( 'Layout 4', 'the-post-grid' ), |
| 473 | ], |
| 474 | $prefix . '-layout4-2' => [ |
| 475 | 'title' => esc_html__( 'Layout 5', 'the-post-grid' ), |
| 476 | ], |
| 477 | $prefix . '-layout5' => [ |
| 478 | 'title' => esc_html__( 'Layout 6', 'the-post-grid' ), |
| 479 | ], |
| 480 | $prefix . '-layout5-2' => [ |
| 481 | 'title' => esc_html__( 'Layout 7', 'the-post-grid' ), |
| 482 | ], |
| 483 | $prefix . '-layout6' => [ |
| 484 | 'title' => esc_html__( 'Layout 8', 'the-post-grid' ), |
| 485 | ], |
| 486 | $prefix . '-layout6-2' => [ |
| 487 | 'title' => esc_html__( 'Layout 9', 'the-post-grid' ), |
| 488 | ], |
| 489 | $prefix . '-layout7' => [ |
| 490 | 'title' => esc_html__( 'Layout 10', 'the-post-grid' ), |
| 491 | ], |
| 492 | $prefix . '-layout7-2' => [ |
| 493 | 'title' => esc_html__( 'Layout 11', 'the-post-grid' ), |
| 494 | ], |
| 495 | $prefix . '-layout8' => [ |
| 496 | 'title' => esc_html__( 'Layout 12', 'the-post-grid' ), |
| 497 | ], |
| 498 | $prefix . '-layout9' => [ |
| 499 | 'title' => esc_html__( 'Layout 13', 'the-post-grid' ), |
| 500 | ], |
| 501 | $prefix . '-layout9-2' => [ |
| 502 | 'title' => esc_html__( 'Layout 14', 'the-post-grid' ), |
| 503 | ], |
| 504 | $prefix . '-layout10' => [ |
| 505 | 'title' => esc_html__( 'Layout 15', 'the-post-grid' ), |
| 506 | ], |
| 507 | $prefix . '-layout11' => [ |
| 508 | 'title' => esc_html__( 'Layout 16', 'the-post-grid' ), |
| 509 | ], |
| 510 | ]; |
| 511 | } |
| 512 | |
| 513 | if ( 'slider' === $prefix ) { |
| 514 | $layout_class = 'slider-layout'; |
| 515 | $layout_options = [ |
| 516 | $prefix . '-layout1' => [ |
| 517 | 'title' => esc_html__( 'Layout 1', 'the-post-grid' ), |
| 518 | ], |
| 519 | $prefix . '-layout2' => [ |
| 520 | 'title' => esc_html__( 'Layout 2', 'the-post-grid' ), |
| 521 | ], |
| 522 | $prefix . '-layout3' => [ |
| 523 | 'title' => esc_html__( 'Layout 3', 'the-post-grid' ), |
| 524 | ], |
| 525 | $prefix . '-layout4' => [ |
| 526 | 'title' => esc_html__( 'Layout 4', 'the-post-grid' ), |
| 527 | ], |
| 528 | $prefix . '-layout5' => [ |
| 529 | 'title' => esc_html__( 'Layout 5', 'the-post-grid' ), |
| 530 | ], |
| 531 | $prefix . '-layout6' => [ |
| 532 | 'title' => esc_html__( 'Layout 6', 'the-post-grid' ), |
| 533 | ], |
| 534 | $prefix . '-layout7' => [ |
| 535 | 'title' => esc_html__( 'Layout 7', 'the-post-grid' ), |
| 536 | ], |
| 537 | $prefix . '-layout8' => [ |
| 538 | 'title' => esc_html__( 'Layout 8', 'the-post-grid' ), |
| 539 | ], |
| 540 | $prefix . '-layout9' => [ |
| 541 | 'title' => esc_html__( 'Layout 9', 'the-post-grid' ), |
| 542 | ], |
| 543 | $prefix . '-layout10' => [ |
| 544 | 'title' => esc_html__( 'Layout 10', 'the-post-grid' ), |
| 545 | ], |
| 546 | $prefix . '-layout11' => [ |
| 547 | 'title' => esc_html__( 'Layout 11', 'the-post-grid' ), |
| 548 | ], |
| 549 | $prefix . '-layout12' => [ |
| 550 | 'title' => esc_html__( 'Layout 12', 'the-post-grid' ), |
| 551 | ], |
| 552 | $prefix . '-layout13' => [ |
| 553 | 'title' => esc_html__( 'Layout 13', 'the-post-grid' ), |
| 554 | ], |
| 555 | ]; |
| 556 | |
| 557 | if ( 'single' === $layout_type ) { |
| 558 | $layout_options = array_slice( $layout_options, 0, 9 ); |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | $ref->add_control( |
| 563 | $prefix . '_layout', |
| 564 | [ |
| 565 | 'label' => esc_html__( 'Choose Layout', 'the-post-grid' ), |
| 566 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 567 | 'label_block' => true, |
| 568 | 'options' => $layout_options, |
| 569 | 'toggle' => false, |
| 570 | 'default' => $prefix . '-layout1', |
| 571 | 'style_transfer' => true, |
| 572 | 'classes' => 'tpg-image-select ' . $layout_class . ' ' . $ref->is_post_layout, |
| 573 | ] |
| 574 | ); |
| 575 | |
| 576 | $ref->add_control( |
| 577 | 'layout_options_heading', |
| 578 | [ |
| 579 | 'label' => esc_html__( 'Layout Options:', 'the-post-grid' ), |
| 580 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 581 | 'classes' => 'tpg-control-type-heading', |
| 582 | ] |
| 583 | ); |
| 584 | |
| 585 | |
| 586 | $column_options = [ |
| 587 | '0' => esc_html__( 'Default from layout', 'the-post-grid' ), |
| 588 | '12' => esc_html__( '1 Columns', 'the-post-grid' ), |
| 589 | '6' => esc_html__( '2 Columns', 'the-post-grid' ), |
| 590 | '4' => esc_html__( '3 Columns', 'the-post-grid' ), |
| 591 | '3' => esc_html__( '4 Columns', 'the-post-grid' ), |
| 592 | ]; |
| 593 | |
| 594 | if ( 'grid' === $prefix ) { |
| 595 | $grid_column_condition = [ |
| 596 | 'grid_layout!' => [ 'grid-layout5', 'grid-layout5-2', 'grid-layout6', 'grid-layout6-2' ], |
| 597 | ]; |
| 598 | } |
| 599 | |
| 600 | if ( 'grid_hover' === $prefix ) { |
| 601 | $grid_column_condition = [ |
| 602 | 'grid_hover_layout!' => [ 'grid_hover-layout8' ], |
| 603 | ]; |
| 604 | } |
| 605 | |
| 606 | if ( 'slider' === $prefix ) { |
| 607 | $column_options = [ |
| 608 | '0' => esc_html__( 'Default from layout', 'the-post-grid' ), |
| 609 | '1' => esc_html__( '1 Columns', 'the-post-grid' ), |
| 610 | '2' => esc_html__( '2 Columns', 'the-post-grid' ), |
| 611 | '3' => esc_html__( '3 Columns', 'the-post-grid' ), |
| 612 | '4' => esc_html__( '4 Columns', 'the-post-grid' ), |
| 613 | '5' => esc_html__( '5 Columns', 'the-post-grid' ), |
| 614 | '6' => esc_html__( '6 Columns', 'the-post-grid' ), |
| 615 | ]; |
| 616 | $grid_column_condition = [ |
| 617 | 'slider_layout!' => [ 'slider-layout10', 'slider-layout11', 'slider-layout13' ], |
| 618 | ]; |
| 619 | } |
| 620 | |
| 621 | $ref->add_responsive_control( |
| 622 | $prefix . '_column', |
| 623 | [ |
| 624 | 'label' => esc_html__( 'Column', 'the-post-grid' ), |
| 625 | 'type' => Controls_Manager::SELECT, |
| 626 | 'options' => $column_options, |
| 627 | 'default' => '0', |
| 628 | 'tablet_default' => '0', |
| 629 | 'mobile_default' => '0', |
| 630 | 'description' => esc_html__( 'Choose Column for layout.', 'the-post-grid' ), |
| 631 | 'condition' => $grid_column_condition, |
| 632 | ] |
| 633 | ); |
| 634 | |
| 635 | if ( 'single' === $layout_type ) { |
| 636 | $ref->add_control( |
| 637 | 'enable_related_slider', |
| 638 | [ |
| 639 | 'label' => esc_html__( 'Enable Slider', 'the-post-grid' ), |
| 640 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 641 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 642 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 643 | 'return_value' => 'yes', |
| 644 | 'default' => 'yes', |
| 645 | ] |
| 646 | ); |
| 647 | |
| 648 | $ref->add_responsive_control( |
| 649 | 'slider_gap_2', |
| 650 | [ |
| 651 | 'label' => esc_html__( 'Grid Gap', 'the-post-grid' ), |
| 652 | 'type' => Controls_Manager::SLIDER, |
| 653 | 'size_units' => [ 'px' ], |
| 654 | 'range' => [ |
| 655 | 'px' => [ |
| 656 | 'min' => 0, |
| 657 | 'max' => 100, |
| 658 | 'step' => 1, |
| 659 | ], |
| 660 | ], |
| 661 | 'selectors' => [ |
| 662 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-slider-item' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}}; padding-bottom: calc({{SIZE}}{{UNIT}} * 2)', |
| 663 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};', |
| 664 | ], |
| 665 | 'condition' => [ |
| 666 | 'enable_related_slider!' => 'yes', |
| 667 | ], |
| 668 | ] |
| 669 | ); |
| 670 | } |
| 671 | |
| 672 | $ref->add_responsive_control( |
| 673 | $prefix . '_offset_col_width', |
| 674 | [ |
| 675 | 'label' => esc_html__( 'Offset Column Width', 'the-post-grid' ), |
| 676 | 'type' => Controls_Manager::SLIDER, |
| 677 | 'size_units' => [ '%' ], |
| 678 | 'range' => [ |
| 679 | 'px' => [ |
| 680 | 'min' => 30, |
| 681 | 'max' => 70, |
| 682 | 'step' => 1, |
| 683 | ], |
| 684 | '%' => [ |
| 685 | 'min' => 30, |
| 686 | 'max' => 70, |
| 687 | 'step' => 1, |
| 688 | ], |
| 689 | ], |
| 690 | 'selectors' => [ |
| 691 | '{{WRAPPER}} .tpg-el-main-wrapper .offset-left' => 'width: {{SIZE}}%;', |
| 692 | '{{WRAPPER}} .tpg-el-main-wrapper .offset-right' => 'width: calc( 100% - {{SIZE}}%);', |
| 693 | ], |
| 694 | 'condition' => [ |
| 695 | $prefix . '_layout' => [ |
| 696 | 'grid-layout5', |
| 697 | 'grid-layout5-2', |
| 698 | 'grid-layout6', |
| 699 | 'grid-layout6-2', |
| 700 | 'grid_hover-layout4', |
| 701 | 'grid_hover-layout4-2', |
| 702 | 'grid_hover-layout5', |
| 703 | 'grid_hover-layout5-2', |
| 704 | 'grid_hover-layout6', |
| 705 | 'grid_hover-layout6-2', |
| 706 | 'grid_hover-layout7', |
| 707 | 'grid_hover-layout7-2', |
| 708 | 'grid_hover-layout9', |
| 709 | 'grid_hover-layout9-2', |
| 710 | ], |
| 711 | ], |
| 712 | ] |
| 713 | ); |
| 714 | |
| 715 | |
| 716 | if ( 'grid' === $prefix ) { |
| 717 | $layout_style_opt = [ |
| 718 | 'tpg-even' => esc_html__( 'Grid', 'the-post-grid' ), |
| 719 | 'tpg-full-height' => esc_html__( 'Grid Equal Height', 'the-post-grid' ), |
| 720 | ]; |
| 721 | if ( rtTPG()->hasPro() ) { |
| 722 | $layout_style_new_opt = [ |
| 723 | 'masonry' => esc_html__( 'Masonry', 'the-post-grid' ), |
| 724 | ]; |
| 725 | $layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt ); |
| 726 | } |
| 727 | |
| 728 | $ref->add_control( |
| 729 | $prefix . '_layout_style', |
| 730 | [ |
| 731 | 'label' => esc_html__( 'Layout Style', 'the-post-grid' ), |
| 732 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 733 | 'default' => 'tpg-full-height', |
| 734 | 'options' => $layout_style_opt, |
| 735 | 'description' => esc_html__( 'If you use card border then equal height will work. ', 'the-post-grid' ) . $ref->get_pro_message( "masonry layout" ), |
| 736 | 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field', |
| 737 | 'condition' => [ |
| 738 | $prefix . '_layout!' => [ 'grid-layout2', |
| 739 | 'grid-layout5', |
| 740 | 'grid-layout5-2', |
| 741 | 'grid-layout6', |
| 742 | 'grid-layout6-2', |
| 743 | 'grid-layout7', |
| 744 | 'grid-layout7-2' |
| 745 | ], |
| 746 | ], |
| 747 | ] |
| 748 | ); |
| 749 | } |
| 750 | |
| 751 | if ( $prefix !== 'slider' ) { |
| 752 | $layout_align_css = [ |
| 753 | '{{WRAPPER}} .rt-tpg-container .grid-layout2 .rt-holder .post-right-content' => 'justify-content: {{VALUE}};', |
| 754 | ]; |
| 755 | |
| 756 | if ( $prefix === 'grid_hover' ) { |
| 757 | $layout_align_css = [ |
| 758 | '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'justify-content: {{VALUE}};', |
| 759 | ]; |
| 760 | } |
| 761 | |
| 762 | //Grid layout |
| 763 | $ref->add_control( |
| 764 | $prefix . '_layout_alignment', |
| 765 | [ |
| 766 | 'label' => esc_html__( 'Vertical Align', 'the-post-grid' ), |
| 767 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 768 | 'options' => [ |
| 769 | '' => esc_html__( 'Default', 'the-post-grid' ), |
| 770 | 'flex-start' => esc_html__( 'Start', 'the-post-grid' ), |
| 771 | 'center' => esc_html__( 'Center', 'the-post-grid' ), |
| 772 | 'flex-end' => esc_html__( 'End', 'the-post-grid' ), |
| 773 | 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ), |
| 774 | 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ), |
| 775 | ], |
| 776 | 'condition' => [ |
| 777 | $prefix . '_layout!' => [ |
| 778 | 'grid-layout1', |
| 779 | 'grid-layout3', |
| 780 | 'grid-layout4', |
| 781 | 'grid-layout5', |
| 782 | 'grid-layout5-2', |
| 783 | 'grid-layout6', |
| 784 | 'grid-layout6-2', |
| 785 | 'grid-layout7', |
| 786 | 'grid_hover-layout2', |
| 787 | 'grid_hover-layout4', |
| 788 | 'grid_hover-layout4-2', |
| 789 | ], |
| 790 | ], |
| 791 | 'selectors' => $layout_align_css, |
| 792 | ] |
| 793 | ); |
| 794 | } |
| 795 | |
| 796 | if ( $prefix === 'slider' ) { |
| 797 | //Grid layout |
| 798 | $ref->add_control( |
| 799 | $prefix . '_layout_alignment_2', |
| 800 | [ |
| 801 | 'label' => esc_html__( 'Vertical Align', 'the-post-grid' ), |
| 802 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 803 | 'options' => [ |
| 804 | '' => esc_html__( 'Default', 'the-post-grid' ), |
| 805 | 'flex-start' => esc_html__( 'Start', 'the-post-grid' ), |
| 806 | 'center' => esc_html__( 'Center', 'the-post-grid' ), |
| 807 | 'flex-end' => esc_html__( 'End', 'the-post-grid' ), |
| 808 | 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ), |
| 809 | 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ), |
| 810 | ], |
| 811 | 'condition' => [ |
| 812 | $prefix . '_layout!' => [ 'slider-layout1', |
| 813 | 'slider-layout2', |
| 814 | 'slider-layout3', |
| 815 | 'slider-layout13', |
| 816 | 'grid-layout7' |
| 817 | ], |
| 818 | ], |
| 819 | 'selectors' => [ |
| 820 | '{{WRAPPER}} .tpg-el-main-wrapper .grid-behaviour .rt-holder .rt-el-content-wrapper .gallery-content' => 'justify-content: {{VALUE}};height:100%;', |
| 821 | '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'justify-content: {{VALUE}};', |
| 822 | ], |
| 823 | ] |
| 824 | ); |
| 825 | } |
| 826 | |
| 827 | $ref->add_responsive_control( |
| 828 | 'full_wrapper_align', |
| 829 | [ |
| 830 | 'label' => esc_html__( 'Text Align', 'the-post-grid' ), |
| 831 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 832 | 'options' => [ |
| 833 | 'left' => [ |
| 834 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 835 | 'icon' => 'eicon-text-align-left', |
| 836 | ], |
| 837 | 'center' => [ |
| 838 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 839 | 'icon' => 'eicon-text-align-center', |
| 840 | ], |
| 841 | 'right' => [ |
| 842 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 843 | 'icon' => 'eicon-text-align-right', |
| 844 | ], |
| 845 | ], |
| 846 | 'prefix_class' => 'tpg-wrapper-align-', |
| 847 | 'render_type' => 'template', |
| 848 | 'toggle' => true, |
| 849 | 'selectors' => [ |
| 850 | '{{WRAPPER}} .tpg-post-holder div' => 'text-align: {{VALUE}};', |
| 851 | ], |
| 852 | 'condition' => [ |
| 853 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 854 | ], |
| 855 | |
| 856 | ] |
| 857 | ); |
| 858 | |
| 859 | |
| 860 | $ref->end_controls_section(); |
| 861 | } |
| 862 | |
| 863 | |
| 864 | /** |
| 865 | * Front-end Filter Settings |
| 866 | * |
| 867 | * @param $ref |
| 868 | */ |
| 869 | public static function filter_settings( $ref ) { |
| 870 | $prefix = $ref->prefix; |
| 871 | |
| 872 | if ( ! rtTPG()->hasPro() ) { |
| 873 | return; |
| 874 | } |
| 875 | $ref->start_controls_section( |
| 876 | $prefix . '_filter_settings', |
| 877 | [ |
| 878 | 'label' => esc_html__( 'Filter (Front-end)', 'the-post-grid' ), |
| 879 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 880 | ] |
| 881 | ); |
| 882 | |
| 883 | $ref->add_control( |
| 884 | 'show_taxonomy_filter', |
| 885 | [ |
| 886 | 'label' => esc_html__( 'Taxonomy Filter', 'the-post-grid' ), |
| 887 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 888 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 889 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 890 | 'return_value' => 'show', |
| 891 | 'default' => 'hide', |
| 892 | ] |
| 893 | ); |
| 894 | |
| 895 | $ref->add_control( |
| 896 | 'show_author_filter', |
| 897 | [ |
| 898 | 'label' => esc_html__( 'Author filter', 'the-post-grid' ), |
| 899 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 900 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 901 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 902 | 'return_value' => 'show', |
| 903 | 'default' => 'hide', |
| 904 | ] |
| 905 | ); |
| 906 | |
| 907 | $ref->add_control( |
| 908 | 'show_order_by', |
| 909 | [ |
| 910 | 'label' => esc_html__( 'Order By Filter', 'the-post-grid' ), |
| 911 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 912 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 913 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 914 | 'return_value' => 'show', |
| 915 | 'default' => 'hide', |
| 916 | ] |
| 917 | ); |
| 918 | |
| 919 | $ref->add_control( |
| 920 | 'show_sort_order', |
| 921 | [ |
| 922 | 'label' => esc_html__( 'Sort Order Filter', 'the-post-grid' ), |
| 923 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 924 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 925 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 926 | 'return_value' => 'show', |
| 927 | 'default' => 'hide', |
| 928 | ] |
| 929 | ); |
| 930 | |
| 931 | $ref->add_control( |
| 932 | 'show_search', |
| 933 | [ |
| 934 | 'label' => esc_html__( 'Search 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 | //TODO: Filter Settings |
| 944 | //====================================================== |
| 945 | |
| 946 | $front_end_filter_condition = [ |
| 947 | 'relation' => 'or', |
| 948 | 'terms' => [ |
| 949 | [ |
| 950 | 'name' => 'show_taxonomy_filter', |
| 951 | 'operator' => '==', |
| 952 | 'value' => 'show', |
| 953 | ], |
| 954 | [ |
| 955 | 'name' => 'show_author_filter', |
| 956 | 'operator' => '==', |
| 957 | 'value' => 'show', |
| 958 | ], |
| 959 | [ |
| 960 | 'name' => 'show_order_by', |
| 961 | 'operator' => '==', |
| 962 | 'value' => 'show', |
| 963 | ], |
| 964 | [ |
| 965 | 'name' => 'show_sort_order', |
| 966 | 'operator' => '==', |
| 967 | 'value' => 'show', |
| 968 | ], |
| 969 | [ |
| 970 | 'name' => 'show_search', |
| 971 | 'operator' => '==', |
| 972 | 'value' => 'show', |
| 973 | ], |
| 974 | ], |
| 975 | ]; |
| 976 | |
| 977 | |
| 978 | $ref->add_control( |
| 979 | 'filter_type', |
| 980 | [ |
| 981 | 'label' => esc_html__( 'Filter Type', 'the-post-grid' ), |
| 982 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 983 | 'default' => 'dropdown', |
| 984 | 'options' => [ |
| 985 | 'dropdown' => esc_html__( 'Dropdown', 'the-post-grid' ), |
| 986 | 'button' => esc_html__( 'Button', 'the-post-grid' ), |
| 987 | ], |
| 988 | 'render_type' => 'template', |
| 989 | 'prefix_class' => 'tpg-filter-type-', |
| 990 | 'conditions' => $front_end_filter_condition, |
| 991 | 'separator' => 'before', |
| 992 | ] |
| 993 | ); |
| 994 | |
| 995 | $ref->add_control( |
| 996 | 'filter_btn_style', |
| 997 | [ |
| 998 | 'label' => esc_html__( 'Filter Style', 'the-post-grid' ), |
| 999 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1000 | 'default' => 'default', |
| 1001 | 'options' => [ |
| 1002 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 1003 | 'carousel' => esc_html__( 'Collapsable', 'the-post-grid' ), |
| 1004 | ], |
| 1005 | 'condition' => [ |
| 1006 | 'filter_type' => 'button', |
| 1007 | ], |
| 1008 | 'conditions' => $front_end_filter_condition, |
| 1009 | 'description' => esc_html__( 'If you use collapsable then only category section show on the filter', 'the-post-grid' ), |
| 1010 | ] |
| 1011 | ); |
| 1012 | |
| 1013 | $ref->add_responsive_control( |
| 1014 | 'filter_btn_item_per_page', |
| 1015 | [ |
| 1016 | 'label' => esc_html__( 'Button Item Per Slider', 'the-post-grid' ), |
| 1017 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1018 | 'options' => [ |
| 1019 | 'auto' => esc_html__( 'Auto', 'the-post-grid' ), |
| 1020 | '2' => esc_html__( '2', 'the-post-grid' ), |
| 1021 | '3' => esc_html__( '3', 'the-post-grid' ), |
| 1022 | '4' => esc_html__( '4', 'the-post-grid' ), |
| 1023 | '5' => esc_html__( '5', 'the-post-grid' ), |
| 1024 | '6' => esc_html__( '6', 'the-post-grid' ), |
| 1025 | '7' => esc_html__( '7', 'the-post-grid' ), |
| 1026 | '8' => esc_html__( '8', 'the-post-grid' ), |
| 1027 | '9' => esc_html__( '9', 'the-post-grid' ), |
| 1028 | '10' => esc_html__( '10', 'the-post-grid' ), |
| 1029 | '11' => esc_html__( '11', 'the-post-grid' ), |
| 1030 | '12' => esc_html__( '12', 'the-post-grid' ), |
| 1031 | ], |
| 1032 | 'default' => 'auto', |
| 1033 | 'tablet_default' => 'auto', |
| 1034 | 'mobile_default' => 'auto', |
| 1035 | 'condition' => [ |
| 1036 | 'filter_type' => 'button', |
| 1037 | 'filter_btn_style' => 'carousel', |
| 1038 | ], |
| 1039 | 'conditions' => $front_end_filter_condition, |
| 1040 | 'description' => esc_html__( 'If you use carousel then only category section show on the filter', 'the-post-grid' ), |
| 1041 | ] |
| 1042 | ); |
| 1043 | |
| 1044 | |
| 1045 | $post_types = Fns::get_post_types(); |
| 1046 | foreach ( $post_types as $post_type => $label ) { |
| 1047 | $_taxonomies = get_object_taxonomies( $post_type, 'object' ); |
| 1048 | if ( empty( $_taxonomies ) ) { |
| 1049 | continue; |
| 1050 | } |
| 1051 | $taxonomies_list = []; |
| 1052 | foreach ( $_taxonomies as $tax ) { |
| 1053 | if ( in_array( $tax->name, [ 'post_format', |
| 1054 | 'elementor_library_type', |
| 1055 | 'product_visibility', |
| 1056 | 'product_shipping_class' |
| 1057 | ] ) ) { |
| 1058 | continue; |
| 1059 | } |
| 1060 | $taxonomies_list[ $tax->name ] = $tax->label; |
| 1061 | } |
| 1062 | |
| 1063 | if ( 'post' === $post_type ) { |
| 1064 | $default_cat = 'category'; |
| 1065 | } elseif ( 'product' === $post_type ) { |
| 1066 | $default_cat = 'product_cat'; |
| 1067 | } elseif ( 'download' === $post_type ) { |
| 1068 | $default_cat = 'download_category'; |
| 1069 | } elseif ( 'docs' === $post_type ) { |
| 1070 | $default_cat = 'doc_category'; |
| 1071 | } elseif ( 'lp_course' === $post_type ) { |
| 1072 | $default_cat = 'course_category'; |
| 1073 | } else { |
| 1074 | $taxonomie_keys = array_keys( $_taxonomies ); |
| 1075 | $filter_cat = array_filter( |
| 1076 | $taxonomie_keys, |
| 1077 | function ( $item ) { |
| 1078 | return strpos( $item, 'cat' ) !== false; |
| 1079 | } |
| 1080 | ); |
| 1081 | |
| 1082 | if ( is_array( $filter_cat ) && ! empty( $filter_cat ) ) { |
| 1083 | $default_cat = array_shift( $filter_cat ); |
| 1084 | } |
| 1085 | } |
| 1086 | |
| 1087 | $ref->add_control( |
| 1088 | $post_type . '_filter_taxonomy', |
| 1089 | [ |
| 1090 | 'label' => esc_html__( 'Choose Taxonomy', 'the-post-grid' ), |
| 1091 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1092 | 'default' => $default_cat, |
| 1093 | 'options' => $taxonomies_list, |
| 1094 | 'condition' => [ |
| 1095 | 'post_type' => $post_type, |
| 1096 | 'show_taxonomy_filter' => 'show', |
| 1097 | ], |
| 1098 | 'description' => esc_html__( 'Select a taxonomy for showing in filter', 'the-post-grid' ), |
| 1099 | ] |
| 1100 | ); |
| 1101 | |
| 1102 | foreach ( $_taxonomies as $tax ) { |
| 1103 | if ( in_array( $tax->name, [ 'post_format', |
| 1104 | 'elementor_library_type', |
| 1105 | 'product_visibility', |
| 1106 | 'product_shipping_class' |
| 1107 | ] ) ) { |
| 1108 | continue; |
| 1109 | } |
| 1110 | |
| 1111 | $term_first = [ '0' => esc_html__( '--Select--', 'the-post-grid' ) ]; |
| 1112 | $term_lists = get_terms( |
| 1113 | [ |
| 1114 | 'taxonomy' => $tax->name, //Custom taxonomy name |
| 1115 | 'hide_empty' => true, |
| 1116 | 'fields' => "id=>name", |
| 1117 | ] |
| 1118 | ); |
| 1119 | |
| 1120 | $term_lists = $term_first + $term_lists; |
| 1121 | |
| 1122 | $ref->add_control( |
| 1123 | $tax->name . '_default_terms', |
| 1124 | [ |
| 1125 | 'label' => esc_html__( 'Default ', 'the-post-grid' ) . $tax->label, |
| 1126 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1127 | 'default' => '0', |
| 1128 | 'options' => $term_lists, |
| 1129 | 'condition' => [ |
| 1130 | $post_type . '_filter_taxonomy' => $tax->name, |
| 1131 | 'post_type' => $post_type, |
| 1132 | 'show_taxonomy_filter' => 'show', |
| 1133 | ], |
| 1134 | ] |
| 1135 | ); |
| 1136 | } |
| 1137 | } |
| 1138 | |
| 1139 | $front_end_filter_tax_condition = [ |
| 1140 | 'relation' => 'or', |
| 1141 | 'terms' => [ |
| 1142 | [ |
| 1143 | 'name' => 'show_taxonomy_filter', |
| 1144 | 'operator' => '==', |
| 1145 | 'value' => 'show', |
| 1146 | ], |
| 1147 | [ |
| 1148 | 'name' => 'show_author_filter', |
| 1149 | 'operator' => '==', |
| 1150 | 'value' => 'show', |
| 1151 | ], |
| 1152 | ], |
| 1153 | ]; |
| 1154 | |
| 1155 | $ref->add_control( |
| 1156 | 'filter_post_count', |
| 1157 | [ |
| 1158 | 'label' => esc_html__( 'Filter Post Count', 'the-post-grid' ), |
| 1159 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1160 | 'default' => 'no', |
| 1161 | 'options' => [ |
| 1162 | 'yes' => esc_html__( 'Yes', 'the-post-grid' ), |
| 1163 | 'no' => esc_html__( 'No', 'the-post-grid' ), |
| 1164 | ], |
| 1165 | 'conditions' => $front_end_filter_tax_condition, |
| 1166 | ] |
| 1167 | ); |
| 1168 | |
| 1169 | |
| 1170 | $ref->add_control( |
| 1171 | 'tgp_filter_taxonomy_hierarchical', |
| 1172 | [ |
| 1173 | 'label' => esc_html__( 'Tax Hierarchical', 'the-post-grid' ), |
| 1174 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1175 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 1176 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 1177 | 'return_value' => 'yes', |
| 1178 | 'default' => 'yes', |
| 1179 | 'conditions' => $front_end_filter_tax_condition, |
| 1180 | 'condition' => [ |
| 1181 | 'filter_type' => 'button', |
| 1182 | 'filter_btn_style' => 'default', |
| 1183 | ], |
| 1184 | ] |
| 1185 | ); |
| 1186 | |
| 1187 | $ref->add_control( |
| 1188 | 'tpg_hide_all_button', |
| 1189 | [ |
| 1190 | 'label' => esc_html__( 'Hide Show all button', 'the-post-grid' ), |
| 1191 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1192 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1193 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1194 | 'return_value' => 'yes', |
| 1195 | 'default' => 'yes', |
| 1196 | 'conditions' => $front_end_filter_tax_condition, |
| 1197 | 'condition' => [ |
| 1198 | 'filter_type' => 'button', |
| 1199 | ], |
| 1200 | ] |
| 1201 | ); |
| 1202 | |
| 1203 | $ref->add_control( |
| 1204 | 'tax_filter_all_text', |
| 1205 | [ |
| 1206 | 'label' => esc_html__( 'All Taxonomy Text', 'the-post-grid' ), |
| 1207 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1208 | 'placeholder' => esc_html__( 'Enter All Category Text Here..', 'the-post-grid' ), |
| 1209 | 'conditions' => $front_end_filter_tax_condition, |
| 1210 | ] |
| 1211 | ); |
| 1212 | $ref->add_control( |
| 1213 | 'author_filter_all_text', |
| 1214 | [ |
| 1215 | 'label' => esc_html__( 'All Users Text', 'the-post-grid' ), |
| 1216 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1217 | 'placeholder' => esc_html__( 'Enter All Users Text Here..', 'the-post-grid' ), |
| 1218 | 'condition' => [ |
| 1219 | 'show_author_filter' => 'show', |
| 1220 | 'filter_btn_style' => 'default', |
| 1221 | ], |
| 1222 | ] |
| 1223 | ); |
| 1224 | |
| 1225 | |
| 1226 | $ref->end_controls_section(); |
| 1227 | } |
| 1228 | |
| 1229 | |
| 1230 | /** |
| 1231 | * List Layout Settings |
| 1232 | * |
| 1233 | * @param $ref |
| 1234 | */ |
| 1235 | public static function list_layouts( $ref, $layout_type = '' ) { |
| 1236 | $prefix = $ref->prefix; |
| 1237 | $ref->start_controls_section( |
| 1238 | 'list_layout_settings', |
| 1239 | [ |
| 1240 | 'label' => esc_html__( 'Layout', 'the-post-grid' ), |
| 1241 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 1242 | ] |
| 1243 | ); |
| 1244 | |
| 1245 | $ref->add_control( |
| 1246 | 'list_layout', |
| 1247 | [ |
| 1248 | 'label' => esc_html__( 'Choose Layout', 'the-post-grid' ), |
| 1249 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 1250 | 'label_block' => true, |
| 1251 | 'options' => [ |
| 1252 | 'list-layout1' => [ |
| 1253 | 'title' => esc_html__( 'Layout 1', 'the-post-grid' ), |
| 1254 | ], |
| 1255 | 'list-layout2' => [ |
| 1256 | 'title' => esc_html__( 'Layout 2', 'the-post-grid' ), |
| 1257 | ], |
| 1258 | 'list-layout2-2' => [ |
| 1259 | 'title' => esc_html__( 'Layout 3', 'the-post-grid' ), |
| 1260 | ], |
| 1261 | 'list-layout3' => [ |
| 1262 | 'title' => esc_html__( 'Layout 4', 'the-post-grid' ), |
| 1263 | ], |
| 1264 | 'list-layout3-2' => [ |
| 1265 | 'title' => esc_html__( 'Layout 5', 'the-post-grid' ), |
| 1266 | ], |
| 1267 | 'list-layout4' => [ |
| 1268 | 'title' => esc_html__( 'Layout 6', 'the-post-grid' ), |
| 1269 | ], |
| 1270 | 'list-layout5' => [ |
| 1271 | 'title' => esc_html__( 'Layout 7', 'the-post-grid' ), |
| 1272 | ], |
| 1273 | ], |
| 1274 | 'toggle' => false, |
| 1275 | 'default' => 'list-layout1', |
| 1276 | 'style_transfer' => true, |
| 1277 | 'classes' => 'tpg-image-select list-layout ' . $ref->is_post_layout, |
| 1278 | ] |
| 1279 | ); |
| 1280 | |
| 1281 | $ref->add_control( |
| 1282 | 'layout_options_heading2', |
| 1283 | [ |
| 1284 | 'label' => esc_html__( 'Layout Options:', 'the-post-grid' ), |
| 1285 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 1286 | 'classes' => 'tpg-control-type-heading', |
| 1287 | ] |
| 1288 | ); |
| 1289 | |
| 1290 | $ref->add_responsive_control( |
| 1291 | 'list_column', |
| 1292 | [ |
| 1293 | 'label' => esc_html__( 'Column', 'the-post-grid' ), |
| 1294 | 'type' => Controls_Manager::SELECT, |
| 1295 | 'options' => [ |
| 1296 | '0' => esc_html__( 'Default from layout', 'the-post-grid' ), |
| 1297 | '12' => esc_html__( '1 Columns', 'the-post-grid' ), |
| 1298 | '6' => esc_html__( '2 Columns', 'the-post-grid' ), |
| 1299 | '4' => esc_html__( '3 Columns', 'the-post-grid' ), |
| 1300 | '3' => esc_html__( '4 Columns', 'the-post-grid' ), |
| 1301 | ], |
| 1302 | 'default' => '0', |
| 1303 | 'tablet_default' => '0', |
| 1304 | 'mobile_default' => '0', |
| 1305 | 'description' => esc_html__( 'Choose Column for layout', 'the-post-grid' ), |
| 1306 | 'condition' => [ |
| 1307 | 'list_layout!' => [ 'list-layout2', 'list-layout2-2', 'list-layout4' ], |
| 1308 | ], |
| 1309 | ] |
| 1310 | ); |
| 1311 | |
| 1312 | |
| 1313 | $ref->add_responsive_control( |
| 1314 | 'list_layout_alignment', |
| 1315 | [ |
| 1316 | 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ), |
| 1317 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1318 | 'options' => [ |
| 1319 | '' => esc_html__( 'Default', 'the-post-grid' ), |
| 1320 | 'flex-start' => esc_html__( 'Start', 'the-post-grid' ), |
| 1321 | 'center' => esc_html__( 'Center', 'the-post-grid' ), |
| 1322 | 'flex-end' => esc_html__( 'End', 'the-post-grid' ), |
| 1323 | 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ), |
| 1324 | 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ), |
| 1325 | ], |
| 1326 | 'selectors' => [ |
| 1327 | '{{WRAPPER}} .tpg-el-main-wrapper .list-behaviour .rt-holder .rt-el-content-wrapper' => 'align-items: {{VALUE}};', |
| 1328 | ], |
| 1329 | 'condition' => [ |
| 1330 | 'list_layout!' => [ 'list-layout2', 'list-layout2-2' ], |
| 1331 | ], |
| 1332 | ] |
| 1333 | ); |
| 1334 | |
| 1335 | $ref->add_responsive_control( |
| 1336 | 'list_left_side_width', |
| 1337 | [ |
| 1338 | 'label' => esc_html__( 'Offset Width', 'the-post-grid' ), |
| 1339 | 'type' => Controls_Manager::SLIDER, |
| 1340 | 'size_units' => [ '%' ], |
| 1341 | 'range' => [ |
| 1342 | 'px' => [ |
| 1343 | 'min' => 0, |
| 1344 | 'max' => 700, |
| 1345 | 'step' => 5, |
| 1346 | ], |
| 1347 | '%' => [ |
| 1348 | 'min' => 0, |
| 1349 | 'max' => 100, |
| 1350 | ], |
| 1351 | ], |
| 1352 | 'selectors' => [ |
| 1353 | '{{WRAPPER}} .rt-tpg-container .list-layout-wrapper .offset-left' => 'width: {{SIZE}}%;', |
| 1354 | '{{WRAPPER}} .rt-tpg-container .list-layout-wrapper .offset-right' => 'width: calc( 100% - {{SIZE}}%);', |
| 1355 | ], |
| 1356 | 'condition' => [ |
| 1357 | 'list_layout' => [ 'list-layout2', 'list-layout3', 'list-layout2-2', 'list-layout3-2' ], |
| 1358 | ], |
| 1359 | ] |
| 1360 | ); |
| 1361 | |
| 1362 | |
| 1363 | $layout_style_opt = [ |
| 1364 | 'tpg-even' => esc_html__( ucwords( $ref->prefix ) . ' Default', 'the-post-grid' ), |
| 1365 | ]; |
| 1366 | if ( rtTPG()->hasPro() ) { |
| 1367 | $layout_style_new_opt = [ |
| 1368 | 'masonry' => esc_html__( 'Masonry', 'the-post-grid' ), |
| 1369 | ]; |
| 1370 | $layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt ); |
| 1371 | } |
| 1372 | |
| 1373 | $ref->add_control( |
| 1374 | 'list_layout_style', |
| 1375 | [ |
| 1376 | 'label' => esc_html__( 'Layout Style', 'the-post-grid' ), |
| 1377 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1378 | 'default' => 'tpg-even', |
| 1379 | 'options' => $layout_style_opt, |
| 1380 | 'description' => $ref->get_pro_message( "masonry layout" ), |
| 1381 | 'condition' => [ |
| 1382 | 'list_layout' => [ 'list-layout1', 'list-layout5' ], |
| 1383 | 'list_column!' => [ '0', '12' ], |
| 1384 | ], |
| 1385 | ] |
| 1386 | ); |
| 1387 | |
| 1388 | $ref->add_responsive_control( |
| 1389 | 'full_wrapper_align', |
| 1390 | [ |
| 1391 | 'label' => esc_html__( 'Text Align', 'the-post-grid' ), |
| 1392 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 1393 | 'options' => [ |
| 1394 | 'left' => [ |
| 1395 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 1396 | 'icon' => 'eicon-text-align-left', |
| 1397 | ], |
| 1398 | 'center' => [ |
| 1399 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 1400 | 'icon' => 'eicon-text-align-center', |
| 1401 | ], |
| 1402 | 'right' => [ |
| 1403 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 1404 | 'icon' => 'eicon-text-align-right', |
| 1405 | ], |
| 1406 | ], |
| 1407 | 'selectors' => [ |
| 1408 | '{{WRAPPER}} .tpg-post-holder div' => 'text-align: {{VALUE}};', |
| 1409 | ], |
| 1410 | 'render_type' => 'template', |
| 1411 | 'prefix_class' => 'tpg-wrapper-align-', |
| 1412 | 'toggle' => true, |
| 1413 | ] |
| 1414 | ); |
| 1415 | |
| 1416 | $ref->end_controls_section(); |
| 1417 | } |
| 1418 | |
| 1419 | /** |
| 1420 | * Pagination and Load more style tab |
| 1421 | * |
| 1422 | * @param $ref |
| 1423 | * @param bool $is_print |
| 1424 | */ |
| 1425 | public static function pagination_settings( $ref, $layout_type = '' ) { |
| 1426 | $ref->start_controls_section( |
| 1427 | 'pagination_settings', |
| 1428 | [ |
| 1429 | 'label' => esc_html__( 'Pagination', 'the-post-grid' ), |
| 1430 | 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 1431 | ] |
| 1432 | ); |
| 1433 | |
| 1434 | $ref->add_control( |
| 1435 | 'show_pagination', |
| 1436 | [ |
| 1437 | 'label' => esc_html__( 'Show Pagination', 'the-post-grid' ), |
| 1438 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1439 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1440 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1441 | 'return_value' => 'show', |
| 1442 | 'default' => 'default', |
| 1443 | 'render_type' => 'template', |
| 1444 | 'prefix_class' => 'pagination-visibility-', |
| 1445 | ] |
| 1446 | ); |
| 1447 | |
| 1448 | |
| 1449 | if ( 'archive' !== $layout_type ) { |
| 1450 | $ref->add_control( |
| 1451 | 'display_per_page', |
| 1452 | [ |
| 1453 | 'label' => esc_html__( 'Display Per Page', 'the-post-grid' ), |
| 1454 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 1455 | 'default' => 6, |
| 1456 | 'description' => esc_html__( 'Enter how may posts will display per page', 'the-post-grid' ), |
| 1457 | 'condition' => [ |
| 1458 | 'show_pagination' => 'show', |
| 1459 | ], |
| 1460 | ] |
| 1461 | ); |
| 1462 | } |
| 1463 | |
| 1464 | |
| 1465 | $default_pagination = 'pagination'; |
| 1466 | if ( 'archive' == $layout_type ) { |
| 1467 | $pagination_type = []; |
| 1468 | $default_pagination = 'pagination_ajax'; |
| 1469 | } else { |
| 1470 | $pagination_type = [ |
| 1471 | 'pagination' => esc_html__( 'Default Pagination', 'the-post-grid' ), |
| 1472 | ]; |
| 1473 | } |
| 1474 | |
| 1475 | if ( rtTPG()->hasPro() ) { |
| 1476 | $pagination_type_pro = [ |
| 1477 | 'pagination_ajax' => esc_html__( 'Ajax Pagination ( Only for Grid )', 'the-post-grid' ), |
| 1478 | 'load_more' => esc_html__( 'Load More - On Click', 'the-post-grid' ), |
| 1479 | 'load_on_scroll' => esc_html__( 'Load On Scroll', 'the-post-grid' ), |
| 1480 | ]; |
| 1481 | $pagination_type = array_merge( $pagination_type, $pagination_type_pro ); |
| 1482 | } |
| 1483 | |
| 1484 | $ref->add_control( |
| 1485 | 'pagination_type', |
| 1486 | [ |
| 1487 | 'label' => esc_html__( 'Pagination Type', 'the-post-grid' ), |
| 1488 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1489 | 'default' => $default_pagination, |
| 1490 | 'options' => $pagination_type, |
| 1491 | 'description' => $ref->get_pro_message( 'loadmore and ajax pagination' ), |
| 1492 | 'condition' => [ |
| 1493 | 'show_pagination' => 'show', |
| 1494 | ], |
| 1495 | ] |
| 1496 | ); |
| 1497 | |
| 1498 | $ref->add_control( |
| 1499 | 'ajax_pagination_type', |
| 1500 | [ |
| 1501 | 'label' => esc_html__( 'Enable Ajax Next Previous', 'the-post-grid' ), |
| 1502 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1503 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 1504 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 1505 | 'return_value' => 'yes', |
| 1506 | 'default' => false, |
| 1507 | 'condition' => [ |
| 1508 | 'pagination_type' => 'pagination_ajax', |
| 1509 | 'show_pagination' => 'show', |
| 1510 | ], |
| 1511 | 'prefix_class' => 'ajax-pagination-type-next-prev-', |
| 1512 | ] |
| 1513 | ); |
| 1514 | |
| 1515 | |
| 1516 | $ref->add_control( |
| 1517 | 'load_more_button_text', |
| 1518 | [ |
| 1519 | 'label' => esc_html__( 'Button Text', 'the-post-grid' ), |
| 1520 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1521 | 'default' => esc_html__( 'Load More', 'the-post-grid' ), |
| 1522 | 'condition' => [ |
| 1523 | 'pagination_type' => 'load_more', |
| 1524 | 'show_pagination' => 'show', |
| 1525 | ], |
| 1526 | ] |
| 1527 | ); |
| 1528 | |
| 1529 | |
| 1530 | $ref->end_controls_section(); |
| 1531 | } |
| 1532 | |
| 1533 | /** |
| 1534 | * Get Field Selections |
| 1535 | * |
| 1536 | * @param $ref |
| 1537 | */ |
| 1538 | |
| 1539 | public static function field_selection( $ref ) { |
| 1540 | $prefix = $ref->prefix; |
| 1541 | $ref->start_controls_section( |
| 1542 | 'field_selection_settings', |
| 1543 | [ |
| 1544 | 'label' => esc_html__( 'Field Selection', 'the-post-grid' ), |
| 1545 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 1546 | ] |
| 1547 | ); |
| 1548 | |
| 1549 | $ref->add_control( |
| 1550 | 'show_section_title', |
| 1551 | [ |
| 1552 | 'label' => esc_html__( 'Section Title', 'the-post-grid' ), |
| 1553 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1554 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1555 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1556 | 'return_value' => 'show', |
| 1557 | 'default' => 'show', |
| 1558 | 'render_type' => 'template', |
| 1559 | 'prefix_class' => 'section-title-visibility-', |
| 1560 | ] |
| 1561 | ); |
| 1562 | |
| 1563 | $ref->add_control( |
| 1564 | 'show_title', |
| 1565 | [ |
| 1566 | 'label' => esc_html__( 'Post Title', 'the-post-grid' ), |
| 1567 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1568 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1569 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1570 | 'return_value' => 'show', |
| 1571 | 'default' => 'show', |
| 1572 | 'render_type' => 'template', |
| 1573 | 'prefix_class' => 'title-visibility-', |
| 1574 | 'condition' => [ |
| 1575 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1576 | ], |
| 1577 | |
| 1578 | ] |
| 1579 | ); |
| 1580 | |
| 1581 | $ref->add_control( |
| 1582 | 'show_thumb', |
| 1583 | [ |
| 1584 | 'label' => esc_html__( 'Post Thumbnail', 'the-post-grid' ), |
| 1585 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1586 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1587 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1588 | 'return_value' => 'show', |
| 1589 | 'default' => 'show', |
| 1590 | 'render_type' => 'template', |
| 1591 | 'prefix_class' => 'thumbnail-visibility-', |
| 1592 | ] |
| 1593 | ); |
| 1594 | |
| 1595 | $ref->add_control( |
| 1596 | 'show_excerpt', |
| 1597 | [ |
| 1598 | 'label' => esc_html__( 'Post Excerpt', 'the-post-grid' ), |
| 1599 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1600 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1601 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1602 | 'return_value' => 'show', |
| 1603 | 'default' => 'show', |
| 1604 | 'render_type' => 'template', |
| 1605 | 'prefix_class' => 'excerpt-visibility-', |
| 1606 | 'condition' => [ |
| 1607 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1608 | ], |
| 1609 | ] |
| 1610 | ); |
| 1611 | |
| 1612 | $ref->add_control( |
| 1613 | 'show_meta', |
| 1614 | [ |
| 1615 | 'label' => esc_html__( 'Post Meta', 'the-post-grid' ), |
| 1616 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1617 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1618 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1619 | 'return_value' => 'show', |
| 1620 | 'default' => 'show', |
| 1621 | 'render_type' => 'template', |
| 1622 | 'prefix_class' => 'meta-visibility-', |
| 1623 | 'condition' => [ |
| 1624 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1625 | ], |
| 1626 | ] |
| 1627 | ); |
| 1628 | |
| 1629 | $ref->add_control( |
| 1630 | 'show_date', |
| 1631 | [ |
| 1632 | 'label' => esc_html__( 'Post Date', 'the-post-grid' ), |
| 1633 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1634 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1635 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1636 | 'return_value' => 'show', |
| 1637 | 'default' => 'show', |
| 1638 | 'render_type' => 'template', |
| 1639 | 'classes' => 'tpg-padding-left', |
| 1640 | 'prefix_class' => 'date-visibility-', |
| 1641 | 'condition' => [ |
| 1642 | 'show_meta' => 'show', |
| 1643 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1644 | ], |
| 1645 | ] |
| 1646 | ); |
| 1647 | |
| 1648 | $ref->add_control( |
| 1649 | 'show_category', |
| 1650 | [ |
| 1651 | 'label' => esc_html__( 'Post Categories', 'the-post-grid' ), |
| 1652 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1653 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1654 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1655 | 'return_value' => 'show', |
| 1656 | 'default' => 'show', |
| 1657 | 'render_type' => 'template', |
| 1658 | 'classes' => 'tpg-padding-left', |
| 1659 | 'prefix_class' => 'category-visibility-', |
| 1660 | 'condition' => [ |
| 1661 | 'show_meta' => 'show', |
| 1662 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1663 | ], |
| 1664 | ] |
| 1665 | ); |
| 1666 | |
| 1667 | $ref->add_control( |
| 1668 | 'show_author', |
| 1669 | [ |
| 1670 | 'label' => esc_html__( 'Post Author', 'the-post-grid' ), |
| 1671 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1672 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1673 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1674 | 'return_value' => 'show', |
| 1675 | 'default' => 'show', |
| 1676 | 'classes' => 'tpg-padding-left', |
| 1677 | 'condition' => [ |
| 1678 | 'show_meta' => 'show', |
| 1679 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1680 | ], |
| 1681 | ] |
| 1682 | ); |
| 1683 | |
| 1684 | $ref->add_control( |
| 1685 | 'show_tags', |
| 1686 | [ |
| 1687 | 'label' => esc_html__( 'Post Tags', 'the-post-grid' ), |
| 1688 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1689 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1690 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1691 | 'return_value' => 'show', |
| 1692 | 'default' => false, |
| 1693 | 'classes' => 'tpg-padding-left', |
| 1694 | 'condition' => [ |
| 1695 | 'show_meta' => 'show', |
| 1696 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1697 | ], |
| 1698 | ] |
| 1699 | ); |
| 1700 | |
| 1701 | $ref->add_control( |
| 1702 | 'show_comment_count', |
| 1703 | [ |
| 1704 | 'label' => esc_html__( 'Post Comment Count', 'the-post-grid' ), |
| 1705 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1706 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1707 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1708 | 'return_value' => 'show', |
| 1709 | 'default' => false, |
| 1710 | 'classes' => 'tpg-padding-left', |
| 1711 | 'condition' => [ |
| 1712 | 'show_meta' => 'show', |
| 1713 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1714 | ], |
| 1715 | ] |
| 1716 | ); |
| 1717 | |
| 1718 | $ref->add_control( |
| 1719 | 'show_post_count', |
| 1720 | [ |
| 1721 | 'label' => esc_html__( 'Post View Count', 'the-post-grid' ) . $ref->pro_label, |
| 1722 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1723 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1724 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1725 | 'return_value' => 'show', |
| 1726 | 'default' => false, |
| 1727 | 'classes' => rtTPG()->hasPro() ? 'tpg-padding-left' : 'the-post-grid-field-hide tpg-padding-left', |
| 1728 | |
| 1729 | 'condition' => [ |
| 1730 | 'show_meta' => 'show', |
| 1731 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1732 | ], |
| 1733 | ] |
| 1734 | ); |
| 1735 | |
| 1736 | $ref->add_control( |
| 1737 | 'show_read_more', |
| 1738 | [ |
| 1739 | 'label' => esc_html__( 'Read More Button', 'the-post-grid' ), |
| 1740 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1741 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1742 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1743 | 'return_value' => 'show', |
| 1744 | 'default' => false, |
| 1745 | 'condition' => [ |
| 1746 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1747 | ], |
| 1748 | ] |
| 1749 | ); |
| 1750 | |
| 1751 | $ref->add_control( |
| 1752 | 'show_social_share', |
| 1753 | [ |
| 1754 | 'label' => esc_html__( 'Social Share', 'the-post-grid' ) . $ref->pro_label, |
| 1755 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1756 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1757 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1758 | 'return_value' => 'show', |
| 1759 | 'default' => 'default', |
| 1760 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 1761 | 'condition' => [ |
| 1762 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1763 | ], |
| 1764 | ] |
| 1765 | ); |
| 1766 | |
| 1767 | $ref->add_control( |
| 1768 | 'show_woocommerce_rating', |
| 1769 | [ |
| 1770 | 'label' => esc_html__( 'Rating (WooCommerce)', 'the-post-grid' ), |
| 1771 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1772 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1773 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1774 | 'return_value' => 'show', |
| 1775 | 'default' => 'default', |
| 1776 | 'condition' => [ |
| 1777 | 'post_type' => [ 'product', 'download' ], |
| 1778 | ], |
| 1779 | ] |
| 1780 | ); |
| 1781 | |
| 1782 | $cf = Fns::is_acf(); |
| 1783 | if ( $cf ) { |
| 1784 | $ref->add_control( |
| 1785 | 'show_acf', |
| 1786 | [ |
| 1787 | 'label' => esc_html__( 'Advanced Custom Field', 'the-post-grid' ) . $ref->pro_label, |
| 1788 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1789 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1790 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1791 | 'return_value' => 'show', |
| 1792 | 'default' => false, |
| 1793 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 1794 | 'condition' => [ |
| 1795 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 1796 | ], |
| 1797 | ] |
| 1798 | ); |
| 1799 | } |
| 1800 | |
| 1801 | $ref->end_controls_section(); |
| 1802 | } |
| 1803 | |
| 1804 | |
| 1805 | /** |
| 1806 | * Section Title Settings |
| 1807 | * |
| 1808 | * @param $ref |
| 1809 | */ |
| 1810 | |
| 1811 | public static function section_title_settings( $ref, $layout_type = '' ) { |
| 1812 | $default = $layout_type == 'single' ? 'Related Posts' : 'Section Title'; |
| 1813 | $ref->start_controls_section( |
| 1814 | 'section_title_settings', |
| 1815 | [ |
| 1816 | 'label' => esc_html__( 'Section Title', 'the-post-grid' ), |
| 1817 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 1818 | 'condition' => [ |
| 1819 | 'show_section_title' => 'show', |
| 1820 | ], |
| 1821 | ] |
| 1822 | ); |
| 1823 | |
| 1824 | |
| 1825 | $ref->add_control( |
| 1826 | 'section_title_style', |
| 1827 | [ |
| 1828 | 'label' => esc_html__( 'Section Title Style', 'the-post-grid' ), |
| 1829 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1830 | 'default' => 'style1', |
| 1831 | 'options' => [ |
| 1832 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 1833 | 'style1' => esc_html__( 'Style 1', 'the-post-grid' ), |
| 1834 | 'style2' => esc_html__( 'Style 2', 'the-post-grid' ), |
| 1835 | 'style3' => esc_html__( 'Style 3', 'the-post-grid' ), |
| 1836 | ], |
| 1837 | 'prefix_class' => 'section-title-style-', |
| 1838 | 'render_type' => 'template', |
| 1839 | 'condition' => [ |
| 1840 | 'show_section_title' => 'show', |
| 1841 | ], |
| 1842 | ] |
| 1843 | ); |
| 1844 | |
| 1845 | if ( 'single' === $layout_type ) { |
| 1846 | $ref->add_control( |
| 1847 | 'section_title_source', |
| 1848 | [ |
| 1849 | 'label' => esc_html__( 'Title source', 'the-post-grid' ), |
| 1850 | 'type' => \Elementor\Controls_Manager::HIDDEN, |
| 1851 | 'default' => 'custom_title', |
| 1852 | ] |
| 1853 | ); |
| 1854 | } else { |
| 1855 | $ref->add_control( |
| 1856 | 'section_title_source', |
| 1857 | [ |
| 1858 | 'label' => esc_html__( 'Title Source', 'the-post-grid' ), |
| 1859 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1860 | 'default' => 'custom_title', |
| 1861 | 'options' => [ |
| 1862 | 'page_title' => esc_html__( 'Page Title', 'the-post-grid' ), |
| 1863 | 'custom_title' => esc_html__( 'Custom Title', 'the-post-grid' ), |
| 1864 | ], |
| 1865 | 'condition' => [ |
| 1866 | 'show_section_title' => 'show', |
| 1867 | ], |
| 1868 | ] |
| 1869 | ); |
| 1870 | } |
| 1871 | |
| 1872 | $ref->add_control( |
| 1873 | 'section_title_text', |
| 1874 | [ |
| 1875 | 'label' => esc_html__( 'Title', 'the-post-grid' ), |
| 1876 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1877 | 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ), |
| 1878 | 'default' => esc_html__( $default, 'the-post-grid' ), |
| 1879 | 'label_block' => true, |
| 1880 | 'condition' => [ |
| 1881 | 'section_title_source' => 'custom_title', |
| 1882 | 'show_section_title' => 'show', |
| 1883 | ], |
| 1884 | ] |
| 1885 | ); |
| 1886 | |
| 1887 | |
| 1888 | $ref->add_control( |
| 1889 | 'title_prefix', |
| 1890 | [ |
| 1891 | 'label' => esc_html__( 'Title Prefix Text', 'the-post-grid' ), |
| 1892 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1893 | 'placeholder' => esc_html__( 'Title prefix text', 'the-post-grid' ), |
| 1894 | 'condition' => [ |
| 1895 | 'section_title_source' => 'page_title', |
| 1896 | ], |
| 1897 | ] |
| 1898 | ); |
| 1899 | |
| 1900 | $ref->add_control( |
| 1901 | 'title_suffix', |
| 1902 | [ |
| 1903 | 'label' => esc_html__( 'Title Suffix Text', 'the-post-grid' ), |
| 1904 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1905 | 'placeholder' => esc_html__( 'Title suffix text', 'the-post-grid' ), |
| 1906 | 'condition' => [ |
| 1907 | 'section_title_source' => 'page_title', |
| 1908 | ], |
| 1909 | ] |
| 1910 | ); |
| 1911 | |
| 1912 | $ref->add_control( |
| 1913 | 'section_title_tag', |
| 1914 | [ |
| 1915 | 'label' => esc_html__( 'Title Tag', 'the-post-grid' ), |
| 1916 | 'type' => Controls_Manager::SELECT, |
| 1917 | 'default' => 'h2', |
| 1918 | 'options' => [ |
| 1919 | 'h1' => esc_html__( 'H1', 'the-post-grid' ), |
| 1920 | 'h2' => esc_html__( 'H2', 'the-post-grid' ), |
| 1921 | 'h3' => esc_html__( 'H3', 'the-post-grid' ), |
| 1922 | 'h4' => esc_html__( 'H4', 'the-post-grid' ), |
| 1923 | 'h5' => esc_html__( 'H5', 'the-post-grid' ), |
| 1924 | 'h6' => esc_html__( 'H6', 'the-post-grid' ), |
| 1925 | ], |
| 1926 | 'condition' => [ |
| 1927 | 'show_section_title' => 'show', |
| 1928 | ], |
| 1929 | ] |
| 1930 | ); |
| 1931 | |
| 1932 | if ( 'archive' == $layout_type ) { |
| 1933 | $ref->add_control( |
| 1934 | 'show_cat_desc', |
| 1935 | [ |
| 1936 | 'label' => esc_html__( 'Show Archive Description', 'the-post-grid' ), |
| 1937 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 1938 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 1939 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 1940 | 'return_value' => 'yes', |
| 1941 | 'default' => false, |
| 1942 | ] |
| 1943 | ); |
| 1944 | } |
| 1945 | |
| 1946 | $ref->end_controls_section(); |
| 1947 | } |
| 1948 | |
| 1949 | |
| 1950 | /** |
| 1951 | * Thumbnail Settings |
| 1952 | * |
| 1953 | * @param $ref |
| 1954 | */ |
| 1955 | |
| 1956 | public static function post_thumbnail_settings( $ref ) { |
| 1957 | $prefix = $ref->prefix; |
| 1958 | $ref->start_controls_section( |
| 1959 | 'post_thumbnail_settings', |
| 1960 | [ |
| 1961 | 'label' => esc_html__( 'Post Thumbnail', 'the-post-grid' ), |
| 1962 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 1963 | 'condition' => [ |
| 1964 | 'show_thumb' => 'show', |
| 1965 | ], |
| 1966 | ] |
| 1967 | ); |
| 1968 | |
| 1969 | |
| 1970 | $ref->add_control( |
| 1971 | 'media_source', |
| 1972 | [ |
| 1973 | 'label' => esc_html__( 'Media Source', 'the-post-grid' ), |
| 1974 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1975 | 'default' => 'feature_image', |
| 1976 | 'options' => [ |
| 1977 | 'feature_image' => esc_html__( 'Feature Image', 'the-post-grid' ), |
| 1978 | 'first_image' => esc_html__( 'First Image from content', 'the-post-grid' ), |
| 1979 | ], |
| 1980 | ] |
| 1981 | ); |
| 1982 | |
| 1983 | $thumb_exclude = ''; |
| 1984 | if ( ! rtTPG()->hasPro() ) { |
| 1985 | $thumb_exclude = 'custom'; |
| 1986 | } |
| 1987 | |
| 1988 | |
| 1989 | //Default Image |
| 1990 | $ref->add_group_control( |
| 1991 | \Elementor\Group_Control_Image_Size::get_type(), |
| 1992 | [ |
| 1993 | 'name' => 'image', |
| 1994 | 'exclude' => [ $thumb_exclude ], |
| 1995 | 'default' => 'medium_large', |
| 1996 | 'label' => $ref->get_pro_message( "custom dimension." ), |
| 1997 | 'condition' => [ |
| 1998 | 'media_source' => 'feature_image', |
| 1999 | ], |
| 2000 | ] |
| 2001 | ); |
| 2002 | |
| 2003 | $ref->add_control( |
| 2004 | 'img_crop_style', |
| 2005 | [ |
| 2006 | 'label' => esc_html__( 'Image Crop Style', 'the-post-grid' ), |
| 2007 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2008 | 'default' => 'hard', |
| 2009 | 'options' => [ |
| 2010 | 'soft' => esc_html__( 'Soft Crop', 'the-post-grid' ), |
| 2011 | 'hard' => esc_html__( 'Hard Crop', 'the-post-grid' ), |
| 2012 | ], |
| 2013 | 'condition' => [ |
| 2014 | 'image_size' => 'custom', |
| 2015 | 'media_source' => 'feature_image', |
| 2016 | ], |
| 2017 | ] |
| 2018 | ); |
| 2019 | |
| 2020 | |
| 2021 | $thumb_condition = [ |
| 2022 | 'media_source' => 'feature_image', |
| 2023 | 'grid_layout' => [ 'grid-layout5', 'grid-layout5-2', 'grid-layout6', 'grid-layout6-2' ], |
| 2024 | ]; |
| 2025 | |
| 2026 | if ( $ref->prefix === 'list' ) { |
| 2027 | $thumb_condition = [ |
| 2028 | 'media_source' => 'feature_image', |
| 2029 | 'list_layout' => [ 'list-layout2', 'list-layout3', 'list-layout2-2', 'list-layout3-2' ], |
| 2030 | ]; |
| 2031 | } |
| 2032 | |
| 2033 | if ( $ref->prefix === 'grid_hover' ) { |
| 2034 | $thumb_condition = [ |
| 2035 | 'media_source' => 'feature_image', |
| 2036 | 'grid_hover_layout' => [ |
| 2037 | 'grid_hover-layout4', |
| 2038 | 'grid_hover-layout4-2', |
| 2039 | 'grid_hover-layout5', |
| 2040 | 'grid_hover-layout5-2', |
| 2041 | 'grid_hover-layout6', |
| 2042 | 'grid_hover-layout6-2', |
| 2043 | 'grid_hover-layout7', |
| 2044 | 'grid_hover-layout7-2', |
| 2045 | 'grid_hover-layout9', |
| 2046 | 'grid_hover-layout9-2', |
| 2047 | ], |
| 2048 | ]; |
| 2049 | } |
| 2050 | if ( $ref->prefix === 'slider' ) { |
| 2051 | $thumb_condition = [ |
| 2052 | 'media_source' => 'feature_image', |
| 2053 | 'slider_layout' => [ 'slider-layout10' ], |
| 2054 | ]; |
| 2055 | } |
| 2056 | |
| 2057 | //Offset Image |
| 2058 | $ref->add_group_control( |
| 2059 | \Elementor\Group_Control_Image_Size::get_type(), |
| 2060 | [ |
| 2061 | 'name' => 'image_offset', |
| 2062 | 'exclude' => [ 'custom' ], |
| 2063 | 'default' => 'medium_large', |
| 2064 | 'condition' => $thumb_condition, |
| 2065 | 'classes' => 'tpg-offset-thumb-size', |
| 2066 | ] |
| 2067 | ); |
| 2068 | |
| 2069 | if ( 'list' == $prefix ) { |
| 2070 | $ref->add_responsive_control( |
| 2071 | 'list_image_side_width', |
| 2072 | [ |
| 2073 | 'label' => esc_html__( 'List Image Width', 'the-post-grid' ), |
| 2074 | 'type' => Controls_Manager::SLIDER, |
| 2075 | 'size_units' => [ 'px', '%' ], |
| 2076 | 'range' => [ |
| 2077 | 'px' => [ |
| 2078 | 'min' => 0, |
| 2079 | 'max' => 700, |
| 2080 | 'step' => 5, |
| 2081 | ], |
| 2082 | '%' => [ |
| 2083 | 'min' => 0, |
| 2084 | 'max' => 100, |
| 2085 | ], |
| 2086 | ], |
| 2087 | 'selectors' => [ |
| 2088 | '{{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}};', |
| 2089 | ], |
| 2090 | 'condition' => [ |
| 2091 | 'list_layout!' => [ 'list-layout4' ], |
| 2092 | ], |
| 2093 | ] |
| 2094 | ); |
| 2095 | } |
| 2096 | |
| 2097 | if ( rtTPG()->hasPro() ) { |
| 2098 | $ref->add_responsive_control( |
| 2099 | 'image_height', |
| 2100 | [ |
| 2101 | 'label' => esc_html__( 'Image Height', 'the-post-grid' ), |
| 2102 | 'type' => Controls_Manager::SLIDER, |
| 2103 | 'size_units' => [ '%', 'px' ], |
| 2104 | 'range' => [ |
| 2105 | '%' => [ |
| 2106 | 'min' => 0, |
| 2107 | 'max' => 100, |
| 2108 | ], |
| 2109 | 'px' => [ |
| 2110 | 'min' => 0, |
| 2111 | 'max' => 1000, |
| 2112 | 'step' => 1, |
| 2113 | ], |
| 2114 | ], |
| 2115 | 'selectors' => [ |
| 2116 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader > :not(.offset-right) .tpg-el-image-wrap' => 'height: {{SIZE}}{{UNIT}};', |
| 2117 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader > :not(.offset-right) .tpg-el-image-wrap img' => 'height: {{SIZE}}{{UNIT}};', |
| 2118 | '{{WRAPPER}} .tpg-el-main-wrapper.slider-layout11-main .rt-grid-hover-item .rt-holder .rt-el-content-wrapper' => 'height: {{SIZE}}{{UNIT}};', |
| 2119 | '{{WRAPPER}} .tpg-el-main-wrapper.slider-layout12-main .rt-grid-hover-item .rt-holder .rt-el-content-wrapper' => 'height: {{SIZE}}{{UNIT}};', |
| 2120 | ], |
| 2121 | ] |
| 2122 | ); |
| 2123 | |
| 2124 | $ref->add_responsive_control( |
| 2125 | 'offset_image_height', |
| 2126 | [ |
| 2127 | 'label' => esc_html__( 'Offset Image Height', 'the-post-grid' ), |
| 2128 | 'type' => Controls_Manager::SLIDER, |
| 2129 | 'size_units' => [ '%', 'px' ], |
| 2130 | 'range' => [ |
| 2131 | '%' => [ |
| 2132 | 'min' => 0, |
| 2133 | 'max' => 100, |
| 2134 | ], |
| 2135 | 'px' => [ |
| 2136 | 'min' => 0, |
| 2137 | 'max' => 1000, |
| 2138 | 'step' => 1, |
| 2139 | ], |
| 2140 | ], |
| 2141 | 'condition' => $thumb_condition, |
| 2142 | 'selectors' => [ |
| 2143 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader .offset-right .tpg-el-image-wrap' => 'height: {{SIZE}}{{UNIT}};', |
| 2144 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader .offset-right .tpg-el-image-wrap img' => 'height: {{SIZE}}{{UNIT}};', |
| 2145 | ], |
| 2146 | ] |
| 2147 | ); |
| 2148 | } |
| 2149 | |
| 2150 | $ref->add_control( |
| 2151 | 'hover_animation', |
| 2152 | [ |
| 2153 | 'label' => esc_html__( 'Image Hover Animation', 'the-post-grid' ), |
| 2154 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2155 | 'default' => 'default', |
| 2156 | 'options' => [ |
| 2157 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2158 | 'img_zoom_in' => esc_html__( 'Zoom In', 'the-post-grid' ), |
| 2159 | 'img_zoom_out' => esc_html__( 'Zoom Out', 'the-post-grid' ), |
| 2160 | 'slide_to_right' => esc_html__( 'Slide to Right', 'the-post-grid' ), |
| 2161 | 'slide_to_left' => esc_html__( 'Slide to Left', 'the-post-grid' ), |
| 2162 | 'img_no_effect' => esc_html__( 'None', 'the-post-grid' ), |
| 2163 | ], |
| 2164 | 'render_type' => 'template', |
| 2165 | 'prefix_class' => 'img_hover_animation_', |
| 2166 | ] |
| 2167 | ); |
| 2168 | |
| 2169 | $ref->add_control( |
| 2170 | 'is_thumb_lightbox', |
| 2171 | [ |
| 2172 | 'label' => esc_html__( 'Light Box', 'the-post-grid' ) . $ref->pro_label, |
| 2173 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2174 | 'default' => 'default', |
| 2175 | 'options' => [ |
| 2176 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2177 | 'show' => esc_html__( 'Show', 'the-post-grid' ), |
| 2178 | 'hide' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2179 | ], |
| 2180 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2181 | ] |
| 2182 | ); |
| 2183 | |
| 2184 | $ref->add_control( |
| 2185 | 'light_box_icon', |
| 2186 | [ |
| 2187 | 'label' => esc_html__( 'Light Box Icon', 'the-post-grid' ), |
| 2188 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2189 | 'default' => [ |
| 2190 | 'value' => 'fas fa-plus', |
| 2191 | 'library' => 'solid', |
| 2192 | ], |
| 2193 | 'condition' => [ |
| 2194 | 'is_thumb_lightbox' => 'show', |
| 2195 | ], |
| 2196 | ] |
| 2197 | ); |
| 2198 | |
| 2199 | $ref->add_control( |
| 2200 | 'is_default_img', |
| 2201 | [ |
| 2202 | 'label' => esc_html__( 'Enable Default Image', 'the-post-grid' ) . $ref->pro_label, |
| 2203 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2204 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 2205 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2206 | 'return_value' => 'yes', |
| 2207 | 'default' => false, |
| 2208 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2209 | ] |
| 2210 | ); |
| 2211 | |
| 2212 | |
| 2213 | $ref->add_control( |
| 2214 | 'default_image', |
| 2215 | [ |
| 2216 | 'label' => esc_html__( 'Default Image', 'the-post-grid' ) . $ref->pro_label, |
| 2217 | 'type' => \Elementor\Controls_Manager::MEDIA, |
| 2218 | 'default' => [ |
| 2219 | 'url' => rtTPG()->get_assets_uri( 'images/placeholder.png' ), |
| 2220 | ], |
| 2221 | 'condition' => [ |
| 2222 | 'is_default_img' => 'yes', |
| 2223 | ], |
| 2224 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2225 | ] |
| 2226 | ); |
| 2227 | |
| 2228 | $ref->end_controls_section(); |
| 2229 | } |
| 2230 | |
| 2231 | |
| 2232 | /** |
| 2233 | * Post Title Settings |
| 2234 | * |
| 2235 | * @param $ref |
| 2236 | */ |
| 2237 | |
| 2238 | public static function post_title_settings( $ref ) { |
| 2239 | $prefix = $ref->prefix; |
| 2240 | |
| 2241 | $ref->start_controls_section( |
| 2242 | 'post_title_settings', |
| 2243 | [ |
| 2244 | 'label' => esc_html__( 'Post Title', 'the-post-grid' ), |
| 2245 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 2246 | 'condition' => [ |
| 2247 | 'show_title' => 'show', |
| 2248 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 2249 | ], |
| 2250 | ] |
| 2251 | ); |
| 2252 | |
| 2253 | $ref->add_control( |
| 2254 | 'title_tag', |
| 2255 | [ |
| 2256 | 'label' => esc_html__( 'Title Tag', 'the-post-grid' ), |
| 2257 | 'type' => Controls_Manager::SELECT, |
| 2258 | 'default' => 'h3', |
| 2259 | 'options' => [ |
| 2260 | 'h1' => esc_html__( 'H1', 'the-post-grid' ), |
| 2261 | 'h2' => esc_html__( 'H2', 'the-post-grid' ), |
| 2262 | 'h3' => esc_html__( 'H3', 'the-post-grid' ), |
| 2263 | 'h4' => esc_html__( 'H4', 'the-post-grid' ), |
| 2264 | 'h5' => esc_html__( 'H5', 'the-post-grid' ), |
| 2265 | 'h6' => esc_html__( 'H6', 'the-post-grid' ), |
| 2266 | ], |
| 2267 | ] |
| 2268 | ); |
| 2269 | |
| 2270 | $ref->add_control( |
| 2271 | 'title_visibility_style', |
| 2272 | [ |
| 2273 | 'label' => esc_html__( 'Title Visibility Style', 'the-post-grid' ), |
| 2274 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2275 | 'default' => 'default', |
| 2276 | 'options' => [ |
| 2277 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2278 | 'one-line' => esc_html__( 'Show in 1 line', 'the-post-grid' ), |
| 2279 | 'two-line' => esc_html__( 'Show in 2 lines', 'the-post-grid' ), |
| 2280 | 'three-line' => esc_html__( 'Show in 3 lines', 'the-post-grid' ), |
| 2281 | 'custom' => esc_html__( 'Custom', 'the-post-grid' ), |
| 2282 | ], |
| 2283 | 'render_type' => 'template', |
| 2284 | 'prefix_class' => 'title-', |
| 2285 | ] |
| 2286 | ); |
| 2287 | |
| 2288 | $ref->add_control( |
| 2289 | 'title_limit', |
| 2290 | [ |
| 2291 | 'label' => esc_html__( 'Title Length', 'the-post-grid' ), |
| 2292 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 2293 | 'step' => 1, |
| 2294 | 'classes' => 'tpg-padding-left', |
| 2295 | 'condition' => [ |
| 2296 | 'title_visibility_style' => 'custom', |
| 2297 | ], |
| 2298 | ] |
| 2299 | ); |
| 2300 | |
| 2301 | $ref->add_control( |
| 2302 | 'title_limit_type', |
| 2303 | [ |
| 2304 | 'label' => esc_html__( 'Title Crop by', 'the-post-grid' ), |
| 2305 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2306 | 'default' => 'word', |
| 2307 | 'options' => [ |
| 2308 | 'word' => esc_html__( 'Words', 'the-post-grid' ), |
| 2309 | 'character' => esc_html__( 'Characters', 'the-post-grid' ), |
| 2310 | ], |
| 2311 | 'classes' => 'tpg-padding-left', |
| 2312 | 'conditions' => [ |
| 2313 | 'relation' => 'and', |
| 2314 | 'terms' => [ |
| 2315 | [ |
| 2316 | 'name' => 'title_limit', |
| 2317 | 'operator' => '>', |
| 2318 | 'value' => 0, |
| 2319 | ], |
| 2320 | [ |
| 2321 | 'name' => 'title_visibility_style', |
| 2322 | 'operator' => '==', |
| 2323 | 'value' => 'custom', |
| 2324 | ], |
| 2325 | ], |
| 2326 | |
| 2327 | ], |
| 2328 | ] |
| 2329 | ); |
| 2330 | |
| 2331 | $title_position = [ |
| 2332 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2333 | ]; |
| 2334 | if ( rtTPG()->hasPro() ) { |
| 2335 | $title_position_pro = [ |
| 2336 | 'above_image' => esc_html__( 'Above Image', 'the-post-grid' ), |
| 2337 | 'below_image' => esc_html__( 'Below Image', 'the-post-grid' ), |
| 2338 | ]; |
| 2339 | $title_position = array_merge( $title_position, $title_position_pro ); |
| 2340 | } |
| 2341 | |
| 2342 | $ref->add_control( |
| 2343 | 'title_position', |
| 2344 | [ |
| 2345 | 'label' => esc_html__( 'Title Position', 'the-post-grid' ) . $ref->pro_label, |
| 2346 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2347 | 'default' => 'default', |
| 2348 | 'prefix_class' => 'title_position_', |
| 2349 | 'render_type' => 'template', |
| 2350 | 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field', |
| 2351 | 'options' => $title_position, |
| 2352 | 'description' => $ref->get_pro_message( 'more position (above/below image)' ), |
| 2353 | 'condition' => [ |
| 2354 | $prefix . '_layout' => [ |
| 2355 | 'grid-layout1', |
| 2356 | 'grid-layout2', |
| 2357 | 'grid-layout3', |
| 2358 | 'grid-layout4', |
| 2359 | 'slider-layout1', |
| 2360 | 'slider-layout2', |
| 2361 | 'slider-layout3', |
| 2362 | ], |
| 2363 | ], |
| 2364 | ] |
| 2365 | ); |
| 2366 | |
| 2367 | $ref->add_control( |
| 2368 | 'title_position_hidden', |
| 2369 | [ |
| 2370 | 'label' => esc_html__( 'Title Position', 'the-post-grid' ), |
| 2371 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2372 | 'default' => 'default', |
| 2373 | 'prefix_class' => 'title_position_', |
| 2374 | 'render_type' => 'template', |
| 2375 | 'classes' => 'tpg-should-hide-field', |
| 2376 | 'options' => [ |
| 2377 | 'default' => esc_html__( 'Default', 'the-post-grid' ) |
| 2378 | ], |
| 2379 | 'condition' => [ |
| 2380 | $prefix . '_layout!' => [ |
| 2381 | 'grid-layout1', |
| 2382 | 'grid-layout2', |
| 2383 | 'grid-layout3', |
| 2384 | 'grid-layout4', |
| 2385 | 'slider-layout1', |
| 2386 | 'slider-layout2', |
| 2387 | 'slider-layout3', |
| 2388 | ], |
| 2389 | ], |
| 2390 | ] |
| 2391 | ); |
| 2392 | |
| 2393 | $ref->add_control( |
| 2394 | 'title_hover_underline', |
| 2395 | [ |
| 2396 | 'label' => esc_html__( 'Title Hover Underline', 'the-post-grid' ), |
| 2397 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2398 | 'default' => 'default', |
| 2399 | 'prefix_class' => 'title_hover_border_', |
| 2400 | 'render_type' => 'template', |
| 2401 | 'options' => [ |
| 2402 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2403 | 'enable' => esc_html__( 'Enable', 'the-post-grid' ), |
| 2404 | 'disable' => esc_html__( 'Disable', 'the-post-grid' ), |
| 2405 | ], |
| 2406 | ] |
| 2407 | ); |
| 2408 | |
| 2409 | |
| 2410 | $ref->end_controls_section(); |
| 2411 | } |
| 2412 | |
| 2413 | |
| 2414 | /** |
| 2415 | * Post Excerpt Settings |
| 2416 | * |
| 2417 | * @param $ref |
| 2418 | */ |
| 2419 | |
| 2420 | public static function post_excerpt_settings( $ref ) { |
| 2421 | $prefix = $ref->prefix; |
| 2422 | |
| 2423 | $ref->start_controls_section( |
| 2424 | 'post_excerpt_settings', |
| 2425 | [ |
| 2426 | 'label' => esc_html__( 'Excerpt', 'the-post-grid' ), |
| 2427 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 2428 | 'condition' => [ |
| 2429 | 'show_excerpt' => 'show', |
| 2430 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 2431 | ], |
| 2432 | ] |
| 2433 | ); |
| 2434 | |
| 2435 | $excerpt_type = [ |
| 2436 | 'character' => esc_html__( 'Character', 'the-post-grid' ), |
| 2437 | 'word' => esc_html__( 'Word', 'the-post-grid' ), |
| 2438 | ]; |
| 2439 | |
| 2440 | |
| 2441 | if ( in_array( $prefix, [ 'grid', 'list' ] ) ) { |
| 2442 | $excerpt_type['full'] = esc_html__( 'Full Content', 'the-post-grid' ); |
| 2443 | } |
| 2444 | |
| 2445 | $ref->add_control( |
| 2446 | 'excerpt_type', |
| 2447 | [ |
| 2448 | 'label' => esc_html__( 'Excerpt Type', 'the-post-grid' ), |
| 2449 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2450 | 'default' => 'character', |
| 2451 | 'options' => $excerpt_type, |
| 2452 | ] |
| 2453 | ); |
| 2454 | |
| 2455 | $default_excerpt_limit = 100; |
| 2456 | if ( 'grid' == $prefix ) { |
| 2457 | $default_excerpt_limit = 200; |
| 2458 | } |
| 2459 | |
| 2460 | $ref->add_control( |
| 2461 | 'excerpt_limit', |
| 2462 | [ |
| 2463 | 'label' => esc_html__( 'Excerpt Limit', 'the-post-grid' ), |
| 2464 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 2465 | 'step' => 1, |
| 2466 | 'default' => $default_excerpt_limit, |
| 2467 | 'condition' => [ |
| 2468 | 'excerpt_type' => [ 'character', 'word' ], |
| 2469 | ], |
| 2470 | ] |
| 2471 | ); |
| 2472 | |
| 2473 | $ref->add_control( |
| 2474 | 'excerpt_more_text', |
| 2475 | [ |
| 2476 | 'label' => esc_html__( 'Expansion Indicator', 'the-post-grid' ), |
| 2477 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 2478 | 'default' => '...', |
| 2479 | 'condition' => [ |
| 2480 | 'excerpt_type' => [ 'character', 'word' ], |
| 2481 | ], |
| 2482 | ] |
| 2483 | ); |
| 2484 | |
| 2485 | $ref->end_controls_section(); |
| 2486 | } |
| 2487 | |
| 2488 | /** |
| 2489 | * Post Meta Settings |
| 2490 | * |
| 2491 | * @param $ref |
| 2492 | */ |
| 2493 | |
| 2494 | public static function post_meta_settings( $ref ) { |
| 2495 | $prefix = $ref->prefix; |
| 2496 | |
| 2497 | $ref->start_controls_section( |
| 2498 | 'post_meta_settings', |
| 2499 | [ |
| 2500 | 'label' => esc_html__( 'Meta Data', 'the-post-grid' ), |
| 2501 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 2502 | 'conditions' => [ |
| 2503 | 'relation' => 'or', |
| 2504 | 'terms' => [ |
| 2505 | [ |
| 2506 | 'name' => 'show_date', |
| 2507 | 'operator' => '==', |
| 2508 | 'value' => 'show', |
| 2509 | ], |
| 2510 | [ |
| 2511 | 'name' => 'show_category', |
| 2512 | 'operator' => '==', |
| 2513 | 'value' => 'show', |
| 2514 | ], |
| 2515 | [ |
| 2516 | 'name' => 'show_author', |
| 2517 | 'operator' => '==', |
| 2518 | 'value' => 'show', |
| 2519 | ], |
| 2520 | [ |
| 2521 | 'name' => 'show_tags', |
| 2522 | 'operator' => '==', |
| 2523 | 'value' => 'show', |
| 2524 | ], |
| 2525 | [ |
| 2526 | 'name' => 'show_comment_count', |
| 2527 | 'operator' => '==', |
| 2528 | 'value' => 'show', |
| 2529 | ], |
| 2530 | [ |
| 2531 | 'name' => 'show_post_count', |
| 2532 | 'operator' => '==', |
| 2533 | 'value' => 'show', |
| 2534 | ], |
| 2535 | ], |
| 2536 | ], |
| 2537 | 'condition' => [ |
| 2538 | 'show_meta' => 'show', |
| 2539 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 2540 | ], |
| 2541 | ] |
| 2542 | ); |
| 2543 | |
| 2544 | $meta_position = [ |
| 2545 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2546 | ]; |
| 2547 | if ( rtTPG()->hasPro() ) { |
| 2548 | $meta_position_pro = [ |
| 2549 | 'above_title' => esc_html__( 'Above Title', 'the-post-grid' ), |
| 2550 | 'below_title' => esc_html__( 'Below Title', 'the-post-grid' ), |
| 2551 | 'above_excerpt' => esc_html__( 'Above excerpt', 'the-post-grid' ), |
| 2552 | 'below_excerpt' => esc_html__( 'Below excerpt', 'the-post-grid' ), |
| 2553 | ]; |
| 2554 | $meta_position = array_merge( $meta_position, $meta_position_pro ); |
| 2555 | } |
| 2556 | |
| 2557 | $ref->add_control( |
| 2558 | 'meta_position', |
| 2559 | [ |
| 2560 | 'label' => esc_html__( 'Meta Position', 'the-post-grid' ) . $ref->pro_label, |
| 2561 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2562 | 'default' => 'default', |
| 2563 | 'prefix_class' => 'meta_position_', |
| 2564 | 'render_type' => 'template', |
| 2565 | 'options' => $meta_position, |
| 2566 | 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field', |
| 2567 | ] |
| 2568 | ); |
| 2569 | |
| 2570 | $ref->add_control( |
| 2571 | 'show_meta_icon', |
| 2572 | [ |
| 2573 | 'label' => esc_html__( 'Show Meta Icon', 'the-post-grid' ), |
| 2574 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2575 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 2576 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2577 | 'return_value' => 'yes', |
| 2578 | 'default' => 'yes', |
| 2579 | ] |
| 2580 | ); |
| 2581 | |
| 2582 | $ref->add_control( |
| 2583 | 'meta_separator', |
| 2584 | [ |
| 2585 | 'label' => esc_html__( 'Meta Separator', 'the-post-grid' ), |
| 2586 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2587 | 'default' => 'default', |
| 2588 | 'options' => [ |
| 2589 | 'default' => esc_html__( 'Default - None', 'the-post-grid' ), |
| 2590 | '.' => esc_html__( 'Dot ( . )', 'the-post-grid' ), |
| 2591 | '/' => esc_html__( 'Single Slash ( / )', 'the-post-grid' ), |
| 2592 | '//' => esc_html__( 'Double Slash ( // )', 'the-post-grid' ), |
| 2593 | '-' => esc_html__( 'Hyphen ( - )', 'the-post-grid' ), |
| 2594 | '|' => esc_html__( 'Vertical Pipe ( | )', 'the-post-grid' ), |
| 2595 | ], |
| 2596 | ] |
| 2597 | ); |
| 2598 | |
| 2599 | |
| 2600 | $ref->add_control( |
| 2601 | 'meta_popover_toggle', |
| 2602 | [ |
| 2603 | 'label' => esc_html__( 'Change Meta Icon', 'the-post-grid' ), |
| 2604 | 'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE, |
| 2605 | 'label_off' => esc_html__( 'Default', 'the-post-grid' ), |
| 2606 | 'label_on' => esc_html__( 'Custom', 'the-post-grid' ), |
| 2607 | 'return_value' => 'yes', |
| 2608 | 'condition' => [ |
| 2609 | 'show_meta_icon' => 'yes', |
| 2610 | ], |
| 2611 | ] |
| 2612 | ); |
| 2613 | |
| 2614 | $ref->start_popover(); |
| 2615 | |
| 2616 | $ref->add_control( |
| 2617 | 'user_icon', |
| 2618 | [ |
| 2619 | 'label' => esc_html__( 'Author Icon', 'the-post-grid' ), |
| 2620 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2621 | 'default' => [ |
| 2622 | 'value' => 'fas fa-user', |
| 2623 | 'library' => 'solid', |
| 2624 | ], |
| 2625 | 'condition' => [ |
| 2626 | 'show_author_image!' => 'show', |
| 2627 | ], |
| 2628 | ] |
| 2629 | ); |
| 2630 | |
| 2631 | $ref->add_control( |
| 2632 | 'cat_icon', |
| 2633 | [ |
| 2634 | 'label' => esc_html__( 'Category Icon', 'the-post-grid' ), |
| 2635 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2636 | 'default' => [ |
| 2637 | 'value' => 'fas fa-folder-open', |
| 2638 | 'library' => 'solid', |
| 2639 | ], |
| 2640 | 'condition' => [ |
| 2641 | 'show_category' => 'show', |
| 2642 | ], |
| 2643 | ] |
| 2644 | ); |
| 2645 | |
| 2646 | $ref->add_control( |
| 2647 | 'date_icon', |
| 2648 | [ |
| 2649 | 'label' => esc_html__( 'Date Icon', 'the-post-grid' ), |
| 2650 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2651 | 'default' => [ |
| 2652 | 'value' => 'far fa-calendar-alt', |
| 2653 | 'library' => 'solid', |
| 2654 | ], |
| 2655 | 'condition' => [ |
| 2656 | 'show_date' => 'show', |
| 2657 | ], |
| 2658 | ] |
| 2659 | ); |
| 2660 | |
| 2661 | $ref->add_control( |
| 2662 | 'tag_icon', |
| 2663 | [ |
| 2664 | 'label' => esc_html__( 'Tags Icon', 'the-post-grid' ), |
| 2665 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2666 | 'default' => [ |
| 2667 | 'value' => 'fa fa-tags', |
| 2668 | 'library' => 'solid', |
| 2669 | ], |
| 2670 | 'condition' => [ |
| 2671 | 'show_tags' => 'show', |
| 2672 | ], |
| 2673 | ] |
| 2674 | ); |
| 2675 | |
| 2676 | $ref->add_control( |
| 2677 | 'comment_icon', |
| 2678 | [ |
| 2679 | 'label' => esc_html__( 'Comment Icon', 'the-post-grid' ), |
| 2680 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2681 | 'default' => [ |
| 2682 | 'value' => 'fas fa-comments', |
| 2683 | 'library' => 'solid', |
| 2684 | ], |
| 2685 | 'condition' => [ |
| 2686 | 'show_comment_count' => 'show', |
| 2687 | ], |
| 2688 | ] |
| 2689 | ); |
| 2690 | |
| 2691 | $ref->add_control( |
| 2692 | 'post_count_icon', |
| 2693 | [ |
| 2694 | 'label' => esc_html__( 'Post Count Icon', 'the-post-grid' ), |
| 2695 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 2696 | 'default' => [ |
| 2697 | 'value' => 'fas fa-eye', |
| 2698 | 'library' => 'solid', |
| 2699 | ], |
| 2700 | 'condition' => [ |
| 2701 | 'show_post_count' => 'show', |
| 2702 | ], |
| 2703 | ] |
| 2704 | ); |
| 2705 | |
| 2706 | $ref->end_popover(); |
| 2707 | |
| 2708 | |
| 2709 | /** |
| 2710 | * TODO: Author Style |
| 2711 | * ******************** |
| 2712 | */ |
| 2713 | |
| 2714 | $ref->add_control( |
| 2715 | 'meta_author_divider', |
| 2716 | [ |
| 2717 | 'type' => \Elementor\Controls_Manager::DIVIDER, |
| 2718 | 'condition' => [ |
| 2719 | 'show_author!' => '', |
| 2720 | ], |
| 2721 | ] |
| 2722 | ); |
| 2723 | |
| 2724 | $ref->add_control( |
| 2725 | 'meta_author_heading', |
| 2726 | [ |
| 2727 | 'label' => esc_html__( 'Author Setting:', 'the-post-grid' ), |
| 2728 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2729 | 'classes' => 'tpg-control-type-heading', |
| 2730 | 'condition' => [ |
| 2731 | 'show_author!' => '', |
| 2732 | ], |
| 2733 | ] |
| 2734 | ); |
| 2735 | |
| 2736 | $ref->add_control( |
| 2737 | 'author_prefix', |
| 2738 | [ |
| 2739 | 'label' => esc_html__( 'Author Prefix', 'the-post-grid' ), |
| 2740 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 2741 | 'placeholder' => esc_html__( 'By', 'the-post-grid' ), |
| 2742 | 'condition' => [ |
| 2743 | 'show_author!' => '', |
| 2744 | ], |
| 2745 | ] |
| 2746 | ); |
| 2747 | |
| 2748 | $ref->add_control( |
| 2749 | 'author_icon_visibility', |
| 2750 | [ |
| 2751 | 'label' => esc_html__( 'Author Icon Visibility', 'the-post-grid' ), |
| 2752 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2753 | 'default' => 'default', |
| 2754 | 'options' => [ |
| 2755 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2756 | 'hide' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2757 | 'show' => esc_html__( 'Show', 'the-post-grid' ), |
| 2758 | ], |
| 2759 | 'condition' => [ |
| 2760 | 'show_author!' => '', |
| 2761 | ], |
| 2762 | 'prefix_class' => 'tpg-is-author-icon-', |
| 2763 | ] |
| 2764 | ); |
| 2765 | |
| 2766 | $ref->add_control( |
| 2767 | 'show_author_image', |
| 2768 | [ |
| 2769 | 'label' => esc_html__( 'Author Image / Icon', 'the-post-grid' ), |
| 2770 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2771 | 'label_on' => esc_html__( 'Image', 'the-post-grid' ), |
| 2772 | 'label_off' => esc_html__( 'Icon', 'the-post-grid' ), |
| 2773 | 'return_value' => 'show', |
| 2774 | 'default' => 'show', |
| 2775 | 'render_type' => 'template', |
| 2776 | 'prefix_class' => 'author-image-visibility-', |
| 2777 | 'condition' => [ |
| 2778 | 'show_author!' => '', |
| 2779 | 'author_icon_visibility!' => 'hide', |
| 2780 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 2781 | ], |
| 2782 | ] |
| 2783 | ); |
| 2784 | |
| 2785 | $ref->add_responsive_control( |
| 2786 | 'author_icon_width', |
| 2787 | [ |
| 2788 | 'label' => esc_html__( 'Author Image Width', 'the-post-grid' ), |
| 2789 | 'type' => Controls_Manager::SLIDER, |
| 2790 | 'size_units' => [ 'px' ], |
| 2791 | 'range' => [ |
| 2792 | 'px' => [ |
| 2793 | 'min' => 10, |
| 2794 | 'max' => 100, |
| 2795 | 'step' => 1, |
| 2796 | ], |
| 2797 | ], |
| 2798 | 'selectors' => [ |
| 2799 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags span img' => 'width: {{SIZE}}{{UNIT}} !important;max-width:{{SIZE}}{{UNIT}};height:{{SIZE}}{{UNIT}} !important;', |
| 2800 | ], |
| 2801 | 'condition' => [ |
| 2802 | 'show_author!' => '', |
| 2803 | 'show_author_image!' => '', |
| 2804 | ], |
| 2805 | ] |
| 2806 | ); |
| 2807 | |
| 2808 | /** |
| 2809 | * TODO: Category Style |
| 2810 | * ******************** |
| 2811 | */ |
| 2812 | |
| 2813 | $ref->add_control( |
| 2814 | 'category_heading', |
| 2815 | [ |
| 2816 | 'label' => esc_html__( 'Category and Tags Setting:', 'the-post-grid' ), |
| 2817 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2818 | 'classes' => 'tpg-control-type-heading', |
| 2819 | 'conditions' => [ |
| 2820 | 'relation' => 'or', |
| 2821 | 'terms' => [ |
| 2822 | [ |
| 2823 | 'name' => 'show_category', |
| 2824 | 'operator' => '==', |
| 2825 | 'value' => 'show', |
| 2826 | ], |
| 2827 | [ |
| 2828 | 'name' => 'show_tags', |
| 2829 | 'operator' => '==', |
| 2830 | 'value' => 'show', |
| 2831 | ], |
| 2832 | ], |
| 2833 | ], |
| 2834 | ] |
| 2835 | ); |
| 2836 | |
| 2837 | |
| 2838 | $ref->add_control( |
| 2839 | 'category_position', |
| 2840 | [ |
| 2841 | 'label' => esc_html__( 'Category Position', 'the-post-grid' ) . $ref->pro_label, |
| 2842 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2843 | 'default' => 'default', |
| 2844 | 'options' => [ |
| 2845 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 2846 | 'above_title' => esc_html__( 'Above Title', 'the-post-grid' ), |
| 2847 | 'with_meta' => esc_html__( 'With Meta', 'the-post-grid' ), |
| 2848 | 'top_left' => esc_html__( 'Over image (Top Left)', 'the-post-grid' ), |
| 2849 | 'top_right' => esc_html__( 'Over image (Top Right)', 'the-post-grid' ), |
| 2850 | 'bottom_left' => esc_html__( 'Over image (Bottom Left)', 'the-post-grid' ), |
| 2851 | 'bottom_right' => esc_html__( 'Over image (Bottom Right)', 'the-post-grid' ), |
| 2852 | 'image_center' => esc_html__( 'Over image (Center)', 'the-post-grid' ), |
| 2853 | ], |
| 2854 | 'condition' => [ |
| 2855 | 'show_category' => 'show', |
| 2856 | ], |
| 2857 | 'render_type' => 'template', |
| 2858 | 'divider' => 'before', |
| 2859 | 'prefix_class' => 'tpg-category-position-', |
| 2860 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2861 | ] |
| 2862 | ); |
| 2863 | |
| 2864 | $ref->add_control( |
| 2865 | 'category_style', |
| 2866 | [ |
| 2867 | 'label' => esc_html__( 'Category Style', 'the-post-grid' ) . $ref->pro_label, |
| 2868 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2869 | 'default' => 'style1', |
| 2870 | 'options' => [ |
| 2871 | 'style1' => esc_html__( 'Style 1', 'the-post-grid' ), |
| 2872 | 'style2' => esc_html__( 'Style 2', 'the-post-grid' ), |
| 2873 | 'style3' => esc_html__( 'Style 3', 'the-post-grid' ), |
| 2874 | ], |
| 2875 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 2876 | 'condition' => [ |
| 2877 | 'category_position!' => 'default', |
| 2878 | ], |
| 2879 | ] |
| 2880 | ); |
| 2881 | |
| 2882 | if ( rtTPG()->hasPro() ) { |
| 2883 | $ref->add_control( |
| 2884 | 'show_cat_icon', |
| 2885 | [ |
| 2886 | 'label' => esc_html__( 'Show Over Image Category Icon', 'the-post-grid' ), |
| 2887 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2888 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 2889 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 2890 | 'return_value' => 'yes', |
| 2891 | 'default' => false, |
| 2892 | 'condition' => [ |
| 2893 | 'category_position!' => 'default', |
| 2894 | ], |
| 2895 | ] |
| 2896 | ); |
| 2897 | } |
| 2898 | |
| 2899 | $post_types = Fns::get_post_types(); |
| 2900 | foreach ( $post_types as $post_type => $label ) { |
| 2901 | $_taxonomies = get_object_taxonomies( $post_type, 'object' ); |
| 2902 | if ( empty( $_taxonomies ) ) { |
| 2903 | continue; |
| 2904 | } |
| 2905 | $term_options = []; |
| 2906 | foreach ( $_taxonomies as $tax ) { |
| 2907 | if ( 'post_format' == $tax->name ) { |
| 2908 | continue; |
| 2909 | } |
| 2910 | $term_options[ $tax->name ] = $tax->label; |
| 2911 | } |
| 2912 | |
| 2913 | if ( 'post' === $post_type ) { |
| 2914 | $default_cat = 'category'; |
| 2915 | $default_tag = 'post_tag'; |
| 2916 | } elseif ( 'product' === $post_type ) { |
| 2917 | $default_cat = 'product_cat'; |
| 2918 | $default_tag = 'product_tag'; |
| 2919 | } elseif ( 'download' === $post_type ) { |
| 2920 | $default_cat = 'download_category'; |
| 2921 | $default_tag = 'download_tag'; |
| 2922 | } elseif ( 'docs' === $post_type ) { |
| 2923 | $default_cat = 'doc_category'; |
| 2924 | $default_tag = 'doc_tag'; |
| 2925 | } elseif ( 'lp_course' === $post_type ) { |
| 2926 | $default_cat = 'course_category'; |
| 2927 | $default_tag = 'course_tag'; |
| 2928 | } else { |
| 2929 | $taxonomie_keys = array_keys( $_taxonomies ); |
| 2930 | $filter_cat = array_filter( |
| 2931 | $taxonomie_keys, |
| 2932 | function ( $item ) { |
| 2933 | return strpos( $item, 'cat' ) !== false; |
| 2934 | } |
| 2935 | ); |
| 2936 | $filter_tag = array_filter( |
| 2937 | $taxonomie_keys, |
| 2938 | function ( $item ) { |
| 2939 | return strpos( $item, 'tag' ) !== false; |
| 2940 | } |
| 2941 | ); |
| 2942 | |
| 2943 | if ( is_array( $filter_cat ) && ! empty( $filter_cat ) ) { |
| 2944 | $default_cat = array_shift( $filter_cat ); |
| 2945 | } |
| 2946 | if ( is_array( $filter_tag ) && ! empty( $filter_tag ) ) { |
| 2947 | $default_tag = array_shift( $filter_tag ); |
| 2948 | } |
| 2949 | } |
| 2950 | |
| 2951 | $ref->add_control( |
| 2952 | $post_type . '_taxonomy', |
| 2953 | [ |
| 2954 | 'label' => esc_html__( 'Category Source', 'the-post-grid' ), |
| 2955 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2956 | 'default' => $default_cat, |
| 2957 | 'options' => $term_options, |
| 2958 | 'condition' => [ |
| 2959 | 'show_category' => 'show', |
| 2960 | 'post_type' => $post_type, |
| 2961 | ], |
| 2962 | 'description' => esc_html__( 'Select which taxonomy should sit in the place of categories. Default: Category', 'the-post-grid' ), |
| 2963 | ] |
| 2964 | ); |
| 2965 | |
| 2966 | $ref->add_control( |
| 2967 | $post_type . '_tags', |
| 2968 | [ |
| 2969 | 'label' => esc_html__( 'Tags Source', 'the-post-grid' ), |
| 2970 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 2971 | 'default' => $default_tag, |
| 2972 | 'options' => $term_options, |
| 2973 | 'condition' => [ |
| 2974 | 'show_category' => 'show', |
| 2975 | 'post_type' => $post_type, |
| 2976 | ], |
| 2977 | 'description' => esc_html__( 'Select which taxonomy should sit in the place of tags. Default: Tags', 'the-post-grid' ), |
| 2978 | ] |
| 2979 | ); |
| 2980 | } |
| 2981 | |
| 2982 | $ref->add_control( |
| 2983 | 'comment_count_heading', |
| 2984 | [ |
| 2985 | 'label' => esc_html__( 'Comment Count ', 'the-post-grid' ), |
| 2986 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2987 | 'classes' => 'tpg-control-type-heading', |
| 2988 | 'condition' => [ |
| 2989 | 'show_comment_count' => 'show', |
| 2990 | ], |
| 2991 | ] |
| 2992 | ); |
| 2993 | |
| 2994 | $ref->add_control( |
| 2995 | 'show_comment_count_label', |
| 2996 | [ |
| 2997 | 'label' => esc_html__( 'Show Comment Label', 'the-post-grid' ), |
| 2998 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 2999 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 3000 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 3001 | 'return_value' => 'yes', |
| 3002 | 'default' => 'yes', |
| 3003 | 'condition' => [ |
| 3004 | 'show_comment_count' => 'show', |
| 3005 | ], |
| 3006 | ] |
| 3007 | ); |
| 3008 | |
| 3009 | $ref->add_control( |
| 3010 | 'comment_count_label_singular', |
| 3011 | [ |
| 3012 | 'label' => esc_html__( 'Comment Label Singular', 'the-post-grid' ), |
| 3013 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 3014 | 'default' => esc_html__( 'Comment', 'the-post-grid' ), |
| 3015 | 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ), |
| 3016 | 'condition' => [ |
| 3017 | 'show_comment_count' => 'show', |
| 3018 | 'show_comment_count_label' => 'yes', |
| 3019 | ], |
| 3020 | ] |
| 3021 | ); |
| 3022 | |
| 3023 | $ref->add_control( |
| 3024 | 'comment_count_label_plural', |
| 3025 | [ |
| 3026 | 'label' => esc_html__( 'Comment Label Plural', 'the-post-grid' ), |
| 3027 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 3028 | 'default' => esc_html__( 'Comments', 'the-post-grid' ), |
| 3029 | 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ), |
| 3030 | 'condition' => [ |
| 3031 | 'show_comment_count' => 'show', |
| 3032 | 'show_comment_count_label' => 'yes', |
| 3033 | ], |
| 3034 | ] |
| 3035 | ); |
| 3036 | |
| 3037 | $ref->add_control( |
| 3038 | 'meta_ordering_heading', |
| 3039 | [ |
| 3040 | 'label' => esc_html__( 'Meta Ordering', 'the-post-grid' ), |
| 3041 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 3042 | 'classes' => 'tpg-control-type-heading', |
| 3043 | ] |
| 3044 | ); |
| 3045 | |
| 3046 | $repeater = new \Elementor\Repeater(); |
| 3047 | |
| 3048 | $repeater->add_control( |
| 3049 | 'repeater_hidden', |
| 3050 | [ |
| 3051 | 'type' => \Elementor\Controls_Manager::HIDDEN, |
| 3052 | ] |
| 3053 | ); |
| 3054 | |
| 3055 | $ref->add_control( |
| 3056 | 'meta_ordering', |
| 3057 | [ |
| 3058 | 'label' => esc_html__( 'Meta Ordering (Drag and Drop)', 'the-post-grid' ), |
| 3059 | 'type' => \Elementor\Controls_Manager::REPEATER, |
| 3060 | 'fields' => $repeater->get_controls(), |
| 3061 | 'default' => [ |
| 3062 | [ |
| 3063 | 'meta_title' => esc_html__( 'Author', 'the-post-grid' ), |
| 3064 | 'meta_name' => 'author', |
| 3065 | ], |
| 3066 | [ |
| 3067 | 'meta_title' => esc_html__( 'Date', 'the-post-grid' ), |
| 3068 | 'meta_name' => 'date', |
| 3069 | ], |
| 3070 | [ |
| 3071 | 'meta_title' => esc_html__( 'Category', 'the-post-grid' ), |
| 3072 | 'meta_name' => 'category', |
| 3073 | ], |
| 3074 | [ |
| 3075 | 'meta_title' => esc_html__( 'Tags', 'the-post-grid' ), |
| 3076 | 'meta_name' => 'tags', |
| 3077 | ], |
| 3078 | [ |
| 3079 | 'meta_title' => esc_html__( 'Comment Count', 'the-post-grid' ), |
| 3080 | 'meta_name' => 'comment_count', |
| 3081 | ], |
| 3082 | [ |
| 3083 | 'meta_title' => esc_html__( 'Post Count', 'the-post-grid' ), |
| 3084 | 'meta_name' => 'post_count', |
| 3085 | ], |
| 3086 | [ |
| 3087 | 'meta_title' => esc_html__( 'Post Like', 'the-post-grid' ), |
| 3088 | 'meta_name' => 'post_like', |
| 3089 | ], |
| 3090 | ], |
| 3091 | 'classes' => 'tpg-item-order-repeater', |
| 3092 | 'title_field' => '{{{ meta_title }}}', |
| 3093 | ] |
| 3094 | ); |
| 3095 | |
| 3096 | $ref->end_controls_section(); |
| 3097 | } |
| 3098 | |
| 3099 | |
| 3100 | /** |
| 3101 | * Read More Settings |
| 3102 | * |
| 3103 | * @param $ref |
| 3104 | */ |
| 3105 | |
| 3106 | public static function post_readmore_settings( $ref ) { |
| 3107 | $prefix = $ref->prefix; |
| 3108 | |
| 3109 | $ref->start_controls_section( |
| 3110 | 'post_readmore_settings', |
| 3111 | [ |
| 3112 | 'label' => esc_html__( 'Read More', 'the-post-grid' ), |
| 3113 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 3114 | 'condition' => [ |
| 3115 | 'show_read_more' => 'show', |
| 3116 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 3117 | ], |
| 3118 | ] |
| 3119 | ); |
| 3120 | |
| 3121 | |
| 3122 | $ref->add_control( |
| 3123 | 'readmore_btn_style', |
| 3124 | [ |
| 3125 | 'label' => esc_html__( 'Button Style', 'the-post-grid' ), |
| 3126 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3127 | 'default' => 'default-style', |
| 3128 | 'options' => [ |
| 3129 | 'default-style' => esc_html__( 'Default from style', 'the-post-grid' ), |
| 3130 | 'only-text' => esc_html__( 'Only Text Button', 'the-post-grid' ), |
| 3131 | ], |
| 3132 | 'prefix_class' => 'readmore-btn-', |
| 3133 | ] |
| 3134 | ); |
| 3135 | |
| 3136 | $ref->add_control( |
| 3137 | 'read_more_label', |
| 3138 | [ |
| 3139 | 'label' => esc_html__( 'Read More Label', 'the-post-grid' ), |
| 3140 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 3141 | 'default' => esc_html__( 'Read More', 'the-post-grid' ), |
| 3142 | 'placeholder' => esc_html__( 'Type Read More Label here', 'the-post-grid' ), |
| 3143 | ] |
| 3144 | ); |
| 3145 | |
| 3146 | |
| 3147 | $ref->add_control( |
| 3148 | 'show_btn_icon', |
| 3149 | [ |
| 3150 | 'label' => esc_html__( 'Show Button Icon', 'the-post-grid' ), |
| 3151 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3152 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 3153 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 3154 | 'return_value' => 'yes', |
| 3155 | 'default' => false, |
| 3156 | ] |
| 3157 | ); |
| 3158 | |
| 3159 | $ref->add_control( |
| 3160 | 'readmore_btn_icon', |
| 3161 | [ |
| 3162 | 'label' => esc_html__( 'Choose Icon', 'the-post-grid' ), |
| 3163 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 3164 | 'default' => [ |
| 3165 | 'value' => 'fas fa-angle-right', |
| 3166 | 'library' => 'solid', |
| 3167 | ], |
| 3168 | 'condition' => [ |
| 3169 | 'show_btn_icon' => 'yes', |
| 3170 | ], |
| 3171 | ] |
| 3172 | ); |
| 3173 | |
| 3174 | $ref->end_controls_section(); |
| 3175 | } |
| 3176 | |
| 3177 | |
| 3178 | /** |
| 3179 | * Advanced Custom Field ACF Settings |
| 3180 | * |
| 3181 | * @param $ref |
| 3182 | */ |
| 3183 | |
| 3184 | public static function tpg_acf_settings( $ref ) { |
| 3185 | $prefix = $ref->prefix; |
| 3186 | $cf = Fns::is_acf(); |
| 3187 | |
| 3188 | if ( ! $cf || ! rtTPG()->hasPro() ) { |
| 3189 | return; |
| 3190 | } |
| 3191 | |
| 3192 | $ref->start_controls_section( |
| 3193 | 'tgp_acf_settings', |
| 3194 | [ |
| 3195 | 'label' => esc_html__( 'ACF Settings', 'the-post-grid' ), |
| 3196 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 3197 | 'condition' => [ |
| 3198 | 'show_acf' => 'show', |
| 3199 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 3200 | ], |
| 3201 | ] |
| 3202 | ); |
| 3203 | |
| 3204 | self::get_tpg_acf_settings( $ref ); |
| 3205 | |
| 3206 | $ref->end_controls_section(); |
| 3207 | } |
| 3208 | |
| 3209 | public static function get_tpg_acf_settings( $ref ) { |
| 3210 | // $ref->add_control( |
| 3211 | // 'cf_group', |
| 3212 | // [ |
| 3213 | // 'label' => esc_html__( 'Choose Advanced Custom Field (ACF)', 'the-post-grid' ), |
| 3214 | // 'type' => \Elementor\Controls_Manager::SELECT2, |
| 3215 | // 'multiple' => true, |
| 3216 | // 'label_block' => true, |
| 3217 | // 'default' => [ $selected_acf_id ], |
| 3218 | // 'options' => Fns::get_groups_by_post_type( 'post' ), |
| 3219 | // 'condition' => [ |
| 3220 | // 'show_acf' => 'show', |
| 3221 | // ], |
| 3222 | // ] |
| 3223 | // ); |
| 3224 | |
| 3225 | $post_types = Fns::get_post_types(); |
| 3226 | |
| 3227 | foreach ( $post_types as $post_type => $post_type_title ) { |
| 3228 | $get_acf_field = Fns::get_groups_by_post_type( $post_type ); |
| 3229 | $selected_acf_id = ''; |
| 3230 | if ( ! empty( $get_acf_field ) && is_array( $get_acf_field ) ) { |
| 3231 | $selected_acf_id = array_key_first( $get_acf_field ); |
| 3232 | } |
| 3233 | |
| 3234 | $ref->add_control( |
| 3235 | $post_type . '_cf_group', |
| 3236 | [ |
| 3237 | 'label' => esc_html__( "Choose Advanced Custom Field (ACF)", 'the-post-grid' ), |
| 3238 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 3239 | 'label_block' => true, |
| 3240 | 'multiple' => true, |
| 3241 | 'default' => [ $selected_acf_id ], |
| 3242 | 'options' => Fns::get_groups_by_post_type( $post_type ), |
| 3243 | 'condition' => [ |
| 3244 | 'post_type' => $post_type, |
| 3245 | ], |
| 3246 | ] |
| 3247 | ); |
| 3248 | } |
| 3249 | |
| 3250 | $ref->add_control( |
| 3251 | 'cf_hide_empty_value', |
| 3252 | [ |
| 3253 | 'label' => esc_html__( 'Hide field with empty value?', 'the-post-grid' ), |
| 3254 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3255 | 'label_on' => esc_html__( 'No', 'the-post-grid' ), |
| 3256 | 'label_off' => esc_html__( 'Yes', 'the-post-grid' ), |
| 3257 | 'return_value' => 'yes', |
| 3258 | 'default' => 'yes', |
| 3259 | ] |
| 3260 | ); |
| 3261 | |
| 3262 | $ref->add_control( |
| 3263 | 'cf_hide_group_title', |
| 3264 | [ |
| 3265 | 'label' => esc_html__( 'Show group title?', 'the-post-grid' ), |
| 3266 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3267 | 'label_on' => esc_html__( 'No', 'the-post-grid' ), |
| 3268 | 'label_off' => esc_html__( 'Yes', 'the-post-grid' ), |
| 3269 | 'return_value' => 'yes', |
| 3270 | 'default' => 'yes', |
| 3271 | ] |
| 3272 | ); |
| 3273 | |
| 3274 | $ref->add_control( |
| 3275 | 'cf_show_only_value', |
| 3276 | [ |
| 3277 | 'label' => esc_html__( 'Show label?', 'the-post-grid' ), |
| 3278 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3279 | 'label_on' => esc_html__( 'No', 'the-post-grid' ), |
| 3280 | 'label_off' => esc_html__( 'Yes', 'the-post-grid' ), |
| 3281 | 'return_value' => 'yes', |
| 3282 | 'default' => 'yes', |
| 3283 | ] |
| 3284 | ); |
| 3285 | } |
| 3286 | |
| 3287 | |
| 3288 | /** |
| 3289 | * Links Settings |
| 3290 | * |
| 3291 | * @param $ref |
| 3292 | */ |
| 3293 | public static function links( $ref ) { |
| 3294 | $prefix = $ref->prefix; |
| 3295 | |
| 3296 | $ref->start_controls_section( |
| 3297 | 'tpg_links_settings', |
| 3298 | [ |
| 3299 | 'label' => esc_html__( 'Links', 'the-post-grid' ), |
| 3300 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 3301 | 'condition' => [ |
| 3302 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 3303 | ], |
| 3304 | |
| 3305 | ] |
| 3306 | ); |
| 3307 | |
| 3308 | $link_type = [ |
| 3309 | 'default' => esc_html__( 'Link to details page', 'the-post-grid' ), |
| 3310 | ]; |
| 3311 | if ( rtTPG()->hasPro() ) { |
| 3312 | $link_type['popup'] = esc_html__( 'Single Popup', 'the-post-grid' ); |
| 3313 | $link_type['multi_popup'] = esc_html__( 'Multi Popup', 'the-post-grid' ); |
| 3314 | } |
| 3315 | $link_type['none'] = esc_html__( 'No Link', 'the-post-grid' ); |
| 3316 | |
| 3317 | $ref->add_control( |
| 3318 | 'post_link_type', |
| 3319 | [ |
| 3320 | 'label' => esc_html__( 'Post link type', 'the-post-grid' ), |
| 3321 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3322 | 'default' => 'default', |
| 3323 | 'options' => $link_type, |
| 3324 | 'description' => $ref->get_pro_message( 'popup options' ), |
| 3325 | ] |
| 3326 | ); |
| 3327 | |
| 3328 | $ref->add_control( |
| 3329 | 'link_target', |
| 3330 | [ |
| 3331 | 'label' => esc_html__( 'Link Target', 'the-post-grid' ), |
| 3332 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3333 | 'default' => '_self', |
| 3334 | 'options' => [ |
| 3335 | '_self' => esc_html__( 'Same Window', 'the-post-grid' ), |
| 3336 | '_blank' => esc_html__( 'New Window', 'the-post-grid' ), |
| 3337 | ], |
| 3338 | 'condition' => [ |
| 3339 | 'post_link_type' => 'default', |
| 3340 | ], |
| 3341 | ] |
| 3342 | ); |
| 3343 | |
| 3344 | $ref->add_control( |
| 3345 | 'is_thumb_linked', |
| 3346 | [ |
| 3347 | 'label' => esc_html__( 'Thumbnail Link', 'the-post-grid' ), |
| 3348 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 3349 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 3350 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 3351 | 'return_value' => 'yes', |
| 3352 | 'default' => 'yes', |
| 3353 | ] |
| 3354 | ); |
| 3355 | |
| 3356 | $ref->end_controls_section(); |
| 3357 | } |
| 3358 | |
| 3359 | |
| 3360 | /** |
| 3361 | * Promotions |
| 3362 | * |
| 3363 | * @param $ref |
| 3364 | */ |
| 3365 | public static function promotions( $ref ) { |
| 3366 | if ( rtTPG()->hasPro() ) { |
| 3367 | return; |
| 3368 | } |
| 3369 | $pro_url = "//www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/"; |
| 3370 | |
| 3371 | $ref->start_controls_section( |
| 3372 | 'tpg_pro_alert', |
| 3373 | [ |
| 3374 | 'label' => sprintf( |
| 3375 | '<span style="color: #f54">%s</span>', |
| 3376 | __( 'Go Premium for More Features', 'the-post-grid' ) |
| 3377 | ), |
| 3378 | ] |
| 3379 | ); |
| 3380 | |
| 3381 | $ref->add_control( |
| 3382 | 'tpg_control_get_pro', |
| 3383 | [ |
| 3384 | 'type' => Controls_Manager::RAW_HTML, |
| 3385 | '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="' |
| 3386 | . $pro_url |
| 3387 | . '" 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="' |
| 3388 | . $pro_url . '" target="_blank">Get Pro</a></div>', |
| 3389 | ] |
| 3390 | ); |
| 3391 | |
| 3392 | $ref->end_controls_section(); |
| 3393 | } |
| 3394 | |
| 3395 | |
| 3396 | /** |
| 3397 | * Section Title Style |
| 3398 | * |
| 3399 | * @param $ref |
| 3400 | */ |
| 3401 | public static function sectionTitle( $ref, $layout_type = '' ) { |
| 3402 | $prefix = $ref->prefix; |
| 3403 | $ref->start_controls_section( |
| 3404 | 'tpg_section_title_style', |
| 3405 | [ |
| 3406 | 'label' => esc_html__( 'Section Title', 'the-post-grid' ), |
| 3407 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3408 | 'condition' => [ |
| 3409 | 'show_section_title' => 'show', |
| 3410 | ], |
| 3411 | ] |
| 3412 | ); |
| 3413 | |
| 3414 | $section_title_condition = []; |
| 3415 | if ( 'archive' !== $layout_type ) { |
| 3416 | $section_title_condition = [ |
| 3417 | 'filter_btn_style!' => 'carousel', |
| 3418 | ]; |
| 3419 | } |
| 3420 | |
| 3421 | $ref->add_control( |
| 3422 | 'section_title_alignment', |
| 3423 | [ |
| 3424 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 3425 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 3426 | 'options' => [ |
| 3427 | 'left' => [ |
| 3428 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 3429 | 'icon' => 'eicon-text-align-left', |
| 3430 | ], |
| 3431 | 'center' => [ |
| 3432 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 3433 | 'icon' => 'eicon-text-align-center', |
| 3434 | ], |
| 3435 | 'right' => [ |
| 3436 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 3437 | 'icon' => 'eicon-text-align-right', |
| 3438 | ], |
| 3439 | ], |
| 3440 | 'render_type' => 'template', |
| 3441 | 'prefix_class' => 'section-title-align-', |
| 3442 | 'condition' => $section_title_condition, |
| 3443 | ] |
| 3444 | ); |
| 3445 | |
| 3446 | |
| 3447 | $ref->add_responsive_control( |
| 3448 | 'section_title_margin', |
| 3449 | [ |
| 3450 | 'label' => esc_html__( 'Margin Y axis', 'the-post-grid' ), |
| 3451 | 'type' => Controls_Manager::DIMENSIONS, |
| 3452 | 'size_units' => [ 'px' ], |
| 3453 | 'allowed_dimensions' => 'vertical', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ] |
| 3454 | 'default' => [ |
| 3455 | 'top' => '', |
| 3456 | 'right' => '', |
| 3457 | 'bottom' => '', |
| 3458 | 'left' => '', |
| 3459 | 'isLinked' => false, |
| 3460 | ], |
| 3461 | 'selectors' => [ |
| 3462 | '{{WRAPPER}} .tpg-widget-heading-wrapper' => 'margin-top: {{TOP}}{{UNIT}}; margin-bottom: {{BOTTOM}}{{UNIT}};', |
| 3463 | ], |
| 3464 | ] |
| 3465 | ); |
| 3466 | |
| 3467 | if ( 'slider' === $prefix ) { |
| 3468 | $ref->add_responsive_control( |
| 3469 | 'section_title_padding', |
| 3470 | [ |
| 3471 | 'label' => esc_html__( 'Padding', 'the-post-grid' ), |
| 3472 | 'type' => Controls_Manager::DIMENSIONS, |
| 3473 | 'size_units' => [ 'px' ], |
| 3474 | 'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ] |
| 3475 | 'default' => [ |
| 3476 | 'top' => '', |
| 3477 | 'right' => '', |
| 3478 | 'bottom' => '', |
| 3479 | 'left' => '', |
| 3480 | 'isLinked' => false, |
| 3481 | ], |
| 3482 | 'selectors' => [ |
| 3483 | '{{WRAPPER}} .slider-layout-main .tpg-widget-heading-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3484 | ], |
| 3485 | ] |
| 3486 | ); |
| 3487 | } |
| 3488 | |
| 3489 | $ref->add_group_control( |
| 3490 | \Elementor\Group_Control_Typography::get_type(), |
| 3491 | [ |
| 3492 | 'name' => 'section_title_typography', |
| 3493 | 'label' => esc_html__( 'Typography', 'the-post-grid' ), |
| 3494 | 'selector' => '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading', |
| 3495 | ] |
| 3496 | ); |
| 3497 | |
| 3498 | $ref->add_control( |
| 3499 | 'section_title_color', |
| 3500 | [ |
| 3501 | 'label' => esc_html__( 'Title Color', 'the-post-grid' ), |
| 3502 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3503 | 'selectors' => [ |
| 3504 | '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading' => 'color: {{VALUE}}', |
| 3505 | ], |
| 3506 | ] |
| 3507 | ); |
| 3508 | |
| 3509 | $ref->add_control( |
| 3510 | 'section_title_bg_color', |
| 3511 | [ |
| 3512 | 'label' => esc_html__( 'Title Background Color', 'the-post-grid' ), |
| 3513 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3514 | 'selectors' => [ |
| 3515 | '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, {{WRAPPER}} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading' => 'background-color: {{VALUE}}', |
| 3516 | '{{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', |
| 3517 | ], |
| 3518 | 'condition' => [ |
| 3519 | 'section_title_style' => [ 'style2', 'style3' ], |
| 3520 | ], |
| 3521 | ] |
| 3522 | ); |
| 3523 | |
| 3524 | |
| 3525 | $ref->add_control( |
| 3526 | 'section_title_dot_color', |
| 3527 | [ |
| 3528 | 'label' => esc_html__( 'Dot Color', 'the-post-grid' ), |
| 3529 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3530 | 'selectors' => [ |
| 3531 | '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading::before' => 'background-color: {{VALUE}}', |
| 3532 | ], |
| 3533 | 'condition' => [ |
| 3534 | 'section_title_style' => 'style1', |
| 3535 | ], |
| 3536 | ] |
| 3537 | ); |
| 3538 | |
| 3539 | $ref->add_control( |
| 3540 | 'section_title_line_color', |
| 3541 | [ |
| 3542 | 'label' => esc_html__( 'Line / Border Color', 'the-post-grid' ), |
| 3543 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3544 | 'selectors' => [ |
| 3545 | '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line' => 'border-color: {{VALUE}}', |
| 3546 | //'{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper, {{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper' => 'border-bottom-color: {{VALUE}}', |
| 3547 | '{{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}}', |
| 3548 | '{{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}}', |
| 3549 | '{{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}}', |
| 3550 | '{{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}}', |
| 3551 | |
| 3552 | ], |
| 3553 | 'condition' => [ |
| 3554 | 'section_title_style!' => 'default', |
| 3555 | ], |
| 3556 | ] |
| 3557 | ); |
| 3558 | |
| 3559 | $ref->add_control( |
| 3560 | 'prefix_text_color', |
| 3561 | [ |
| 3562 | 'label' => esc_html__( 'Prefix Color', 'the-post-grid' ), |
| 3563 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3564 | 'selectors' => [ |
| 3565 | '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .prefix-text' => 'color: {{VALUE}}', |
| 3566 | ], |
| 3567 | 'condition' => [ |
| 3568 | 'section_title_source' => 'page_title', |
| 3569 | ], |
| 3570 | ] |
| 3571 | ); |
| 3572 | $ref->add_control( |
| 3573 | 'suffix_text_color', |
| 3574 | [ |
| 3575 | 'label' => esc_html__( 'Suffix Color', 'the-post-grid' ), |
| 3576 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3577 | 'selectors' => [ |
| 3578 | '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .suffix-text' => 'color: {{VALUE}}', |
| 3579 | ], |
| 3580 | 'condition' => [ |
| 3581 | 'section_title_source' => 'page_title', |
| 3582 | ], |
| 3583 | ] |
| 3584 | ); |
| 3585 | |
| 3586 | |
| 3587 | if ( 'archive' == $layout_type ) { |
| 3588 | $ref->add_control( |
| 3589 | 'cat_tag_description_heading', |
| 3590 | [ |
| 3591 | 'label' => esc_html__( 'Category / Tag Description', 'the-post-grid' ), |
| 3592 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 3593 | 'classes' => 'tpg-control-type-heading', |
| 3594 | 'condition' => [ |
| 3595 | 'show_cat_desc' => 'yes', |
| 3596 | ], |
| 3597 | ] |
| 3598 | ); |
| 3599 | |
| 3600 | $ref->add_group_control( |
| 3601 | \Elementor\Group_Control_Typography::get_type(), |
| 3602 | [ |
| 3603 | 'name' => 'taxonomy_des_typography', |
| 3604 | 'label' => esc_html__( 'Description Typography', 'the-post-grid' ), |
| 3605 | 'selector' => '{{WRAPPER}} .tpg-category-description', |
| 3606 | 'condition' => [ |
| 3607 | 'show_cat_desc' => 'yes', |
| 3608 | ], |
| 3609 | ] |
| 3610 | ); |
| 3611 | |
| 3612 | $ref->add_responsive_control( |
| 3613 | 'taxonomy_des_alignment', |
| 3614 | [ |
| 3615 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 3616 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 3617 | 'options' => [ |
| 3618 | 'left' => [ |
| 3619 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 3620 | 'icon' => 'eicon-text-align-left', |
| 3621 | ], |
| 3622 | 'center' => [ |
| 3623 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 3624 | 'icon' => 'eicon-text-align-center', |
| 3625 | ], |
| 3626 | 'right' => [ |
| 3627 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 3628 | 'icon' => 'eicon-text-align-right', |
| 3629 | ], |
| 3630 | ], |
| 3631 | 'selectors' => [ |
| 3632 | '{{WRAPPER}} .tpg-category-description' => 'text-align: {{VALUE}}', |
| 3633 | ], |
| 3634 | 'condition' => [ |
| 3635 | 'show_cat_desc' => 'yes', |
| 3636 | ], |
| 3637 | ] |
| 3638 | ); |
| 3639 | |
| 3640 | $ref->add_control( |
| 3641 | 'taxonomy_des_color', |
| 3642 | [ |
| 3643 | 'label' => esc_html__( 'Title Color', 'the-post-grid' ), |
| 3644 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3645 | 'selectors' => [ |
| 3646 | '{{WRAPPER}} .tpg-category-description' => 'color: {{VALUE}}', |
| 3647 | ], |
| 3648 | 'condition' => [ |
| 3649 | 'show_cat_desc' => 'yes', |
| 3650 | ], |
| 3651 | ] |
| 3652 | ); |
| 3653 | |
| 3654 | $ref->add_responsive_control( |
| 3655 | 'taxonomy_des_dimension', |
| 3656 | [ |
| 3657 | 'label' => esc_html__( 'Padding', 'the-post-grid' ), |
| 3658 | 'type' => Controls_Manager::DIMENSIONS, |
| 3659 | 'size_units' => [ 'px' ], |
| 3660 | 'selectors' => [ |
| 3661 | '{{WRAPPER}} .tpg-category-description' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3662 | ], |
| 3663 | 'condition' => [ |
| 3664 | 'show_cat_desc' => 'yes', |
| 3665 | ], |
| 3666 | ] |
| 3667 | ); |
| 3668 | } |
| 3669 | |
| 3670 | $ref->end_controls_section(); |
| 3671 | } |
| 3672 | |
| 3673 | |
| 3674 | /** |
| 3675 | * Thumbnail Style Tab |
| 3676 | * |
| 3677 | * @param $ref |
| 3678 | */ |
| 3679 | public static function thumbnailStyle( $ref ) { |
| 3680 | $prefix = $ref->prefix; |
| 3681 | // Thumbnail style |
| 3682 | //======================================================== |
| 3683 | $ref->start_controls_section( |
| 3684 | 'thumbnail_style', |
| 3685 | [ |
| 3686 | 'label' => esc_html__( 'Thumbnail', 'the-post-grid' ), |
| 3687 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3688 | 'condition' => [ |
| 3689 | 'show_thumb' => 'show', |
| 3690 | ], |
| 3691 | ] |
| 3692 | ); |
| 3693 | |
| 3694 | $ref->add_responsive_control( |
| 3695 | 'img_border_radius', |
| 3696 | [ |
| 3697 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ) . $ref->pro_label, |
| 3698 | 'type' => Controls_Manager::DIMENSIONS, |
| 3699 | 'size_units' => [ 'px', '%', 'em' ], |
| 3700 | 'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ] |
| 3701 | 'default' => [ |
| 3702 | 'top' => '', |
| 3703 | 'right' => '', |
| 3704 | 'bottom' => '', |
| 3705 | 'left' => '', |
| 3706 | 'isLinked' => true, |
| 3707 | ], |
| 3708 | 'selectors' => [ |
| 3709 | '{{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;', |
| 3710 | ], |
| 3711 | 'description' => $ref->get_pro_message( "image radius." ), |
| 3712 | 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide', |
| 3713 | ] |
| 3714 | ); |
| 3715 | |
| 3716 | $ref->add_control( |
| 3717 | 'image_width', |
| 3718 | [ |
| 3719 | 'label' => esc_html__( 'Image Width (Optional)', 'the-post-grid' ), |
| 3720 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3721 | 'default' => 'inherit', |
| 3722 | 'options' => [ |
| 3723 | 'inherit' => esc_html__( 'Default', 'the-post-grid' ), |
| 3724 | '100%' => esc_html__( '100%', 'the-post-grid' ), |
| 3725 | 'auto' => esc_html__( 'Auto', 'the-post-grid' ), |
| 3726 | ], |
| 3727 | 'selectors' => [ |
| 3728 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img' => 'width: {{VALUE}};', |
| 3729 | ], |
| 3730 | ] |
| 3731 | ); |
| 3732 | |
| 3733 | if ( 'grid_hover' != $prefix ) { |
| 3734 | $ref->add_responsive_control( |
| 3735 | 'thumbnail_spacing', |
| 3736 | [ |
| 3737 | 'label' => esc_html__( 'Thumbnail Margin', 'the-post-grid' ), |
| 3738 | 'type' => Controls_Manager::DIMENSIONS, |
| 3739 | 'size_units' => [ 'px' ], |
| 3740 | 'selectors' => [ |
| 3741 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3742 | ], |
| 3743 | 'default' => [ |
| 3744 | 'top' => '', |
| 3745 | 'right' => '', |
| 3746 | 'bottom' => '', |
| 3747 | 'left' => '', |
| 3748 | 'isLinked' => false, |
| 3749 | ], |
| 3750 | ] |
| 3751 | ); |
| 3752 | } |
| 3753 | |
| 3754 | if ( in_array( $prefix, [ 'grid_hover', 'slider' ] ) ) { |
| 3755 | if ( 'slider' == $prefix ) { |
| 3756 | $thumbnail_padding_condition = [ |
| 3757 | 'slider_layout' => [ 'slider-layout4', |
| 3758 | 'slider-layout5', |
| 3759 | 'slider-layout6', |
| 3760 | 'slider-layout7', |
| 3761 | 'slider-layout8', |
| 3762 | 'slider-layout9', |
| 3763 | 'slider-layout10' |
| 3764 | ], |
| 3765 | ]; |
| 3766 | } else { |
| 3767 | $thumbnail_padding_condition = [ |
| 3768 | 'grid_hover_layout!' => '', |
| 3769 | ]; |
| 3770 | } |
| 3771 | $ref->add_responsive_control( |
| 3772 | 'grid_hover_thumbnail_margin', |
| 3773 | [ |
| 3774 | 'label' => esc_html__( 'Thumbnail padding', 'the-post-grid' ), |
| 3775 | 'type' => Controls_Manager::DIMENSIONS, |
| 3776 | 'size_units' => [ 'px' ], |
| 3777 | 'selectors' => [ |
| 3778 | '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3779 | '{{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper .gallery-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3780 | ], |
| 3781 | 'condition' => $thumbnail_padding_condition, |
| 3782 | ] |
| 3783 | ); |
| 3784 | } |
| 3785 | |
| 3786 | //Overlay Style Heading |
| 3787 | |
| 3788 | $ref->add_control( |
| 3789 | 'thumb_overlay_style_heading', |
| 3790 | [ |
| 3791 | 'label' => esc_html__( 'Overlay Style:', 'the-post-grid' ), |
| 3792 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 3793 | 'classes' => 'tpg-control-type-heading', |
| 3794 | ] |
| 3795 | ); |
| 3796 | |
| 3797 | //TODO: Tab normal |
| 3798 | $ref->start_controls_tabs( |
| 3799 | 'grid_hover_style_tabs' |
| 3800 | ); |
| 3801 | |
| 3802 | $ref->start_controls_tab( |
| 3803 | 'grid_hover_style_normal_tab', |
| 3804 | [ |
| 3805 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 3806 | ] |
| 3807 | ); |
| 3808 | |
| 3809 | $ref->add_group_control( |
| 3810 | \Elementor\Group_Control_Background::get_type(), |
| 3811 | [ |
| 3812 | 'name' => 'grid_hover_overlay_color', |
| 3813 | 'label' => esc_html__( 'Overlay BG', 'the-post-grid' ), |
| 3814 | 'types' => [ 'classic', 'gradient' ], |
| 3815 | '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', |
| 3816 | 'exclude' => [ 'image' ], |
| 3817 | 'fields_options' => [ |
| 3818 | 'background' => [ |
| 3819 | 'label' => esc_html__( 'Overlay Background Type', 'the-post-grid' ), |
| 3820 | ], |
| 3821 | 'color' => [ |
| 3822 | 'label' => 'Background Color', |
| 3823 | ], |
| 3824 | 'color_b' => [ |
| 3825 | 'label' => 'Background Color 2', |
| 3826 | ], |
| 3827 | ], |
| 3828 | ] |
| 3829 | ); |
| 3830 | |
| 3831 | $ref->add_control( |
| 3832 | 'thumb_lightbox_bg', |
| 3833 | [ |
| 3834 | 'label' => esc_html__( 'Light Box Background', 'the-post-grid' ), |
| 3835 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3836 | 'selectors' => [ |
| 3837 | '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}', |
| 3838 | ], |
| 3839 | 'condition' => [ |
| 3840 | 'is_thumb_lightbox' => 'show', |
| 3841 | ], |
| 3842 | ] |
| 3843 | ); |
| 3844 | |
| 3845 | $ref->add_control( |
| 3846 | 'thumb_lightbox_color', |
| 3847 | [ |
| 3848 | 'label' => esc_html__( 'Light Box Color', 'the-post-grid' ), |
| 3849 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3850 | 'selectors' => [ |
| 3851 | '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}', |
| 3852 | ], |
| 3853 | 'condition' => [ |
| 3854 | 'is_thumb_lightbox' => 'show', |
| 3855 | ], |
| 3856 | ] |
| 3857 | ); |
| 3858 | |
| 3859 | $ref->end_controls_tab(); |
| 3860 | |
| 3861 | //TODO: Tab Hover |
| 3862 | $ref->start_controls_tab( |
| 3863 | 'grid_hover_style_hover_tab', |
| 3864 | [ |
| 3865 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 3866 | ] |
| 3867 | ); |
| 3868 | |
| 3869 | $ref->add_group_control( |
| 3870 | \Elementor\Group_Control_Background::get_type(), |
| 3871 | [ |
| 3872 | 'name' => 'grid_hover_overlay_color_hover', |
| 3873 | 'label' => esc_html__( 'Overlay BG - Hover', 'the-post-grid' ), |
| 3874 | 'types' => [ 'classic', 'gradient' ], |
| 3875 | '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', |
| 3876 | 'exclude' => [ 'image' ], |
| 3877 | 'fields_options' => [ |
| 3878 | 'background' => [ |
| 3879 | 'label' => esc_html__( 'Overlay Background Type - Hover', 'the-post-grid' ), |
| 3880 | ], |
| 3881 | 'color' => [ |
| 3882 | 'label' => 'Background Color', |
| 3883 | ], |
| 3884 | 'color_b' => [ |
| 3885 | 'label' => 'Background Color 2', |
| 3886 | ], |
| 3887 | ], |
| 3888 | ] |
| 3889 | ); |
| 3890 | |
| 3891 | |
| 3892 | $ref->add_control( |
| 3893 | 'thumb_lightbox_bg_hover', |
| 3894 | [ |
| 3895 | 'label' => esc_html__( 'Light Box Background - Hover', 'the-post-grid' ), |
| 3896 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3897 | 'selectors' => [ |
| 3898 | '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}', |
| 3899 | ], |
| 3900 | 'condition' => [ |
| 3901 | 'is_thumb_lightbox' => 'show', |
| 3902 | ], |
| 3903 | ] |
| 3904 | ); |
| 3905 | |
| 3906 | $ref->add_control( |
| 3907 | 'thumb_lightbox_color_hover', |
| 3908 | [ |
| 3909 | 'label' => esc_html__( 'Light Box Color - Hover', 'the-post-grid' ), |
| 3910 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 3911 | 'selectors' => [ |
| 3912 | '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}', |
| 3913 | ], |
| 3914 | 'condition' => [ |
| 3915 | 'is_thumb_lightbox' => 'show', |
| 3916 | ], |
| 3917 | ] |
| 3918 | ); |
| 3919 | |
| 3920 | $ref->end_controls_tab(); |
| 3921 | |
| 3922 | $ref->end_controls_tabs(); |
| 3923 | |
| 3924 | $ref->add_control( |
| 3925 | 'hr_for_overlay', |
| 3926 | [ |
| 3927 | 'type' => \Elementor\Controls_Manager::DIVIDER, |
| 3928 | ] |
| 3929 | ); |
| 3930 | |
| 3931 | $overlay_type_opt = [ |
| 3932 | 'always' => esc_html__( 'Show Always', 'the-post-grid' ), |
| 3933 | 'fadein-on-hover' => esc_html__( 'FadeIn on hover', 'the-post-grid' ), |
| 3934 | 'fadeout-on-hover' => esc_html__( 'FadeOut on hover', 'the-post-grid' ), |
| 3935 | 'slidein-on-hover' => esc_html__( 'SlideIn on hover', 'the-post-grid' ), |
| 3936 | 'slideout-on-hover' => esc_html__( 'SlideOut on hover', 'the-post-grid' ), |
| 3937 | 'zoomin-on-hover' => esc_html__( 'ZoomIn on hover', 'the-post-grid' ), |
| 3938 | 'zoomout-on-hover' => esc_html__( 'ZoomOut on hover', 'the-post-grid' ), |
| 3939 | 'zoominall-on-hover' => esc_html__( 'ZoomIn Content on hover', 'the-post-grid' ), |
| 3940 | 'zoomoutall-on-hover' => esc_html__( 'ZoomOut Content on hover', 'the-post-grid' ), |
| 3941 | ]; |
| 3942 | |
| 3943 | if ( $ref->prefix == 'grid_hover' || $ref->prefix == 'slider' ) { |
| 3944 | $overlay_type_opt2 = [ |
| 3945 | 'flipin-on-hover' => esc_html__( 'FlipIn on hover', 'the-post-grid' ), |
| 3946 | 'flipout-on-hover' => esc_html__( 'FlipOut on hover', 'the-post-grid' ), |
| 3947 | ]; |
| 3948 | $overlay_type_opt = array_merge( $overlay_type_opt, $overlay_type_opt2 ); |
| 3949 | } |
| 3950 | |
| 3951 | $ref->add_control( |
| 3952 | 'grid_hover_overlay_type', |
| 3953 | [ |
| 3954 | 'label' => esc_html__( 'Overlay Interaction', 'the-post-grid' ), |
| 3955 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3956 | 'default' => 'always', |
| 3957 | 'options' => $overlay_type_opt, |
| 3958 | 'description' => esc_html__( 'If you don\'t choose overlay background then it will work only for some selected layout ', 'the-post-grid' ), |
| 3959 | 'prefix_class' => 'grid-hover-overlay-type-', |
| 3960 | ] |
| 3961 | ); |
| 3962 | |
| 3963 | $overlay_height_condition = [ |
| 3964 | 'grid_hover_layout!' => [ 'grid_hover-layout3' ], |
| 3965 | ]; |
| 3966 | if ( $ref->prefix === 'slider' ) { |
| 3967 | $overlay_height_condition = [ |
| 3968 | 'slider_layout!' => [ '' ], |
| 3969 | ]; |
| 3970 | } |
| 3971 | $ref->add_control( |
| 3972 | 'grid_hover_overlay_height', |
| 3973 | [ |
| 3974 | 'label' => esc_html__( 'Overlay Height', 'the-post-grid' ), |
| 3975 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3976 | 'default' => 'default', |
| 3977 | 'options' => [ |
| 3978 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 3979 | 'full' => esc_html__( '100%', 'the-post-grid' ), |
| 3980 | 'auto' => esc_html__( 'Auto', 'the-post-grid' ), |
| 3981 | ], |
| 3982 | 'condition' => $overlay_height_condition, |
| 3983 | 'prefix_class' => 'grid-hover-overlay-height-', |
| 3984 | ] |
| 3985 | ); |
| 3986 | |
| 3987 | $ref->add_control( |
| 3988 | 'on_hover_overlay', |
| 3989 | [ |
| 3990 | 'label' => esc_html__( 'Overlay Height on hover', 'the-post-grid' ), |
| 3991 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 3992 | 'default' => 'default', |
| 3993 | 'options' => [ |
| 3994 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 3995 | 'full' => esc_html__( '100%', 'the-post-grid' ), |
| 3996 | 'auto' => esc_html__( 'Auto', 'the-post-grid' ), |
| 3997 | ], |
| 3998 | 'condition' => $overlay_height_condition, |
| 3999 | 'prefix_class' => 'hover-overlay-height-', |
| 4000 | ] |
| 4001 | ); |
| 4002 | |
| 4003 | $ref->end_controls_section(); |
| 4004 | } |
| 4005 | |
| 4006 | |
| 4007 | /** |
| 4008 | * Post Title Style |
| 4009 | * |
| 4010 | * @param $ref |
| 4011 | */ |
| 4012 | public static function titleStyle( $ref ) { |
| 4013 | $prefix = $ref->prefix; |
| 4014 | |
| 4015 | $ref->start_controls_section( |
| 4016 | 'title_style', |
| 4017 | [ |
| 4018 | 'label' => esc_html__( 'Post Title', 'the-post-grid' ), |
| 4019 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 4020 | 'condition' => [ |
| 4021 | 'show_title' => 'show', |
| 4022 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 4023 | ], |
| 4024 | ] |
| 4025 | ); |
| 4026 | |
| 4027 | $ref->add_responsive_control( |
| 4028 | 'title_spacing', |
| 4029 | [ |
| 4030 | 'label' => esc_html__( 'Title Margin', 'the-post-grid' ), |
| 4031 | 'type' => Controls_Manager::DIMENSIONS, |
| 4032 | 'size_units' => [ 'px' ], |
| 4033 | 'selectors' => [ |
| 4034 | '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4035 | ], |
| 4036 | 'allowed_dimensions' => 'all', |
| 4037 | 'default' => [ |
| 4038 | 'top' => '', |
| 4039 | 'right' => '', |
| 4040 | 'bottom' => '', |
| 4041 | 'left' => '', |
| 4042 | 'isLinked' => false, |
| 4043 | ], |
| 4044 | ] |
| 4045 | ); |
| 4046 | |
| 4047 | $ref->add_responsive_control( |
| 4048 | 'title_padding', |
| 4049 | [ |
| 4050 | 'label' => esc_html__( 'Title Padding', 'the-post-grid' ), |
| 4051 | 'type' => Controls_Manager::DIMENSIONS, |
| 4052 | 'size_units' => [ 'px' ], |
| 4053 | 'selectors' => [ |
| 4054 | '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper .entry-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4055 | ], |
| 4056 | 'allowed_dimensions' => 'all', |
| 4057 | 'default' => [ |
| 4058 | 'top' => '', |
| 4059 | 'right' => '', |
| 4060 | 'bottom' => '', |
| 4061 | 'left' => '', |
| 4062 | 'isLinked' => false, |
| 4063 | ], |
| 4064 | ] |
| 4065 | ); |
| 4066 | |
| 4067 | $ref->add_group_control( |
| 4068 | \Elementor\Group_Control_Typography::get_type(), |
| 4069 | [ |
| 4070 | 'name' => 'title_typography', |
| 4071 | 'label' => esc_html__( 'Typography', 'the-post-grid' ), |
| 4072 | 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .entry-title-wrapper .entry-title', |
| 4073 | ] |
| 4074 | ); |
| 4075 | |
| 4076 | //Offset Title |
| 4077 | $ref->add_group_control( |
| 4078 | \Elementor\Group_Control_Typography::get_type(), |
| 4079 | [ |
| 4080 | 'name' => 'title_offset_typography', |
| 4081 | 'label' => esc_html__( 'Offset Typography', 'the-post-grid' ), |
| 4082 | 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .offset-left .entry-title-wrapper .entry-title', |
| 4083 | 'description' => esc_html__( 'You can overwrite offset title font style', 'the-post-grid' ), |
| 4084 | 'condition' => [ |
| 4085 | $prefix . '_layout' => [ |
| 4086 | 'grid-layout5', |
| 4087 | 'grid-layout5-2', |
| 4088 | 'grid-layout6', |
| 4089 | 'grid-layout6-2', |
| 4090 | 'list-layout2', |
| 4091 | 'list-layout3', |
| 4092 | 'list-layout2-2', |
| 4093 | 'list-layout3-2', |
| 4094 | 'grid_hover-layout4', |
| 4095 | 'grid_hover-layout4-2', |
| 4096 | 'grid_hover-layout5', |
| 4097 | 'grid_hover-layout5-2', |
| 4098 | 'grid_hover-layout6', |
| 4099 | 'grid_hover-layout6-2', |
| 4100 | 'grid_hover-layout7', |
| 4101 | 'grid_hover-layout7-2', |
| 4102 | 'grid_hover-layout9', |
| 4103 | 'grid_hover-layout9-2', |
| 4104 | ], |
| 4105 | ], |
| 4106 | ] |
| 4107 | ); |
| 4108 | |
| 4109 | $ref->add_control( |
| 4110 | 'title_border_visibility', |
| 4111 | [ |
| 4112 | 'label' => esc_html__( 'Title Border Bottom', 'the-post-grid' ), |
| 4113 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 4114 | 'default' => 'default', |
| 4115 | 'options' => [ |
| 4116 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 4117 | 'show' => esc_html__( 'Show', 'the-post-grid' ), |
| 4118 | 'hide' => esc_html__( 'Hide', 'the-post-grid' ), |
| 4119 | ], |
| 4120 | 'prefix_class' => 'tpg-title-border-', |
| 4121 | 'condition' => [ |
| 4122 | $prefix . '_layout' => 'grid_hover-layout3', |
| 4123 | ], |
| 4124 | ] |
| 4125 | ); |
| 4126 | |
| 4127 | $ref->add_responsive_control( |
| 4128 | 'title_alignment', |
| 4129 | [ |
| 4130 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 4131 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 4132 | 'options' => [ |
| 4133 | 'left' => [ |
| 4134 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 4135 | 'icon' => 'eicon-text-align-left', |
| 4136 | ], |
| 4137 | 'center' => [ |
| 4138 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 4139 | 'icon' => 'eicon-text-align-center', |
| 4140 | ], |
| 4141 | 'right' => [ |
| 4142 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 4143 | 'icon' => 'eicon-text-align-right', |
| 4144 | ], |
| 4145 | 'justify' => [ |
| 4146 | 'title' => esc_html__( 'Justify', 'the-post-grid' ), |
| 4147 | 'icon' => 'eicon-text-align-justify', |
| 4148 | ], |
| 4149 | ], |
| 4150 | 'prefix_class' => 'title-alignment-', |
| 4151 | 'toggle' => true, |
| 4152 | 'selectors' => [ |
| 4153 | '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'text-align: {{VALUE}};', |
| 4154 | ], |
| 4155 | ] |
| 4156 | ); |
| 4157 | |
| 4158 | //TODO: Start Title Style Tba |
| 4159 | $ref->start_controls_tabs( |
| 4160 | 'title_style_tabs' |
| 4161 | ); |
| 4162 | |
| 4163 | $ref->start_controls_tab( |
| 4164 | 'title_normal_tab', |
| 4165 | [ |
| 4166 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 4167 | ] |
| 4168 | ); |
| 4169 | //TODO: Normal Tab |
| 4170 | $ref->add_control( |
| 4171 | 'title_color', |
| 4172 | [ |
| 4173 | 'label' => esc_html__( 'Title Color', 'the-post-grid' ), |
| 4174 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4175 | 'selectors' => [ |
| 4176 | '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'color: {{VALUE}}', |
| 4177 | ], |
| 4178 | ] |
| 4179 | ); |
| 4180 | |
| 4181 | $ref->add_control( |
| 4182 | 'title_bg_color', |
| 4183 | [ |
| 4184 | 'label' => esc_html__( 'Title Background', 'the-post-grid' ), |
| 4185 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4186 | 'selectors' => [ |
| 4187 | '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'background-color: {{VALUE}}', |
| 4188 | ], |
| 4189 | ] |
| 4190 | ); |
| 4191 | |
| 4192 | $ref->add_control( |
| 4193 | 'title_border_color', |
| 4194 | [ |
| 4195 | 'label' => esc_html__( 'Title Separator Color', 'the-post-grid' ), |
| 4196 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4197 | 'selectors' => [ |
| 4198 | '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}', |
| 4199 | ], |
| 4200 | 'condition' => [ |
| 4201 | $prefix . '_layout' => 'grid_hover-layout3', |
| 4202 | 'title_border_visibility!' => 'hide', |
| 4203 | ], |
| 4204 | ] |
| 4205 | ); |
| 4206 | |
| 4207 | $ref->add_control( |
| 4208 | 'title_hover_border_color', |
| 4209 | [ |
| 4210 | 'label' => esc_html__( 'Title Hover Border Color', 'the-post-grid' ), |
| 4211 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4212 | 'selectors' => [ |
| 4213 | '{{WRAPPER}}' => '--tpg-primary-color: {{VALUE}}', |
| 4214 | ], |
| 4215 | 'condition' => [ |
| 4216 | 'title_hover_underline' => 'enable', |
| 4217 | ], |
| 4218 | ] |
| 4219 | ); |
| 4220 | |
| 4221 | $ref->end_controls_tab(); |
| 4222 | |
| 4223 | $ref->start_controls_tab( |
| 4224 | 'title_hover_tab', |
| 4225 | [ |
| 4226 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 4227 | ] |
| 4228 | ); |
| 4229 | |
| 4230 | //TODO: Hover Tab |
| 4231 | $ref->add_control( |
| 4232 | 'title_hover_color', |
| 4233 | [ |
| 4234 | 'label' => esc_html__( 'Title Color on Hover', 'the-post-grid' ), |
| 4235 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4236 | 'selectors' => [ |
| 4237 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .entry-title:hover, {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .entry-title a:hover' => 'color: {{VALUE}} !important', |
| 4238 | ], |
| 4239 | ] |
| 4240 | ); |
| 4241 | |
| 4242 | $ref->add_control( |
| 4243 | 'title_bg_color_hover', |
| 4244 | [ |
| 4245 | 'label' => esc_html__( 'Title Background on hover', 'the-post-grid' ), |
| 4246 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4247 | 'selectors' => [ |
| 4248 | '{{WRAPPER}} .tpg-el-main-wrapper .entry-title:hover' => 'background-color: {{VALUE}} !important', |
| 4249 | ], |
| 4250 | ] |
| 4251 | ); |
| 4252 | |
| 4253 | $ref->end_controls_tab(); |
| 4254 | |
| 4255 | $ref->start_controls_tab( |
| 4256 | 'title_box_hover_tab', |
| 4257 | [ |
| 4258 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 4259 | ] |
| 4260 | ); |
| 4261 | |
| 4262 | //TODO: Box Hover Tab |
| 4263 | $ref->add_control( |
| 4264 | 'title_color_box_hover', |
| 4265 | [ |
| 4266 | 'label' => esc_html__( 'Title color on boxhover', 'the-post-grid' ), |
| 4267 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4268 | 'selectors' => [ |
| 4269 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title, {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title a' => 'color: {{VALUE}}', |
| 4270 | ], |
| 4271 | ] |
| 4272 | ); |
| 4273 | |
| 4274 | $ref->add_control( |
| 4275 | 'title_bg_color_box_hover', |
| 4276 | [ |
| 4277 | 'label' => esc_html__( 'Title Background on boxhover', 'the-post-grid' ), |
| 4278 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4279 | 'selectors' => [ |
| 4280 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title' => 'background-color: {{VALUE}}', |
| 4281 | ], |
| 4282 | ] |
| 4283 | ); |
| 4284 | |
| 4285 | $ref->add_control( |
| 4286 | 'title_border_color_hover', |
| 4287 | [ |
| 4288 | 'label' => esc_html__( 'Title Separator color - boxhover', 'the-post-grid' ), |
| 4289 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4290 | 'selectors' => [ |
| 4291 | '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}', |
| 4292 | ], |
| 4293 | 'condition' => [ |
| 4294 | $prefix . '_layout' => 'grid_hover-layout3', |
| 4295 | 'title_border_visibility!' => 'hide', |
| 4296 | ], |
| 4297 | ] |
| 4298 | ); |
| 4299 | |
| 4300 | $ref->end_controls_tab(); |
| 4301 | |
| 4302 | $ref->end_controls_tabs(); |
| 4303 | |
| 4304 | $ref->end_controls_section(); |
| 4305 | } |
| 4306 | |
| 4307 | /** |
| 4308 | * Content Style Tab |
| 4309 | * |
| 4310 | * @param $ref |
| 4311 | */ |
| 4312 | public static function contentStyle( $ref ) { |
| 4313 | $prefix = $ref->prefix; |
| 4314 | |
| 4315 | $ref->start_controls_section( |
| 4316 | 'excerpt_style', |
| 4317 | [ |
| 4318 | 'label' => esc_html__( 'Excerpt / Content', 'the-post-grid' ), |
| 4319 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 4320 | 'condition' => [ |
| 4321 | 'show_excerpt' => 'show', |
| 4322 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 4323 | ], |
| 4324 | ] |
| 4325 | ); |
| 4326 | |
| 4327 | $ref->add_group_control( |
| 4328 | \Elementor\Group_Control_Typography::get_type(), |
| 4329 | [ |
| 4330 | 'name' => 'content_typography', |
| 4331 | 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner', |
| 4332 | ] |
| 4333 | ); |
| 4334 | |
| 4335 | $ref->add_responsive_control( |
| 4336 | 'excerpt_spacing', |
| 4337 | [ |
| 4338 | 'label' => esc_html__( 'Excerpt Spacing', 'the-post-grid' ), |
| 4339 | 'type' => Controls_Manager::DIMENSIONS, |
| 4340 | 'size_units' => [ 'px' ], |
| 4341 | 'selectors' => [ |
| 4342 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4343 | ], |
| 4344 | 'allowed_dimensions' => 'all', |
| 4345 | 'default' => [ |
| 4346 | 'top' => '', |
| 4347 | 'right' => '', |
| 4348 | 'bottom' => '', |
| 4349 | 'left' => '', |
| 4350 | 'isLinked' => false, |
| 4351 | ], |
| 4352 | ] |
| 4353 | ); |
| 4354 | |
| 4355 | $ref->add_responsive_control( |
| 4356 | 'content_alignment', |
| 4357 | [ |
| 4358 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 4359 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 4360 | 'options' => [ |
| 4361 | 'left' => [ |
| 4362 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 4363 | 'icon' => 'eicon-text-align-left', |
| 4364 | ], |
| 4365 | 'center' => [ |
| 4366 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 4367 | 'icon' => 'eicon-text-align-center', |
| 4368 | ], |
| 4369 | 'right' => [ |
| 4370 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 4371 | 'icon' => 'eicon-text-align-right', |
| 4372 | ], |
| 4373 | 'justify' => [ |
| 4374 | 'title' => esc_html__( 'Justify', 'the-post-grid' ), |
| 4375 | 'icon' => 'eicon-text-align-justify', |
| 4376 | ], |
| 4377 | ], |
| 4378 | 'toggle' => true, |
| 4379 | 'selectors' => [ |
| 4380 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner' => 'text-align: {{VALUE}}', |
| 4381 | ], |
| 4382 | ] |
| 4383 | ); |
| 4384 | |
| 4385 | //TODO: Start Content Tab |
| 4386 | |
| 4387 | $ref->start_controls_tabs( |
| 4388 | 'excerpt_style_tabs' |
| 4389 | ); |
| 4390 | |
| 4391 | $ref->start_controls_tab( |
| 4392 | 'excerpt_normal_tab', |
| 4393 | [ |
| 4394 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 4395 | ] |
| 4396 | ); |
| 4397 | |
| 4398 | //TODO: Normal Tab |
| 4399 | $ref->add_control( |
| 4400 | 'excerpt_color', |
| 4401 | [ |
| 4402 | 'label' => esc_html__( 'Excerpt color', 'the-post-grid' ), |
| 4403 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4404 | 'selectors' => [ |
| 4405 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}}', |
| 4406 | ], |
| 4407 | ] |
| 4408 | ); |
| 4409 | |
| 4410 | $ref->add_control( |
| 4411 | 'excerpt_border', |
| 4412 | [ |
| 4413 | 'label' => esc_html__( 'Border color', 'the-post-grid' ), |
| 4414 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4415 | 'selectors' => [ |
| 4416 | '{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder .rt-el-post-meta::before' => 'background: {{VALUE}}', |
| 4417 | ], |
| 4418 | 'condition' => [ |
| 4419 | 'meta_position' => 'default', |
| 4420 | $prefix . '_layout' => [ 'grid-layout3' ], |
| 4421 | ], |
| 4422 | ] |
| 4423 | ); |
| 4424 | |
| 4425 | $ref->end_controls_tab(); |
| 4426 | |
| 4427 | $ref->start_controls_tab( |
| 4428 | 'excerpt_hover_tab', |
| 4429 | [ |
| 4430 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 4431 | ] |
| 4432 | ); |
| 4433 | |
| 4434 | //TODO: Hover Tab |
| 4435 | $ref->add_control( |
| 4436 | 'excerpt_hover_color', |
| 4437 | [ |
| 4438 | 'label' => esc_html__( 'Excerpt color on hover', 'the-post-grid' ), |
| 4439 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4440 | 'selectors' => [ |
| 4441 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}} !important', |
| 4442 | ], |
| 4443 | ] |
| 4444 | ); |
| 4445 | |
| 4446 | $ref->add_control( |
| 4447 | 'excerpt_border_hover', |
| 4448 | [ |
| 4449 | 'label' => esc_html__( 'Border color - Hover', 'the-post-grid' ), |
| 4450 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4451 | 'selectors' => [ |
| 4452 | '{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder:hover .rt-el-post-meta::before' => 'background: {{VALUE}}', |
| 4453 | ], |
| 4454 | 'condition' => [ |
| 4455 | 'meta_position' => 'default', |
| 4456 | $prefix . '_layout' => [ 'grid-layout3' ], |
| 4457 | ], |
| 4458 | ] |
| 4459 | ); |
| 4460 | |
| 4461 | $ref->end_controls_tab(); |
| 4462 | |
| 4463 | $ref->end_controls_tabs(); |
| 4464 | |
| 4465 | $ref->end_controls_section(); |
| 4466 | } |
| 4467 | |
| 4468 | /** |
| 4469 | * Post Meta Style |
| 4470 | * |
| 4471 | * @param $ref |
| 4472 | */ |
| 4473 | public static function metaInfoStyle( $ref ) { |
| 4474 | $prefix = $ref->prefix; |
| 4475 | |
| 4476 | $ref->start_controls_section( |
| 4477 | 'post_meta_style', |
| 4478 | [ |
| 4479 | 'label' => esc_html__( 'Post Meta', 'the-post-grid' ), |
| 4480 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 4481 | 'condition' => [ |
| 4482 | 'show_meta' => 'show', |
| 4483 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 4484 | ], |
| 4485 | ] |
| 4486 | ); |
| 4487 | |
| 4488 | $ref->add_group_control( |
| 4489 | \Elementor\Group_Control_Typography::get_type(), |
| 4490 | [ |
| 4491 | 'name' => 'post_meta_typography', |
| 4492 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-el-post-meta, {{WRAPPER}} .tpg-post-holder .tpg-separate-category .categories-links a', |
| 4493 | ] |
| 4494 | ); |
| 4495 | |
| 4496 | $ref->add_responsive_control( |
| 4497 | 'meta_spacing', |
| 4498 | [ |
| 4499 | 'label' => esc_html__( 'Meta Spacing', 'the-post-grid' ), |
| 4500 | 'type' => Controls_Manager::DIMENSIONS, |
| 4501 | 'size_units' => [ 'px' ], |
| 4502 | 'selectors' => [ |
| 4503 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder .rt-el-post-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4504 | ], |
| 4505 | 'allowed_dimensions' => 'all', |
| 4506 | 'default' => [ |
| 4507 | 'top' => '', |
| 4508 | 'right' => '', |
| 4509 | 'bottom' => '', |
| 4510 | 'left' => '', |
| 4511 | 'isLinked' => false, |
| 4512 | ], |
| 4513 | ] |
| 4514 | ); |
| 4515 | |
| 4516 | $ref->add_control( |
| 4517 | 'separator_cat_heading', |
| 4518 | [ |
| 4519 | 'label' => esc_html__( 'Separate Category', 'the-post-grid' ), |
| 4520 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 4521 | 'classes' => 'tpg-control-type-heading', |
| 4522 | 'condition' => [ |
| 4523 | 'category_position!' => 'default', |
| 4524 | ], |
| 4525 | ] |
| 4526 | ); |
| 4527 | |
| 4528 | $ref->add_group_control( |
| 4529 | \Elementor\Group_Control_Typography::get_type(), |
| 4530 | [ |
| 4531 | 'name' => 'separator_cat_typography', |
| 4532 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .tpg-separate-category', |
| 4533 | 'condition' => [ |
| 4534 | 'category_position!' => 'default', |
| 4535 | ], |
| 4536 | ] |
| 4537 | ); |
| 4538 | |
| 4539 | $ref->add_control( |
| 4540 | 'category_margin_bottom', |
| 4541 | [ |
| 4542 | 'label' => esc_html__( 'Category Margin Bottom', 'the-post-grid' ), |
| 4543 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 4544 | 'min' => 0, |
| 4545 | 'max' => 50, |
| 4546 | 'step' => 1, |
| 4547 | 'condition' => [ |
| 4548 | 'category_position' => 'above_title', |
| 4549 | ], |
| 4550 | 'selectors' => [ |
| 4551 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.above_title' => 'margin-bottom: {{VALUE}}px;', |
| 4552 | ], |
| 4553 | ] |
| 4554 | ); |
| 4555 | |
| 4556 | |
| 4557 | $ref->add_responsive_control( |
| 4558 | 'category_radius', |
| 4559 | [ |
| 4560 | 'label' => esc_html__( 'Category Border Radius', 'the-post-grid' ), |
| 4561 | 'type' => Controls_Manager::DIMENSIONS, |
| 4562 | 'size_units' => [ 'px' ], |
| 4563 | 'selectors' => [ |
| 4564 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4565 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category:not(.style1) .categories-links a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4566 | ], |
| 4567 | 'condition' => [ |
| 4568 | 'category_position!' => 'default', |
| 4569 | 'category_style!' => 'style3', |
| 4570 | ], |
| 4571 | ] |
| 4572 | ); |
| 4573 | |
| 4574 | |
| 4575 | /** |
| 4576 | * TODO: Tags Style |
| 4577 | * ******************** |
| 4578 | */ |
| 4579 | |
| 4580 | |
| 4581 | //TODO: Start Content Tab |
| 4582 | |
| 4583 | $ref->start_controls_tabs( |
| 4584 | 'meta_info_style_tabs' |
| 4585 | ); |
| 4586 | |
| 4587 | $ref->start_controls_tab( |
| 4588 | 'meta_info_normal_tab', |
| 4589 | [ |
| 4590 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 4591 | ] |
| 4592 | ); |
| 4593 | |
| 4594 | //TODO: Normal Tab |
| 4595 | |
| 4596 | $ref->add_control( |
| 4597 | 'meta_info_color', |
| 4598 | [ |
| 4599 | 'label' => esc_html__( 'Meta Color', 'the-post-grid' ), |
| 4600 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4601 | 'selectors' => [ |
| 4602 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags span' => 'color: {{VALUE}}', |
| 4603 | ], |
| 4604 | ] |
| 4605 | ); |
| 4606 | |
| 4607 | $ref->add_control( |
| 4608 | 'meta_link_color', |
| 4609 | [ |
| 4610 | 'label' => esc_html__( 'Meta Link Color', 'the-post-grid' ), |
| 4611 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4612 | 'selectors' => [ |
| 4613 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags a' => 'color: {{VALUE}}', |
| 4614 | ], |
| 4615 | ] |
| 4616 | ); |
| 4617 | |
| 4618 | $ref->add_control( |
| 4619 | 'meta_separator_color', |
| 4620 | [ |
| 4621 | 'label' => esc_html__( 'Separator Color', 'the-post-grid' ), |
| 4622 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4623 | 'selectors' => [ |
| 4624 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .separator' => 'color: {{VALUE}}', |
| 4625 | ], |
| 4626 | 'condition' => [ |
| 4627 | 'meta_separator!' => 'default', |
| 4628 | ], |
| 4629 | ] |
| 4630 | ); |
| 4631 | |
| 4632 | $ref->add_control( |
| 4633 | 'meta_icon_color', |
| 4634 | [ |
| 4635 | 'label' => esc_html__( 'Icon Color', 'the-post-grid' ), |
| 4636 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4637 | 'selectors' => [ |
| 4638 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags i' => 'color: {{VALUE}}', |
| 4639 | ], |
| 4640 | ] |
| 4641 | ); |
| 4642 | |
| 4643 | $ref->add_control( |
| 4644 | 'separate_category_color', |
| 4645 | [ |
| 4646 | 'label' => esc_html__( 'Category Color', 'the-post-grid' ), |
| 4647 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4648 | 'separator' => 'before', |
| 4649 | 'selectors' => [ |
| 4650 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links' => 'color: {{VALUE}}', |
| 4651 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links a' => 'color: {{VALUE}}', |
| 4652 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a' => 'color: {{VALUE}}', |
| 4653 | ], |
| 4654 | ] |
| 4655 | ); |
| 4656 | $ref->add_control( |
| 4657 | 'separate_category_bg', |
| 4658 | [ |
| 4659 | 'label' => esc_html__( 'Category Background', 'the-post-grid' ), |
| 4660 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4661 | 'selectors' => [ |
| 4662 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links' => 'background-color: {{VALUE}};padding: 3px 8px 1px;', |
| 4663 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category:not(.style1) .categories-links a' => 'background-color: {{VALUE}}', |
| 4664 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category:not(.style1) .categories-links a:after' => 'border-top-color: {{VALUE}}', |
| 4665 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a' => 'background-color: {{VALUE}}', |
| 4666 | ], |
| 4667 | ] |
| 4668 | ); |
| 4669 | $ref->add_control( |
| 4670 | 'separate_category_icon_color', |
| 4671 | [ |
| 4672 | 'label' => esc_html__( 'Category Icon Color', 'the-post-grid' ), |
| 4673 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4674 | 'selectors' => [ |
| 4675 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links i' => 'color: {{VALUE}}', |
| 4676 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links i' => 'color: {{VALUE}}', |
| 4677 | ], |
| 4678 | 'condition' => [ |
| 4679 | 'show_cat_icon' => 'yes', |
| 4680 | ], |
| 4681 | ] |
| 4682 | ); |
| 4683 | |
| 4684 | $ref->end_controls_tab(); |
| 4685 | |
| 4686 | $ref->start_controls_tab( |
| 4687 | 'meta_info_hover_tab', |
| 4688 | [ |
| 4689 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 4690 | ] |
| 4691 | ); |
| 4692 | |
| 4693 | //TODO: Hover Tab |
| 4694 | |
| 4695 | |
| 4696 | $ref->add_control( |
| 4697 | 'meta_link_colo_hover', |
| 4698 | [ |
| 4699 | 'label' => esc_html__( 'Meta Link Color - Hover', 'the-post-grid' ), |
| 4700 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4701 | 'selectors' => [ |
| 4702 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .post-meta-tags a:hover' => 'color: {{VALUE}}', |
| 4703 | ], |
| 4704 | ] |
| 4705 | ); |
| 4706 | |
| 4707 | $ref->add_control( |
| 4708 | 'separate_category_color_hover', |
| 4709 | [ |
| 4710 | 'label' => esc_html__( 'Category Color - Hover', 'the-post-grid' ), |
| 4711 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4712 | 'separator' => 'before', |
| 4713 | 'selectors' => [ |
| 4714 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links a:hover' => 'color: {{VALUE}} !important', |
| 4715 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a:hover' => 'color: {{VALUE}} !important', |
| 4716 | ], |
| 4717 | ] |
| 4718 | ); |
| 4719 | |
| 4720 | $ref->add_control( |
| 4721 | 'separate_category_bg_hover', |
| 4722 | [ |
| 4723 | 'label' => esc_html__( 'Category Background - Hover', 'the-post-grid' ), |
| 4724 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4725 | 'selectors' => [ |
| 4726 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links:hover' => 'background-color: {{VALUE}};padding: 3px 8px;', |
| 4727 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links:not(.style1) a:hover' => 'background-color: {{VALUE}}', |
| 4728 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links:not(.style1) a:hover::after' => 'border-top-color: {{VALUE}}', |
| 4729 | '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a:hover' => 'background-color: {{VALUE}}', |
| 4730 | ], |
| 4731 | ] |
| 4732 | ); |
| 4733 | |
| 4734 | $ref->end_controls_tab(); |
| 4735 | |
| 4736 | $ref->start_controls_tab( |
| 4737 | 'meta_info_box_hover_tab', |
| 4738 | [ |
| 4739 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 4740 | ] |
| 4741 | ); |
| 4742 | |
| 4743 | //TODO: Box Hover Tab |
| 4744 | |
| 4745 | |
| 4746 | $ref->add_control( |
| 4747 | 'meta_link_colo_box_hover', |
| 4748 | [ |
| 4749 | 'label' => esc_html__( 'Meta Color - Box Hover', 'the-post-grid' ), |
| 4750 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4751 | 'selectors' => [ |
| 4752 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags *' => 'color: {{VALUE}}', |
| 4753 | ], |
| 4754 | ] |
| 4755 | ); |
| 4756 | |
| 4757 | $ref->add_control( |
| 4758 | 'separate_category_color_box_hover', |
| 4759 | [ |
| 4760 | 'label' => esc_html__( 'Category Color - Hover', 'the-post-grid' ), |
| 4761 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4762 | 'separator' => 'before', |
| 4763 | 'selectors' => [ |
| 4764 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category .categories-links a' => 'color: {{VALUE}}', |
| 4765 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links a' => 'color: {{VALUE}}', |
| 4766 | ], |
| 4767 | ] |
| 4768 | ); |
| 4769 | $ref->add_control( |
| 4770 | 'separate_category_bg_box_hover', |
| 4771 | [ |
| 4772 | 'label' => esc_html__( 'Category Background - Box Hover', 'the-post-grid' ), |
| 4773 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4774 | 'selectors' => [ |
| 4775 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category.style1 .categories-links' => 'background-color: {{VALUE}};padding: 3px 8px;', |
| 4776 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category:not(.style1) .categories-links a' => 'background-color: {{VALUE}}', |
| 4777 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category:not(.style1) .categories-links a::after' => 'border-top-color: {{VALUE}}', |
| 4778 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links a' => 'background-color: {{VALUE}}', |
| 4779 | ], |
| 4780 | ] |
| 4781 | ); |
| 4782 | |
| 4783 | $ref->add_control( |
| 4784 | 'separate_category_icon_color_box_hover', |
| 4785 | [ |
| 4786 | 'label' => esc_html__( 'Category Icon Color - Box Hover', 'the-post-grid' ), |
| 4787 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4788 | 'selectors' => [ |
| 4789 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category .categories-links i' => 'color: {{VALUE}}', |
| 4790 | '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links i' => 'color: {{VALUE}}', |
| 4791 | ], |
| 4792 | 'condition' => [ |
| 4793 | 'show_cat_icon' => 'yes', |
| 4794 | ], |
| 4795 | ] |
| 4796 | ); |
| 4797 | |
| 4798 | $ref->end_controls_tab(); |
| 4799 | |
| 4800 | $ref->end_controls_tabs(); |
| 4801 | |
| 4802 | $ref->end_controls_section(); |
| 4803 | } |
| 4804 | |
| 4805 | |
| 4806 | /** |
| 4807 | * Read More style |
| 4808 | * |
| 4809 | * @param $ref |
| 4810 | */ |
| 4811 | public static function readmoreStyle( $ref ) { |
| 4812 | $prefix = $ref->prefix; |
| 4813 | |
| 4814 | $ref->start_controls_section( |
| 4815 | 'readmore_button_style', |
| 4816 | [ |
| 4817 | 'label' => esc_html__( 'Read More', 'the-post-grid' ), |
| 4818 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 4819 | 'condition' => [ |
| 4820 | 'show_read_more' => 'show', |
| 4821 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 4822 | ], |
| 4823 | ] |
| 4824 | ); |
| 4825 | |
| 4826 | $ref->add_group_control( |
| 4827 | \Elementor\Group_Control_Typography::get_type(), |
| 4828 | [ |
| 4829 | 'name' => 'readmore_typography', |
| 4830 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a', |
| 4831 | ] |
| 4832 | ); |
| 4833 | |
| 4834 | |
| 4835 | $ref->add_responsive_control( |
| 4836 | 'readmore_spacing', |
| 4837 | [ |
| 4838 | 'label' => esc_html__( 'Button Spacing', 'the-post-grid' ), |
| 4839 | 'type' => Controls_Manager::DIMENSIONS, |
| 4840 | 'size_units' => [ 'px' ], |
| 4841 | 'allowed_dimensions' => 'all', |
| 4842 | 'default' => [ |
| 4843 | 'top' => '', |
| 4844 | 'right' => '', |
| 4845 | 'bottom' => '', |
| 4846 | 'left' => '', |
| 4847 | 'isLinked' => false, |
| 4848 | ], |
| 4849 | 'selectors' => [ |
| 4850 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4851 | ], |
| 4852 | ] |
| 4853 | ); |
| 4854 | |
| 4855 | $ref->add_responsive_control( |
| 4856 | 'readmore_padding', |
| 4857 | [ |
| 4858 | 'label' => esc_html__( 'Button Padding', 'the-post-grid' ), |
| 4859 | 'type' => Controls_Manager::DIMENSIONS, |
| 4860 | 'size_units' => [ 'px' ], |
| 4861 | 'selectors' => [ |
| 4862 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 4863 | ], |
| 4864 | 'condition' => [ |
| 4865 | 'readmore_btn_style' => 'default-style', |
| 4866 | ], |
| 4867 | ] |
| 4868 | ); |
| 4869 | |
| 4870 | |
| 4871 | $ref->add_responsive_control( |
| 4872 | 'readmore_btn_alignment', |
| 4873 | [ |
| 4874 | 'label' => esc_html__( 'Button Alignment', 'the-post-grid' ), |
| 4875 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 4876 | 'options' => [ |
| 4877 | 'left' => [ |
| 4878 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 4879 | 'icon' => 'eicon-text-align-left', |
| 4880 | ], |
| 4881 | 'center' => [ |
| 4882 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 4883 | 'icon' => 'eicon-text-align-center', |
| 4884 | ], |
| 4885 | 'right' => [ |
| 4886 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 4887 | 'icon' => 'eicon-text-align-right', |
| 4888 | ], |
| 4889 | ], |
| 4890 | 'selectors' => [ |
| 4891 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more' => 'text-align:{{VALUE}}', |
| 4892 | ], |
| 4893 | 'toggle' => true, |
| 4894 | ] |
| 4895 | ); |
| 4896 | |
| 4897 | $ref->add_control( |
| 4898 | 'readmore_icon_position', |
| 4899 | [ |
| 4900 | 'label' => esc_html__( 'Icon Position', 'the-post-grid' ), |
| 4901 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 4902 | 'default' => 'right', |
| 4903 | 'options' => [ |
| 4904 | 'left' => esc_html__( 'Left', 'the-post-grid' ), |
| 4905 | 'right' => esc_html__( 'Right', 'the-post-grid' ), |
| 4906 | ], |
| 4907 | 'separator' => 'before', |
| 4908 | 'condition' => [ |
| 4909 | 'show_btn_icon' => 'yes', |
| 4910 | ], |
| 4911 | ] |
| 4912 | ); |
| 4913 | |
| 4914 | $ref->add_responsive_control( |
| 4915 | 'readmore_icon_size', |
| 4916 | [ |
| 4917 | 'label' => esc_html__( 'Icon Size', 'the-post-grid' ), |
| 4918 | 'type' => Controls_Manager::SLIDER, |
| 4919 | 'size_units' => [ 'px' ], |
| 4920 | 'range' => [ |
| 4921 | 'px' => [ |
| 4922 | 'min' => 10, |
| 4923 | 'max' => 50, |
| 4924 | 'step' => 1, |
| 4925 | ], |
| 4926 | ], |
| 4927 | 'selectors' => [ |
| 4928 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 4929 | ], |
| 4930 | 'condition' => [ |
| 4931 | 'show_btn_icon' => 'yes', |
| 4932 | ], |
| 4933 | ] |
| 4934 | ); |
| 4935 | |
| 4936 | $ref->add_responsive_control( |
| 4937 | 'readmore_icon_y_position', |
| 4938 | [ |
| 4939 | 'label' => esc_html__( 'Icon Vertical Position', 'the-post-grid' ), |
| 4940 | 'type' => Controls_Manager::SLIDER, |
| 4941 | 'size_units' => [ 'px' ], |
| 4942 | 'range' => [ |
| 4943 | 'px' => [ |
| 4944 | 'min' => - 20, |
| 4945 | 'max' => 20, |
| 4946 | 'step' => 1, |
| 4947 | ], |
| 4948 | ], |
| 4949 | 'selectors' => [ |
| 4950 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'transform: translateY( {{SIZE}}{{UNIT}} );', |
| 4951 | ], |
| 4952 | 'condition' => [ |
| 4953 | 'show_btn_icon' => 'yes', |
| 4954 | ], |
| 4955 | ] |
| 4956 | ); |
| 4957 | |
| 4958 | //TODO: Button style Tabs |
| 4959 | $ref->start_controls_tabs( |
| 4960 | 'readmore_style_tabs' |
| 4961 | ); |
| 4962 | |
| 4963 | $ref->start_controls_tab( |
| 4964 | 'readmore_style_normal_tab', |
| 4965 | [ |
| 4966 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 4967 | ] |
| 4968 | ); |
| 4969 | |
| 4970 | $ref->add_control( |
| 4971 | 'readmore_text_color', |
| 4972 | [ |
| 4973 | 'label' => esc_html__( 'Text Color', 'the-post-grid' ), |
| 4974 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4975 | 'selectors' => [ |
| 4976 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'color: {{VALUE}}', |
| 4977 | ], |
| 4978 | ] |
| 4979 | ); |
| 4980 | |
| 4981 | $ref->add_control( |
| 4982 | 'readmore_icon_color', |
| 4983 | [ |
| 4984 | 'label' => esc_html__( 'Icon Color', 'the-post-grid' ), |
| 4985 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 4986 | 'selectors' => [ |
| 4987 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'color: {{VALUE}}', |
| 4988 | ], |
| 4989 | 'condition' => [ |
| 4990 | 'show_btn_icon' => 'yes', |
| 4991 | ], |
| 4992 | ] |
| 4993 | ); |
| 4994 | |
| 4995 | $ref->add_control( |
| 4996 | 'readmore_bg', |
| 4997 | [ |
| 4998 | 'label' => esc_html__( 'Background Color', 'the-post-grid' ), |
| 4999 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5000 | 'selectors' => [ |
| 5001 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'background-color: {{VALUE}}', |
| 5002 | ], |
| 5003 | 'condition' => [ |
| 5004 | 'readmore_btn_style' => 'default-style', |
| 5005 | ], |
| 5006 | ] |
| 5007 | ); |
| 5008 | |
| 5009 | $ref->add_responsive_control( |
| 5010 | 'readmore_icon_margin', |
| 5011 | [ |
| 5012 | 'label' => esc_html__( 'Icon Spacing', 'the-post-grid' ), |
| 5013 | 'type' => Controls_Manager::DIMENSIONS, |
| 5014 | 'size_units' => [ 'px' ], |
| 5015 | 'allowed_dimensions' => 'horizontal', |
| 5016 | 'default' => [ |
| 5017 | 'top' => '', |
| 5018 | 'right' => '', |
| 5019 | 'bottom' => '', |
| 5020 | 'left' => '', |
| 5021 | 'isLinked' => false, |
| 5022 | ], |
| 5023 | 'selectors' => [ |
| 5024 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5025 | ], |
| 5026 | 'condition' => [ |
| 5027 | 'show_btn_icon' => 'yes', |
| 5028 | ], |
| 5029 | ] |
| 5030 | ); |
| 5031 | |
| 5032 | $ref->add_responsive_control( |
| 5033 | 'border_radius', |
| 5034 | [ |
| 5035 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ), |
| 5036 | 'type' => Controls_Manager::DIMENSIONS, |
| 5037 | 'size_units' => [ 'px', '%', 'em' ], |
| 5038 | 'allowed_dimensions' => 'all', |
| 5039 | 'selectors' => [ |
| 5040 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5041 | ], |
| 5042 | 'condition' => [ |
| 5043 | 'readmore_btn_style' => 'default-style', |
| 5044 | ], |
| 5045 | ] |
| 5046 | ); |
| 5047 | |
| 5048 | $ref->add_group_control( |
| 5049 | \Elementor\Group_Control_Border::get_type(), |
| 5050 | [ |
| 5051 | 'name' => 'readmore_border', |
| 5052 | 'label' => esc_html__( 'Button Border', 'the-post-grid' ), |
| 5053 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a', |
| 5054 | 'fields_options' => [ |
| 5055 | 'border' => [ |
| 5056 | 'default' => 'solid', |
| 5057 | ], |
| 5058 | 'width' => [ |
| 5059 | 'default' => [ |
| 5060 | 'top' => '1', |
| 5061 | 'right' => '1', |
| 5062 | 'bottom' => '1', |
| 5063 | 'left' => '1', |
| 5064 | 'isLinked' => true, |
| 5065 | ], |
| 5066 | ], |
| 5067 | 'color' => [ |
| 5068 | 'default' => '#D4D4D4', |
| 5069 | ], |
| 5070 | ], |
| 5071 | 'condition' => [ |
| 5072 | 'readmore_btn_style' => 'default-style', |
| 5073 | ], |
| 5074 | ] |
| 5075 | ); |
| 5076 | |
| 5077 | $ref->end_controls_tab(); |
| 5078 | |
| 5079 | //TODO: Hover Tab |
| 5080 | |
| 5081 | $ref->start_controls_tab( |
| 5082 | 'readmore_style_hover_tab', |
| 5083 | [ |
| 5084 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 5085 | ] |
| 5086 | ); |
| 5087 | |
| 5088 | $ref->add_control( |
| 5089 | 'readmore_text_color_hover', |
| 5090 | [ |
| 5091 | 'label' => esc_html__( 'Text Color hover', 'the-post-grid' ), |
| 5092 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5093 | 'selectors' => [ |
| 5094 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'color: {{VALUE}}', |
| 5095 | ], |
| 5096 | ] |
| 5097 | ); |
| 5098 | |
| 5099 | $ref->add_control( |
| 5100 | 'readmore_icon_color_hover', |
| 5101 | [ |
| 5102 | 'label' => esc_html__( 'Icon Color Hover', 'the-post-grid' ), |
| 5103 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5104 | 'selectors' => [ |
| 5105 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover i' => 'color: {{VALUE}}', |
| 5106 | ], |
| 5107 | 'condition' => [ |
| 5108 | 'show_btn_icon' => 'yes', |
| 5109 | ], |
| 5110 | ] |
| 5111 | ); |
| 5112 | |
| 5113 | $ref->add_control( |
| 5114 | 'readmore_bg_hover', |
| 5115 | [ |
| 5116 | 'label' => esc_html__( 'Background Color hover', 'the-post-grid' ), |
| 5117 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5118 | 'selectors' => [ |
| 5119 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'background-color: {{VALUE}}', |
| 5120 | ], |
| 5121 | 'condition' => [ |
| 5122 | 'readmore_btn_style' => 'default-style', |
| 5123 | ], |
| 5124 | ] |
| 5125 | ); |
| 5126 | |
| 5127 | $ref->add_responsive_control( |
| 5128 | 'readmore_icon_margin_hover', |
| 5129 | [ |
| 5130 | 'label' => esc_html__( 'Icon Spacing - Hover', 'the-post-grid' ), |
| 5131 | 'type' => Controls_Manager::DIMENSIONS, |
| 5132 | 'size_units' => [ 'px' ], |
| 5133 | 'allowed_dimensions' => 'horizontal', |
| 5134 | 'default' => [ |
| 5135 | 'top' => '', |
| 5136 | 'right' => '', |
| 5137 | 'bottom' => '', |
| 5138 | 'left' => '', |
| 5139 | 'isLinked' => false, |
| 5140 | ], |
| 5141 | 'selectors' => [ |
| 5142 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5143 | ], |
| 5144 | 'condition' => [ |
| 5145 | 'show_btn_icon' => 'yes', |
| 5146 | ], |
| 5147 | ] |
| 5148 | ); |
| 5149 | |
| 5150 | $ref->add_responsive_control( |
| 5151 | 'border_radius_hover', |
| 5152 | [ |
| 5153 | 'label' => esc_html__( 'Border Radius - Hover', 'the-post-grid' ), |
| 5154 | 'type' => Controls_Manager::DIMENSIONS, |
| 5155 | 'size_units' => [ 'px', '%', 'em' ], |
| 5156 | 'allowed_dimensions' => 'all', |
| 5157 | 'selectors' => [ |
| 5158 | 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5159 | ], |
| 5160 | 'condition' => [ |
| 5161 | 'readmore_btn_style' => 'default-style', |
| 5162 | ], |
| 5163 | ] |
| 5164 | ); |
| 5165 | |
| 5166 | $ref->add_group_control( |
| 5167 | \Elementor\Group_Control_Border::get_type(), |
| 5168 | [ |
| 5169 | 'name' => 'readmore_border_hover', |
| 5170 | 'label' => esc_html__( 'Button Border - Hover', 'the-post-grid' ), |
| 5171 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover', |
| 5172 | 'fields_options' => [ |
| 5173 | 'border' => [ |
| 5174 | 'default' => 'solid', |
| 5175 | ], |
| 5176 | 'width' => [ |
| 5177 | 'default' => [ |
| 5178 | 'top' => '1', |
| 5179 | 'right' => '1', |
| 5180 | 'bottom' => '1', |
| 5181 | 'left' => '1', |
| 5182 | 'isLinked' => true, |
| 5183 | ], |
| 5184 | ], |
| 5185 | 'color' => [ |
| 5186 | 'default' => '#7a64f2', |
| 5187 | ], |
| 5188 | ], |
| 5189 | 'condition' => [ |
| 5190 | 'readmore_btn_style' => 'default-style', |
| 5191 | ], |
| 5192 | ] |
| 5193 | ); |
| 5194 | |
| 5195 | $ref->end_controls_tab(); |
| 5196 | |
| 5197 | |
| 5198 | //TODO: Box Hover Tab |
| 5199 | |
| 5200 | $ref->start_controls_tab( |
| 5201 | 'readmore_style_box_hover_tab', |
| 5202 | [ |
| 5203 | 'label' => esc_html__( 'Box Hover', 'the-post-grid' ), |
| 5204 | ] |
| 5205 | ); |
| 5206 | |
| 5207 | $ref->add_control( |
| 5208 | 'readmore_text_color_box_hover', |
| 5209 | [ |
| 5210 | 'label' => esc_html__( 'Text Color - BoxHover', 'the-post-grid' ), |
| 5211 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5212 | 'selectors' => [ |
| 5213 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'color: {{VALUE}}', |
| 5214 | ], |
| 5215 | ] |
| 5216 | ); |
| 5217 | |
| 5218 | $ref->add_control( |
| 5219 | 'readmore_icon_color_box_hover', |
| 5220 | [ |
| 5221 | 'label' => esc_html__( 'Icon Color - BoxHover', 'the-post-grid' ), |
| 5222 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5223 | 'selectors' => [ |
| 5224 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a i' => 'color: {{VALUE}}', |
| 5225 | ], |
| 5226 | 'condition' => [ |
| 5227 | 'show_btn_icon' => 'yes', |
| 5228 | ], |
| 5229 | ] |
| 5230 | ); |
| 5231 | |
| 5232 | $ref->add_control( |
| 5233 | 'readmore_bg_box_hover', |
| 5234 | [ |
| 5235 | 'label' => esc_html__( 'Background Color - BoxHover', 'the-post-grid' ), |
| 5236 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5237 | 'selectors' => [ |
| 5238 | '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'background-color: {{VALUE}}', |
| 5239 | ], |
| 5240 | 'condition' => [ |
| 5241 | 'readmore_btn_style' => 'default-style', |
| 5242 | ], |
| 5243 | ] |
| 5244 | ); |
| 5245 | |
| 5246 | $ref->add_group_control( |
| 5247 | \Elementor\Group_Control_Border::get_type(), |
| 5248 | [ |
| 5249 | 'name' => 'readmore_border_box_hover', |
| 5250 | 'label' => esc_html__( 'Button Border - Box Hover', 'the-post-grid' ), |
| 5251 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a', |
| 5252 | 'condition' => [ |
| 5253 | 'readmore_btn_style' => 'default-style', |
| 5254 | ], |
| 5255 | ] |
| 5256 | ); |
| 5257 | |
| 5258 | |
| 5259 | $ref->end_controls_tab(); |
| 5260 | |
| 5261 | $ref->end_controls_tabs(); |
| 5262 | |
| 5263 | $ref->end_controls_section(); |
| 5264 | } |
| 5265 | |
| 5266 | |
| 5267 | /** |
| 5268 | * Pagination and Load more style tab |
| 5269 | * |
| 5270 | * @param $ref |
| 5271 | */ |
| 5272 | public static function paginationStyle( $ref ) { |
| 5273 | $ref->start_controls_section( |
| 5274 | 'pagination_loadmore_style', |
| 5275 | [ |
| 5276 | 'label' => esc_html__( 'Pagination / Load More', 'the-post-grid' ), |
| 5277 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 5278 | 'condition' => [ |
| 5279 | 'show_pagination' => 'show', |
| 5280 | ], |
| 5281 | ] |
| 5282 | ); |
| 5283 | |
| 5284 | $ref->add_group_control( |
| 5285 | \Elementor\Group_Control_Typography::get_type(), |
| 5286 | [ |
| 5287 | 'name' => 'pagination_typography', |
| 5288 | 'selector' => '{{WRAPPER}} .rt-pagination .pagination-list > li > a, {{WRAPPER}} .rt-pagination .pagination-list > li > span', |
| 5289 | |
| 5290 | ] |
| 5291 | ); |
| 5292 | |
| 5293 | $ref->add_responsive_control( |
| 5294 | 'pagination_text_align', |
| 5295 | [ |
| 5296 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 5297 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5298 | 'options' => [ |
| 5299 | 'flex-start' => [ |
| 5300 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 5301 | 'icon' => 'eicon-text-align-left', |
| 5302 | ], |
| 5303 | 'center' => [ |
| 5304 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 5305 | 'icon' => 'eicon-text-align-center', |
| 5306 | ], |
| 5307 | 'flex-end' => [ |
| 5308 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 5309 | 'icon' => 'eicon-text-align-right', |
| 5310 | ], |
| 5311 | ], |
| 5312 | 'selectors' => [ |
| 5313 | '{{WRAPPER}} .rt-pagination-wrap' => 'justify-content: {{VALUE}};', |
| 5314 | ], |
| 5315 | 'default' => 'center', |
| 5316 | 'toggle' => true, |
| 5317 | ] |
| 5318 | ); |
| 5319 | |
| 5320 | $ref->add_responsive_control( |
| 5321 | 'pagination_spacing', |
| 5322 | [ |
| 5323 | 'label' => esc_html__( 'Button Vertical Spacing', 'the-post-grid' ), |
| 5324 | 'type' => Controls_Manager::DIMENSIONS, |
| 5325 | 'size_units' => [ 'px' ], |
| 5326 | 'allowed_dimensions' => 'vertical', |
| 5327 | 'default' => [ |
| 5328 | 'top' => '', |
| 5329 | 'right' => '', |
| 5330 | 'bottom' => '', |
| 5331 | 'left' => '', |
| 5332 | 'isLinked' => false, |
| 5333 | ], |
| 5334 | 'selectors' => [ |
| 5335 | '{{WRAPPER}} .rt-pagination-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5336 | ], |
| 5337 | 'condition' => [ |
| 5338 | 'pagination_type!' => 'load_on_scroll', |
| 5339 | ], |
| 5340 | ] |
| 5341 | ); |
| 5342 | |
| 5343 | $ref->add_responsive_control( |
| 5344 | 'pagination_padding', |
| 5345 | [ |
| 5346 | 'label' => esc_html__( 'Button Padding', 'the-post-grid' ), |
| 5347 | 'type' => Controls_Manager::DIMENSIONS, |
| 5348 | 'size_units' => [ 'px' ], |
| 5349 | 'allowed_dimensions' => 'all', |
| 5350 | 'selectors' => [ |
| 5351 | '{{WRAPPER}} .rt-pagination .pagination-list > li > a, {{WRAPPER}} .rt-pagination .pagination-list > li > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5352 | ], |
| 5353 | 'condition' => [ |
| 5354 | 'pagination_type!' => 'load_on_scroll', |
| 5355 | ], |
| 5356 | ] |
| 5357 | ); |
| 5358 | |
| 5359 | $ref->add_responsive_control( |
| 5360 | 'pagination_border_radius', |
| 5361 | [ |
| 5362 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ), |
| 5363 | 'type' => Controls_Manager::SLIDER, |
| 5364 | 'size_units' => [ 'px', '%' ], |
| 5365 | 'range' => [ |
| 5366 | 'px' => [ |
| 5367 | 'min' => 0, |
| 5368 | 'max' => 100, |
| 5369 | 'step' => 1, |
| 5370 | ], |
| 5371 | '%' => [ |
| 5372 | 'min' => 0, |
| 5373 | 'max' => 100, |
| 5374 | ], |
| 5375 | ], |
| 5376 | 'selectors' => [ |
| 5377 | '{{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}};', |
| 5378 | '{{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}};', |
| 5379 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 5380 | ], |
| 5381 | 'condition' => [ |
| 5382 | 'pagination_type!' => 'load_on_scroll', |
| 5383 | ], |
| 5384 | ] |
| 5385 | ); |
| 5386 | |
| 5387 | //Button style Tabs |
| 5388 | $ref->start_controls_tabs( |
| 5389 | 'pagination_style_tabs', |
| 5390 | [ |
| 5391 | 'condition' => [ |
| 5392 | 'pagination_type!' => 'load_on_scroll', |
| 5393 | ], |
| 5394 | ] |
| 5395 | ); |
| 5396 | |
| 5397 | |
| 5398 | //TODO: Normal Tab |
| 5399 | $ref->start_controls_tab( |
| 5400 | 'pagination_style_normal_tab', |
| 5401 | [ |
| 5402 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 5403 | ] |
| 5404 | ); |
| 5405 | |
| 5406 | $ref->add_control( |
| 5407 | 'pagination_color', |
| 5408 | [ |
| 5409 | 'label' => esc_html__( 'Color', 'the-post-grid' ), |
| 5410 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5411 | 'selectors' => [ |
| 5412 | '{{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > a, {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'color: {{VALUE}}', |
| 5413 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'color: {{VALUE}}', |
| 5414 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover)' => 'color: {{VALUE}}', |
| 5415 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'color: {{VALUE}}', |
| 5416 | ], |
| 5417 | ] |
| 5418 | ); |
| 5419 | |
| 5420 | $ref->add_control( |
| 5421 | 'pagination_bg', |
| 5422 | [ |
| 5423 | 'label' => esc_html__( 'Background Color', 'the-post-grid' ), |
| 5424 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5425 | 'selectors' => [ |
| 5426 | '{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'background-color: {{VALUE}}', |
| 5427 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'background-color: {{VALUE}}', |
| 5428 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'background-color: {{VALUE}}', |
| 5429 | ], |
| 5430 | |
| 5431 | ] |
| 5432 | ); |
| 5433 | |
| 5434 | $ref->add_control( |
| 5435 | 'pagination_border_color', |
| 5436 | [ |
| 5437 | 'label' => esc_html__( 'Border Color', 'the-post-grid' ), |
| 5438 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5439 | 'selectors' => [ |
| 5440 | '{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'border-color: {{VALUE}}', |
| 5441 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'border-color: {{VALUE}}', |
| 5442 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'border-color: {{VALUE}}', |
| 5443 | ], |
| 5444 | ] |
| 5445 | ); |
| 5446 | |
| 5447 | $ref->end_controls_tab(); |
| 5448 | |
| 5449 | //TODO: Hover Tab |
| 5450 | $ref->start_controls_tab( |
| 5451 | 'pagination_style_hover_tab', |
| 5452 | [ |
| 5453 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 5454 | ] |
| 5455 | ); |
| 5456 | |
| 5457 | $ref->add_control( |
| 5458 | 'pagination_color_hover', |
| 5459 | [ |
| 5460 | 'label' => esc_html__( 'Color - hover', 'the-post-grid' ), |
| 5461 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5462 | 'selectors' => [ |
| 5463 | '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'color: {{VALUE}} !important', |
| 5464 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'color: {{VALUE}} !important', |
| 5465 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'color: {{VALUE}} !important', |
| 5466 | ], |
| 5467 | ] |
| 5468 | ); |
| 5469 | |
| 5470 | $ref->add_control( |
| 5471 | 'pagination_bg_hover', |
| 5472 | [ |
| 5473 | 'label' => esc_html__( 'Background Color - Hover', 'the-post-grid' ), |
| 5474 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5475 | 'selectors' => [ |
| 5476 | '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'background-color: {{VALUE}} !important', |
| 5477 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'background-color: {{VALUE}} !important', |
| 5478 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'background-color: {{VALUE}} !important', |
| 5479 | ], |
| 5480 | ] |
| 5481 | ); |
| 5482 | |
| 5483 | $ref->add_control( |
| 5484 | 'pagination_border_color_hover', |
| 5485 | [ |
| 5486 | 'label' => esc_html__( 'Border Color - Hover', 'the-post-grid' ), |
| 5487 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5488 | 'selectors' => [ |
| 5489 | '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'border-color: {{VALUE}} !important', |
| 5490 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'border-color: {{VALUE}} !important', |
| 5491 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'border-color: {{VALUE}} !important', |
| 5492 | ], |
| 5493 | ] |
| 5494 | ); |
| 5495 | |
| 5496 | $ref->end_controls_tab(); |
| 5497 | |
| 5498 | |
| 5499 | //TODO: Active Tab |
| 5500 | $ref->start_controls_tab( |
| 5501 | 'pagination_style_active_tab', |
| 5502 | [ |
| 5503 | 'label' => esc_html__( 'Active', 'the-post-grid' ), |
| 5504 | ] |
| 5505 | ); |
| 5506 | |
| 5507 | $ref->add_control( |
| 5508 | 'pagination_color_active', |
| 5509 | [ |
| 5510 | 'label' => esc_html__( 'Color - Active', 'the-post-grid' ), |
| 5511 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5512 | 'selectors' => [ |
| 5513 | '{{WRAPPER}} .rt-pagination .pagination-list > .active > a, |
| 5514 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span, |
| 5515 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover, |
| 5516 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover, |
| 5517 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus, |
| 5518 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'color: {{VALUE}} !important', |
| 5519 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'color: {{VALUE}}', |
| 5520 | ], |
| 5521 | ] |
| 5522 | ); |
| 5523 | |
| 5524 | |
| 5525 | $ref->add_control( |
| 5526 | 'pagination_bg_active', |
| 5527 | [ |
| 5528 | 'label' => esc_html__( 'Background Color - Active', 'the-post-grid' ), |
| 5529 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5530 | 'selectors' => [ |
| 5531 | '{{WRAPPER}} .rt-pagination .pagination-list > .active > a, |
| 5532 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span, |
| 5533 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover, |
| 5534 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover, |
| 5535 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus, |
| 5536 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'background-color: {{VALUE}} !important', |
| 5537 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'background-color: {{VALUE}}', |
| 5538 | ], |
| 5539 | ] |
| 5540 | ); |
| 5541 | |
| 5542 | $ref->add_control( |
| 5543 | 'pagination_border_color_active', |
| 5544 | [ |
| 5545 | 'label' => esc_html__( 'Border Color - Active', 'the-post-grid' ), |
| 5546 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5547 | 'selectors' => [ |
| 5548 | '{{WRAPPER}} .rt-pagination .pagination-list > .active > a, |
| 5549 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span, |
| 5550 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover, |
| 5551 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover, |
| 5552 | {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus, |
| 5553 | {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'border-color: {{VALUE}} !important', |
| 5554 | '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'border-color: {{VALUE}}', |
| 5555 | ], |
| 5556 | ] |
| 5557 | ); |
| 5558 | |
| 5559 | $ref->end_controls_tab(); |
| 5560 | |
| 5561 | $ref->end_controls_tabs(); |
| 5562 | |
| 5563 | $ref->end_controls_section(); |
| 5564 | } |
| 5565 | |
| 5566 | |
| 5567 | /** |
| 5568 | * Front-End Filter style |
| 5569 | * |
| 5570 | * @param $ref |
| 5571 | */ |
| 5572 | public static function frontEndFilter( $ref ) { |
| 5573 | if ( ! rtTPG()->hasPro() ) { |
| 5574 | return; |
| 5575 | } |
| 5576 | $ref->start_controls_section( |
| 5577 | 'front_end_filter_style', |
| 5578 | [ |
| 5579 | 'label' => esc_html__( 'Front-End Filter', 'the-post-grid' ), |
| 5580 | 'tab' => Controls_Manager::TAB_STYLE, |
| 5581 | 'conditions' => [ |
| 5582 | 'relation' => 'or', |
| 5583 | 'terms' => [ |
| 5584 | [ |
| 5585 | 'name' => 'show_taxonomy_filter', |
| 5586 | 'operator' => '==', |
| 5587 | 'value' => 'show', |
| 5588 | ], |
| 5589 | [ |
| 5590 | 'name' => 'show_author_filter', |
| 5591 | 'operator' => '==', |
| 5592 | 'value' => 'show', |
| 5593 | ], |
| 5594 | [ |
| 5595 | 'name' => 'show_order_by', |
| 5596 | 'operator' => '==', |
| 5597 | 'value' => 'show', |
| 5598 | ], |
| 5599 | [ |
| 5600 | 'name' => 'show_sort_order', |
| 5601 | 'operator' => '==', |
| 5602 | 'value' => 'show', |
| 5603 | ], |
| 5604 | [ |
| 5605 | 'name' => 'show_search', |
| 5606 | 'operator' => '==', |
| 5607 | 'value' => 'show', |
| 5608 | ], |
| 5609 | ], |
| 5610 | ], |
| 5611 | ] |
| 5612 | ); |
| 5613 | |
| 5614 | $ref->add_group_control( |
| 5615 | \Elementor\Group_Control_Typography::get_type(), |
| 5616 | [ |
| 5617 | 'name' => 'front_filter_typography', |
| 5618 | 'label' => esc_html__( 'Filter Typography', 'the-post-grid' ), |
| 5619 | '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', |
| 5620 | ] |
| 5621 | ); |
| 5622 | |
| 5623 | $ref->add_responsive_control( |
| 5624 | 'filter_text_alignment', |
| 5625 | [ |
| 5626 | 'label' => esc_html__( 'Alignment', 'the-post-grid' ), |
| 5627 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5628 | 'options' => [ |
| 5629 | 'left' => [ |
| 5630 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 5631 | 'icon' => 'eicon-text-align-left', |
| 5632 | ], |
| 5633 | 'center' => [ |
| 5634 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 5635 | 'icon' => 'eicon-text-align-center', |
| 5636 | ], |
| 5637 | 'right' => [ |
| 5638 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 5639 | 'icon' => 'eicon-text-align-right', |
| 5640 | ], |
| 5641 | ], |
| 5642 | 'condition' => [ |
| 5643 | 'filter_type' => 'button', |
| 5644 | 'filter_btn_style' => 'default', |
| 5645 | ], |
| 5646 | 'toggle' => true, |
| 5647 | 'selectors' => [ |
| 5648 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-layout-filter-container .rt-filter-wrap' => 'text-align: {{VALUE}};', |
| 5649 | ], |
| 5650 | ] |
| 5651 | ); |
| 5652 | |
| 5653 | $ref->add_control( |
| 5654 | 'filter_v_alignment', |
| 5655 | [ |
| 5656 | 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ), |
| 5657 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5658 | 'options' => [ |
| 5659 | 'left' => [ |
| 5660 | 'title' => esc_html__( 'Top', 'the-post-grid' ), |
| 5661 | 'icon' => 'eicon-v-align-top', |
| 5662 | ], |
| 5663 | 'center' => [ |
| 5664 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 5665 | 'icon' => 'eicon-v-align-middle', |
| 5666 | ], |
| 5667 | 'right' => [ |
| 5668 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 5669 | 'icon' => 'eicon-v-align-bottom', |
| 5670 | ], |
| 5671 | ], |
| 5672 | 'condition' => [ |
| 5673 | 'filter_type' => 'button', |
| 5674 | 'filter_btn_style' => 'default', |
| 5675 | ], |
| 5676 | 'prefix_class' => 'tpg-filter-alignment-', |
| 5677 | 'toggle' => true, |
| 5678 | ] |
| 5679 | ); |
| 5680 | |
| 5681 | $ref->add_responsive_control( |
| 5682 | 'filter_button_width', |
| 5683 | [ |
| 5684 | 'label' => esc_html__( 'Filter Width', 'the-post-grid' ), |
| 5685 | 'type' => Controls_Manager::SLIDER, |
| 5686 | 'size_units' => [ 'px', '%' ], |
| 5687 | 'range' => [ |
| 5688 | 'px' => [ |
| 5689 | 'min' => 0, |
| 5690 | 'max' => 1000, |
| 5691 | 'step' => 5, |
| 5692 | ], |
| 5693 | '%' => [ |
| 5694 | 'min' => 0, |
| 5695 | 'max' => 100, |
| 5696 | ], |
| 5697 | ], |
| 5698 | 'selectors' => [ |
| 5699 | '{{WRAPPER}} .tpg-header-wrapper.carousel .rt-layout-filter-container' => 'flex: 0 0 {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};', |
| 5700 | ], |
| 5701 | 'condition' => [ |
| 5702 | 'filter_type' => 'button', |
| 5703 | 'filter_btn_style' => 'carousel', |
| 5704 | ], |
| 5705 | ] |
| 5706 | ); |
| 5707 | |
| 5708 | |
| 5709 | $ref->add_control( |
| 5710 | 'border_style', |
| 5711 | [ |
| 5712 | 'label' => esc_html__( 'Filter Border', 'the-post-grid' ), |
| 5713 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 5714 | 'default' => 'disable', |
| 5715 | 'options' => [ |
| 5716 | 'disable' => esc_html__( 'Disable', 'the-post-grid' ), |
| 5717 | 'enable' => esc_html__( 'Enable', 'the-post-grid' ), |
| 5718 | ], |
| 5719 | 'condition' => [ |
| 5720 | 'filter_type' => 'button', |
| 5721 | 'filter_btn_style' => 'carousel', |
| 5722 | 'section_title_style!' => [ 'style2', 'style3' ], |
| 5723 | ], |
| 5724 | 'prefix_class' => 'filter-button-border-', |
| 5725 | ] |
| 5726 | ); |
| 5727 | |
| 5728 | $ref->add_control( |
| 5729 | 'filter_next_prev_btn', |
| 5730 | [ |
| 5731 | 'label' => esc_html__( 'Next/Prev Button', 'the-post-grid' ), |
| 5732 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 5733 | 'default' => 'visible', |
| 5734 | 'options' => [ |
| 5735 | 'visible' => esc_html__( 'Visible', 'the-post-grid' ), |
| 5736 | 'hidden' => esc_html__( 'Hidden', 'the-post-grid' ), |
| 5737 | ], |
| 5738 | 'condition' => [ |
| 5739 | 'filter_type' => 'button', |
| 5740 | 'filter_btn_style' => 'carousel', |
| 5741 | ], |
| 5742 | 'prefix_class' => 'filter-nex-prev-btn-', |
| 5743 | ] |
| 5744 | ); |
| 5745 | |
| 5746 | $ref->add_control( |
| 5747 | 'filter_h_alignment', |
| 5748 | [ |
| 5749 | 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ), |
| 5750 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 5751 | 'options' => [ |
| 5752 | 'left' => [ |
| 5753 | 'title' => esc_html__( 'Top', 'the-post-grid' ), |
| 5754 | 'icon' => 'eicon-justify-start-h', |
| 5755 | ], |
| 5756 | 'center' => [ |
| 5757 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 5758 | 'icon' => 'eicon-justify-center-h', |
| 5759 | ], |
| 5760 | 'right' => [ |
| 5761 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 5762 | 'icon' => 'eicon-justify-end-h', |
| 5763 | ], |
| 5764 | 'space-between' => [ |
| 5765 | 'title' => esc_html__( 'Space Between', 'the-post-grid' ), |
| 5766 | 'icon' => 'eicon-justify-space-between-h', |
| 5767 | ], |
| 5768 | ], |
| 5769 | 'condition' => [ |
| 5770 | 'filter_type!' => 'button', |
| 5771 | ], |
| 5772 | 'prefix_class' => 'tpg-filter-h-alignment-', |
| 5773 | 'toggle' => true, |
| 5774 | ] |
| 5775 | ); |
| 5776 | |
| 5777 | $ref->add_responsive_control( |
| 5778 | 'filter_btn_radius', |
| 5779 | [ |
| 5780 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ), |
| 5781 | 'type' => Controls_Manager::DIMENSIONS, |
| 5782 | 'size_units' => [ 'px' ], |
| 5783 | 'selectors' => [ |
| 5784 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5785 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5786 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 5787 | ], |
| 5788 | 'condition' => [ |
| 5789 | 'filter_btn_style' => 'default', |
| 5790 | ], |
| 5791 | ] |
| 5792 | ); |
| 5793 | |
| 5794 | |
| 5795 | //TODO: Start Tab |
| 5796 | $ref->start_controls_tabs( |
| 5797 | 'frontend_filter_style_tabs' |
| 5798 | ); |
| 5799 | |
| 5800 | $ref->start_controls_tab( |
| 5801 | 'frontend_filter_style_normal_tab', |
| 5802 | [ |
| 5803 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 5804 | ] |
| 5805 | ); |
| 5806 | |
| 5807 | $ref->add_control( |
| 5808 | 'filter_color', |
| 5809 | [ |
| 5810 | 'label' => esc_html__( 'Filter Color', 'the-post-grid' ), |
| 5811 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5812 | 'selectors' => [ |
| 5813 | '{{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}}', |
| 5814 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'color: {{VALUE}}', |
| 5815 | '{{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}}', |
| 5816 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'color: {{VALUE}}', |
| 5817 | ], |
| 5818 | ] |
| 5819 | ); |
| 5820 | |
| 5821 | $ref->add_control( |
| 5822 | 'filter_bg_color', |
| 5823 | [ |
| 5824 | 'label' => esc_html__( 'Filter Background Color', 'the-post-grid' ), |
| 5825 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5826 | 'selectors' => [ |
| 5827 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'background-color: {{VALUE}}', |
| 5828 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'background-color: {{VALUE}}', |
| 5829 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action' => 'background-color: {{VALUE}}', |
| 5830 | ], |
| 5831 | ] |
| 5832 | ); |
| 5833 | |
| 5834 | $ref->add_control( |
| 5835 | 'filter_border_color', |
| 5836 | [ |
| 5837 | 'label' => esc_html__( 'Filter Border Color', 'the-post-grid' ), |
| 5838 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5839 | 'selectors' => [ |
| 5840 | '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'border-color: {{VALUE}}', |
| 5841 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'border-color: {{VALUE}}', |
| 5842 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action' => 'border-color: {{VALUE}}', |
| 5843 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'border-color: {{VALUE}}', |
| 5844 | '{{WRAPPER}}.filter-button-border-enable .tpg-header-wrapper.carousel .rt-layout-filter-container' => 'border-color: {{VALUE}}', |
| 5845 | ], |
| 5846 | ] |
| 5847 | ); |
| 5848 | |
| 5849 | $ref->add_control( |
| 5850 | 'filter_search_bg', |
| 5851 | [ |
| 5852 | 'label' => esc_html__( 'Search Background', 'the-post-grid' ), |
| 5853 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5854 | 'selectors' => [ |
| 5855 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'background-color: {{VALUE}}', |
| 5856 | ], |
| 5857 | 'condition' => [ |
| 5858 | 'show_search' => 'show', |
| 5859 | 'filter_btn_style' => 'default', |
| 5860 | ], |
| 5861 | ] |
| 5862 | ); |
| 5863 | |
| 5864 | $ref->add_control( |
| 5865 | 'sub_menu_color_heading', |
| 5866 | [ |
| 5867 | 'label' => esc_html__( 'Sub Menu Options', 'the-post-grid' ), |
| 5868 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 5869 | 'separator' => 'before', |
| 5870 | 'classes' => 'tpg-control-type-heading', |
| 5871 | 'condition' => [ |
| 5872 | 'filter_type' => 'dropdown', |
| 5873 | ], |
| 5874 | ] |
| 5875 | ); |
| 5876 | |
| 5877 | $ref->add_control( |
| 5878 | 'sub_menu_bg_color', |
| 5879 | [ |
| 5880 | 'label' => esc_html__( 'Submenu Background', 'the-post-grid' ), |
| 5881 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5882 | 'selectors' => [ |
| 5883 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown' => 'background-color: {{VALUE}}', |
| 5884 | ], |
| 5885 | 'condition' => [ |
| 5886 | 'filter_type' => 'dropdown', |
| 5887 | ], |
| 5888 | ] |
| 5889 | ); |
| 5890 | |
| 5891 | $ref->add_control( |
| 5892 | 'sub_menu_color', |
| 5893 | [ |
| 5894 | 'label' => esc_html__( 'Submenu Color', 'the-post-grid' ), |
| 5895 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5896 | 'selectors' => [ |
| 5897 | '{{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}}', |
| 5898 | ], |
| 5899 | 'condition' => [ |
| 5900 | 'filter_type' => 'dropdown', |
| 5901 | ], |
| 5902 | ] |
| 5903 | ); |
| 5904 | |
| 5905 | $ref->add_control( |
| 5906 | 'sub_menu_border_bottom', |
| 5907 | [ |
| 5908 | 'label' => esc_html__( 'Submenu Border', 'the-post-grid' ), |
| 5909 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5910 | 'selectors' => [ |
| 5911 | '{{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}}', |
| 5912 | ], |
| 5913 | 'condition' => [ |
| 5914 | 'filter_type' => 'dropdown', |
| 5915 | ], |
| 5916 | ] |
| 5917 | ); |
| 5918 | |
| 5919 | $ref->add_control( |
| 5920 | 'filter_nav_color', |
| 5921 | [ |
| 5922 | 'label' => esc_html__( 'Filter Nav Color', 'the-post-grid' ), |
| 5923 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5924 | 'selectors' => [ |
| 5925 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'color: {{VALUE}}', |
| 5926 | ], |
| 5927 | 'condition' => [ |
| 5928 | 'filter_btn_style' => 'carousel', |
| 5929 | 'filter_next_prev_btn' => 'visible', |
| 5930 | ], |
| 5931 | ] |
| 5932 | ); |
| 5933 | |
| 5934 | $ref->add_control( |
| 5935 | 'filter_nav_bg', |
| 5936 | [ |
| 5937 | 'label' => esc_html__( 'Filter Nav Background', 'the-post-grid' ), |
| 5938 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5939 | 'selectors' => [ |
| 5940 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'background-color: {{VALUE}}', |
| 5941 | ], |
| 5942 | 'condition' => [ |
| 5943 | 'filter_btn_style' => 'carousel', |
| 5944 | 'filter_next_prev_btn' => 'visible', |
| 5945 | ], |
| 5946 | ] |
| 5947 | ); |
| 5948 | |
| 5949 | $ref->add_control( |
| 5950 | 'filter_nav_border', |
| 5951 | [ |
| 5952 | 'label' => esc_html__( 'Filter Nav Border', 'the-post-grid' ), |
| 5953 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5954 | 'selectors' => [ |
| 5955 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'border-color: {{VALUE}}', |
| 5956 | ], |
| 5957 | 'condition' => [ |
| 5958 | 'filter_btn_style' => 'carousel', |
| 5959 | 'filter_next_prev_btn' => 'visible', |
| 5960 | ], |
| 5961 | ] |
| 5962 | ); |
| 5963 | |
| 5964 | $ref->end_controls_tab(); |
| 5965 | |
| 5966 | //TODO: Start Tab Hover |
| 5967 | $ref->start_controls_tab( |
| 5968 | 'frontend_filter_style_hover_tab', |
| 5969 | [ |
| 5970 | 'label' => esc_html__( 'Hover / Active', 'the-post-grid' ), |
| 5971 | ] |
| 5972 | ); |
| 5973 | |
| 5974 | $ref->add_control( |
| 5975 | 'filter_color_hover', |
| 5976 | [ |
| 5977 | 'label' => esc_html__( 'Filter Color - Hover', 'the-post-grid' ), |
| 5978 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5979 | 'selectors' => [ |
| 5980 | '{{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}}', |
| 5981 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'color: {{VALUE}}', |
| 5982 | '{{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}}', |
| 5983 | ], |
| 5984 | ] |
| 5985 | ); |
| 5986 | |
| 5987 | $ref->add_control( |
| 5988 | 'filter_bg_color_hover', |
| 5989 | [ |
| 5990 | 'label' => esc_html__( 'Filter Background Color - Hover', 'the-post-grid' ), |
| 5991 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 5992 | 'selectors' => [ |
| 5993 | '{{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}}', |
| 5994 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'background-color: {{VALUE}}', |
| 5995 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action:hover' => 'background-color: {{VALUE}}', |
| 5996 | ], |
| 5997 | ] |
| 5998 | ); |
| 5999 | |
| 6000 | $ref->add_control( |
| 6001 | 'filter_border_color_hover', |
| 6002 | [ |
| 6003 | 'label' => esc_html__( 'Filter Border Color - Hover', 'the-post-grid' ), |
| 6004 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6005 | 'selectors' => [ |
| 6006 | '{{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}}', |
| 6007 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'border-color: {{VALUE}}', |
| 6008 | '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action:hover' => 'border-color: {{VALUE}}', |
| 6009 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input:hover' => 'border-color: {{VALUE}}', |
| 6010 | '{{WRAPPER}}.filter-button-border-enable .tpg-header-wrapper.carousel .rt-layout-filter-container:hover' => 'border-color: {{VALUE}}', |
| 6011 | ], |
| 6012 | ] |
| 6013 | ); |
| 6014 | |
| 6015 | $ref->add_control( |
| 6016 | 'filter_search_bg_hover', |
| 6017 | [ |
| 6018 | 'label' => esc_html__( 'Search Background - Hover', 'the-post-grid' ), |
| 6019 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6020 | 'selectors' => [ |
| 6021 | '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input:hover' => 'background-color: {{VALUE}}', |
| 6022 | ], |
| 6023 | 'condition' => [ |
| 6024 | 'show_search' => 'show', |
| 6025 | 'filter_btn_style' => 'default', |
| 6026 | ], |
| 6027 | ] |
| 6028 | ); |
| 6029 | |
| 6030 | $ref->add_control( |
| 6031 | 'sub_menu_color_heading_hover', |
| 6032 | [ |
| 6033 | 'label' => esc_html__( 'Sub Menu Options - Hover', 'the-post-grid' ), |
| 6034 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 6035 | 'separator' => 'before', |
| 6036 | 'classes' => 'tpg-control-type-heading', |
| 6037 | 'condition' => [ |
| 6038 | 'filter_type' => 'dropdown', |
| 6039 | ], |
| 6040 | ] |
| 6041 | ); |
| 6042 | |
| 6043 | $ref->add_control( |
| 6044 | 'sub_menu_bg_color_hover', |
| 6045 | [ |
| 6046 | 'label' => esc_html__( 'Submenu Background - Hover', 'the-post-grid' ), |
| 6047 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6048 | 'selectors' => [ |
| 6049 | '{{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}}', |
| 6050 | ], |
| 6051 | 'condition' => [ |
| 6052 | 'filter_type' => 'dropdown', |
| 6053 | ], |
| 6054 | ] |
| 6055 | ); |
| 6056 | |
| 6057 | $ref->add_control( |
| 6058 | 'sub_menu_color_hover', |
| 6059 | [ |
| 6060 | 'label' => esc_html__( 'Submenu Color - Hover', 'the-post-grid' ), |
| 6061 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6062 | 'selectors' => [ |
| 6063 | '{{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}}', |
| 6064 | ], |
| 6065 | 'condition' => [ |
| 6066 | 'filter_type' => 'dropdown', |
| 6067 | ], |
| 6068 | ] |
| 6069 | ); |
| 6070 | |
| 6071 | $ref->add_control( |
| 6072 | 'sub_menu_border_bottom_hover', |
| 6073 | [ |
| 6074 | 'label' => esc_html__( 'Submenu Border - Hover', 'the-post-grid' ), |
| 6075 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6076 | 'selectors' => [ |
| 6077 | '{{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}}', |
| 6078 | ], |
| 6079 | 'condition' => [ |
| 6080 | 'filter_type' => 'dropdown', |
| 6081 | ], |
| 6082 | ] |
| 6083 | ); |
| 6084 | |
| 6085 | $ref->add_control( |
| 6086 | 'filter_nav_color_hover', |
| 6087 | [ |
| 6088 | 'label' => esc_html__( 'Filter Nav Color - Hover', 'the-post-grid' ), |
| 6089 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6090 | 'selectors' => [ |
| 6091 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'color: {{VALUE}}', |
| 6092 | ], |
| 6093 | 'condition' => [ |
| 6094 | 'filter_btn_style' => 'carousel', |
| 6095 | 'filter_next_prev_btn' => 'visible', |
| 6096 | ], |
| 6097 | ] |
| 6098 | ); |
| 6099 | |
| 6100 | $ref->add_control( |
| 6101 | 'filter_nav_bg_hover', |
| 6102 | [ |
| 6103 | 'label' => esc_html__( 'Filter Nav Background - Hover', 'the-post-grid' ), |
| 6104 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6105 | 'selectors' => [ |
| 6106 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'background-color: {{VALUE}}', |
| 6107 | ], |
| 6108 | 'condition' => [ |
| 6109 | 'filter_btn_style' => 'carousel', |
| 6110 | 'filter_next_prev_btn' => 'visible', |
| 6111 | ], |
| 6112 | ] |
| 6113 | ); |
| 6114 | |
| 6115 | $ref->add_control( |
| 6116 | 'filter_nav_border_hover', |
| 6117 | [ |
| 6118 | 'label' => esc_html__( 'Filter Nav Border - Hover', 'the-post-grid' ), |
| 6119 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6120 | 'selectors' => [ |
| 6121 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'border-color: {{VALUE}}', |
| 6122 | ], |
| 6123 | 'condition' => [ |
| 6124 | 'filter_btn_style' => 'carousel', |
| 6125 | 'filter_next_prev_btn' => 'visible', |
| 6126 | ], |
| 6127 | ] |
| 6128 | ); |
| 6129 | |
| 6130 | |
| 6131 | $ref->end_controls_tab(); |
| 6132 | |
| 6133 | $ref->end_controls_tabs(); |
| 6134 | //TODO: End Tab |
| 6135 | |
| 6136 | |
| 6137 | $ref->end_controls_section(); |
| 6138 | } |
| 6139 | |
| 6140 | |
| 6141 | /** |
| 6142 | * Social Share control |
| 6143 | * |
| 6144 | * @param $ref |
| 6145 | */ |
| 6146 | public static function socialShareStyle( $ref ) { |
| 6147 | $prefix = $ref->prefix; |
| 6148 | $ref->start_controls_section( |
| 6149 | 'social_share_style', |
| 6150 | [ |
| 6151 | 'label' => esc_html__( 'Social Share', 'the-post-grid' ), |
| 6152 | 'tab' => Controls_Manager::TAB_STYLE, |
| 6153 | 'condition' => [ |
| 6154 | 'show_social_share' => 'show', |
| 6155 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 6156 | ], |
| 6157 | ] |
| 6158 | ); |
| 6159 | |
| 6160 | self::get_social_share_control( $ref ); |
| 6161 | |
| 6162 | $ref->end_controls_section(); |
| 6163 | } |
| 6164 | |
| 6165 | /** |
| 6166 | |
| 6167 | * Get Social Share |
| 6168 | * |
| 6169 | * @param $ref |
| 6170 | * @param $prefix |
| 6171 | */ |
| 6172 | public static function get_social_share_control( $ref ) { |
| 6173 | $ref->add_control( |
| 6174 | 'social_icon_style', |
| 6175 | [ |
| 6176 | 'label' => esc_html__( 'Icon Color Style', 'the-post-grid' ), |
| 6177 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 6178 | 'default' => 'default', |
| 6179 | 'options' => [ |
| 6180 | 'default' => esc_html__( 'Default (Brand Color)', 'the-post-grid' ), |
| 6181 | 'different_color' => esc_html__( 'Different Color for each', 'the-post-grid' ), |
| 6182 | 'custom' => esc_html__( 'Custom color', 'the-post-grid' ), |
| 6183 | ], |
| 6184 | 'description' => esc_html__( 'Select Custom for your own customize', 'the-post-grid' ), |
| 6185 | ] |
| 6186 | ); |
| 6187 | |
| 6188 | $settings = get_option( rtTPG()->options['settings'] ); |
| 6189 | $ssList = ! empty( $settings['social_share_items'] ) ? $settings['social_share_items'] : []; |
| 6190 | |
| 6191 | $ref->add_responsive_control( |
| 6192 | 'social_icon_margin', |
| 6193 | [ |
| 6194 | 'label' => esc_html__( 'Icon Margin', 'the-post-grid' ), |
| 6195 | 'type' => Controls_Manager::DIMENSIONS, |
| 6196 | 'size_units' => [ 'px' ], |
| 6197 | 'allowed_dimensions' => 'all', |
| 6198 | 'selectors' => [ |
| 6199 | '{{WRAPPER}} .rt-tpg-social-share a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6200 | ], |
| 6201 | ] |
| 6202 | ); |
| 6203 | |
| 6204 | $ref->add_responsive_control( |
| 6205 | 'social_wrapper_margin', |
| 6206 | [ |
| 6207 | 'label' => esc_html__( 'Icon Wrapper Spacing', 'the-post-grid' ), |
| 6208 | 'type' => Controls_Manager::DIMENSIONS, |
| 6209 | 'size_units' => [ 'px' ], |
| 6210 | 'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ] |
| 6211 | 'default' => [ |
| 6212 | 'top' => '', |
| 6213 | 'right' => '', |
| 6214 | 'bottom' => '', |
| 6215 | 'left' => '', |
| 6216 | 'isLinked' => false, |
| 6217 | ], |
| 6218 | 'selectors' => [ |
| 6219 | '{{WRAPPER}} .rt-tpg-social-share' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6220 | ], |
| 6221 | ] |
| 6222 | ); |
| 6223 | |
| 6224 | $ref->add_responsive_control( |
| 6225 | 'social_icon_radius', |
| 6226 | [ |
| 6227 | 'label' => esc_html__( 'Border Radius', 'the-post-grid' ), |
| 6228 | 'type' => Controls_Manager::DIMENSIONS, |
| 6229 | 'size_units' => [ 'px', '%', 'em' ], |
| 6230 | 'allowed_dimensions' => 'all', |
| 6231 | 'default' => [ |
| 6232 | 'top' => '', |
| 6233 | 'right' => '', |
| 6234 | 'bottom' => '', |
| 6235 | 'left' => '', |
| 6236 | 'isLinked' => true, |
| 6237 | ], |
| 6238 | 'selectors' => [ |
| 6239 | '{{WRAPPER}} .rt-tpg-social-share i' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 6240 | ], |
| 6241 | ] |
| 6242 | ); |
| 6243 | |
| 6244 | $ref->add_control( |
| 6245 | 'icon_width_height', |
| 6246 | [ |
| 6247 | 'label' => esc_html__( 'Icon Dimension', 'the-post-grid' ), |
| 6248 | 'type' => \Elementor\Controls_Manager::IMAGE_DIMENSIONS, |
| 6249 | 'default' => [ |
| 6250 | 'width' => '', |
| 6251 | 'height' => '', |
| 6252 | ], |
| 6253 | 'selectors' => [ |
| 6254 | '{{WRAPPER}} .rt-tpg-social-share a i' => 'width:{{width}}px; height:{{height}}px; line-height:{{height}}px; text-align:center', |
| 6255 | ], |
| 6256 | 'description' => esc_html__( 'Just write number. Don\'t use (px or em).', 'the-post-grid' ), |
| 6257 | 'classes' => 'should-show-title', |
| 6258 | ] |
| 6259 | ); |
| 6260 | |
| 6261 | $ref->add_responsive_control( |
| 6262 | 'icon_font_size', |
| 6263 | [ |
| 6264 | 'label' => esc_html__( 'Icon Font Size', 'the-post-grid' ), |
| 6265 | 'type' => Controls_Manager::SLIDER, |
| 6266 | 'size_units' => [ 'px' ], |
| 6267 | 'range' => [ |
| 6268 | 'px' => [ |
| 6269 | 'min' => 12, |
| 6270 | 'max' => 50, |
| 6271 | 'step' => 1, |
| 6272 | ], |
| 6273 | ], |
| 6274 | 'selectors' => [ |
| 6275 | '{{WRAPPER}} .rt-tpg-social-share a i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 6276 | ], |
| 6277 | ] |
| 6278 | ); |
| 6279 | |
| 6280 | //TODO: Start Social Share Tabs Tab |
| 6281 | $ref->start_controls_tabs( |
| 6282 | 'social_share_style_tabs' |
| 6283 | ); |
| 6284 | |
| 6285 | $ref->start_controls_tab( |
| 6286 | 'social_share_normal_tab', |
| 6287 | [ |
| 6288 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 6289 | ] |
| 6290 | ); |
| 6291 | //TODO: Normal Tab |
| 6292 | |
| 6293 | |
| 6294 | $ref->add_control( |
| 6295 | 'social_icon_color', |
| 6296 | [ |
| 6297 | 'label' => esc_html__( 'Social Icon color', 'the-post-grid' ), |
| 6298 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6299 | 'selectors' => [ |
| 6300 | '{{WRAPPER}} .rt-tpg-social-share a i' => 'color: {{VALUE}}', |
| 6301 | ], |
| 6302 | 'condition' => [ |
| 6303 | 'social_icon_style' => 'custom', |
| 6304 | ], |
| 6305 | ] |
| 6306 | ); |
| 6307 | |
| 6308 | $ref->add_control( |
| 6309 | 'social_icon_bg_color', |
| 6310 | [ |
| 6311 | 'label' => esc_html__( 'Social Icon Background', 'the-post-grid' ), |
| 6312 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6313 | 'selectors' => [ |
| 6314 | '{{WRAPPER}} .rt-tpg-social-share a i' => 'background-color: {{VALUE}}', |
| 6315 | ], |
| 6316 | 'condition' => [ |
| 6317 | 'social_icon_style' => 'custom', |
| 6318 | ], |
| 6319 | ] |
| 6320 | ); |
| 6321 | |
| 6322 | |
| 6323 | foreach ( $ssList as $ss ) { |
| 6324 | $ref->add_control( |
| 6325 | $ss . '_social_icon_color', |
| 6326 | [ |
| 6327 | 'label' => ucwords( $ss ) . esc_html__( ' color', 'the-post-grid' ), |
| 6328 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6329 | 'selectors' => [ |
| 6330 | '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'color: {{VALUE}}', |
| 6331 | ], |
| 6332 | 'condition' => [ |
| 6333 | 'social_icon_style' => 'different_color', |
| 6334 | ], |
| 6335 | ] |
| 6336 | ); |
| 6337 | |
| 6338 | $ref->add_control( |
| 6339 | $ss . '_social_icon_bg_color', |
| 6340 | [ |
| 6341 | 'label' => ucwords( $ss ) . esc_html__( ' Background', 'the-post-grid' ), |
| 6342 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6343 | 'selectors' => [ |
| 6344 | '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'background-color: {{VALUE}}', |
| 6345 | ], |
| 6346 | 'condition' => [ |
| 6347 | 'social_icon_style' => 'different_color', |
| 6348 | ], |
| 6349 | ] |
| 6350 | ); |
| 6351 | } |
| 6352 | |
| 6353 | |
| 6354 | $ref->add_group_control( |
| 6355 | \Elementor\Group_Control_Border::get_type(), |
| 6356 | [ |
| 6357 | 'name' => 'social_icon_border', |
| 6358 | 'label' => esc_html__( 'Icon Border', 'the-post-grid' ), |
| 6359 | 'selector' => '{{WRAPPER}} .rt-tpg-social-share a i', |
| 6360 | ] |
| 6361 | ); |
| 6362 | |
| 6363 | $ref->end_controls_tab(); |
| 6364 | |
| 6365 | $ref->start_controls_tab( |
| 6366 | 'socia_hover_tab', |
| 6367 | [ |
| 6368 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 6369 | ] |
| 6370 | ); |
| 6371 | |
| 6372 | //TODO: Hover Tab |
| 6373 | |
| 6374 | $ref->add_control( |
| 6375 | 'social_icon_color_hover', |
| 6376 | [ |
| 6377 | 'label' => esc_html__( 'Icon color', 'the-post-grid' ), |
| 6378 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6379 | 'selectors' => [ |
| 6380 | '{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'color: {{VALUE}}', |
| 6381 | ], |
| 6382 | 'condition' => [ |
| 6383 | 'social_icon_style' => 'custom', |
| 6384 | ], |
| 6385 | ] |
| 6386 | ); |
| 6387 | |
| 6388 | $ref->add_control( |
| 6389 | 'social_icon_bg_color_hover', |
| 6390 | [ |
| 6391 | 'label' => esc_html__( 'Social Icon Background', 'the-post-grid' ), |
| 6392 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6393 | 'selectors' => [ |
| 6394 | '{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'background-color: {{VALUE}}', |
| 6395 | ], |
| 6396 | 'condition' => [ |
| 6397 | 'social_icon_style' => 'custom', |
| 6398 | ], |
| 6399 | ] |
| 6400 | ); |
| 6401 | |
| 6402 | foreach ( $ssList as $ss ) { |
| 6403 | $ref->add_control( |
| 6404 | $ss . '_social_icon_color_hover', |
| 6405 | [ |
| 6406 | 'label' => ucwords( $ss ) . esc_html__( ' color - Hover', 'the-post-grid' ), |
| 6407 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6408 | 'selectors' => [ |
| 6409 | '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ':hover i' => 'color: {{VALUE}}', |
| 6410 | ], |
| 6411 | 'condition' => [ |
| 6412 | 'social_icon_style' => 'different_color', |
| 6413 | ], |
| 6414 | ] |
| 6415 | ); |
| 6416 | |
| 6417 | $ref->add_control( |
| 6418 | $ss . '_social_icon_bg_color_hover', |
| 6419 | [ |
| 6420 | 'label' => ucwords( $ss ) . esc_html__( ' Background - Hover', 'the-post-grid' ), |
| 6421 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6422 | 'selectors' => [ |
| 6423 | '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ':hover i' => 'background-color: {{VALUE}}', |
| 6424 | ], |
| 6425 | 'condition' => [ |
| 6426 | 'social_icon_style' => 'different_color', |
| 6427 | ], |
| 6428 | ] |
| 6429 | ); |
| 6430 | } |
| 6431 | |
| 6432 | $ref->add_group_control( |
| 6433 | \Elementor\Group_Control_Border::get_type(), |
| 6434 | [ |
| 6435 | 'name' => 'social_icon_border_hover', |
| 6436 | 'label' => esc_html__( 'Icon Border - Hover', 'the-post-grid' ), |
| 6437 | 'selector' => '{{WRAPPER}} .rt-tpg-social-share a:hover i', |
| 6438 | ] |
| 6439 | ); |
| 6440 | |
| 6441 | $ref->end_controls_tab(); |
| 6442 | |
| 6443 | $ref->end_controls_tabs(); |
| 6444 | } |
| 6445 | |
| 6446 | /** |
| 6447 | * Box Settings |
| 6448 | * |
| 6449 | * @param $ref |
| 6450 | */ |
| 6451 | public static function articlBoxSettings( $ref ) { |
| 6452 | $prefix = $ref->prefix; |
| 6453 | $ref->start_controls_section( |
| 6454 | 'article_box_settings', |
| 6455 | [ |
| 6456 | 'label' => esc_html__( 'Card', 'the-post-grid' ), |
| 6457 | 'tab' => Controls_Manager::TAB_STYLE, |
| 6458 | ] |
| 6459 | ); |
| 6460 | |
| 6461 | if ( 'slider' !== $prefix ) { |
| 6462 | $ref->add_responsive_control( |
| 6463 | 'box_margin', |
| 6464 | [ |
| 6465 | 'label' => esc_html__( 'Card Gap', 'the-post-grid' ), |
| 6466 | 'type' => Controls_Manager::DIMENSIONS, |
| 6467 | 'size_units' => [ 'px' ], |
| 6468 | 'render_type' => 'template', |
| 6469 | 'selectors' => [ |
| 6470 | '{{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;', |
| 6471 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-row' => 'margin-left: -{{LEFT}}{{UNIT}}; margin-right: -{{RIGHT}}{{UNIT}}', |
| 6472 | '{{WRAPPER}} .tpg-el-main-wrapper .rt-row .rt-row' => 'margin-bottom: -{{RIGHT}}{{UNIT}}', |
| 6473 | '{{WRAPPER}} .rt-tpg-container .grid_hover-layout8 .display-grid-wrapper' => 'grid-gap: {{TOP}}{{UNIT}};margin-bottom: {{TOP}}{{UNIT}}', |
| 6474 | ], |
| 6475 | 'condition' => [ |
| 6476 | $prefix . '_layout!' => [ |
| 6477 | 'grid-layout2', |
| 6478 | 'grid-layout5', |
| 6479 | 'grid-layout5-2', |
| 6480 | 'grid-layout6', |
| 6481 | 'grid-layout6-2', |
| 6482 | 'list-layout4', |
| 6483 | ], |
| 6484 | ], |
| 6485 | ] |
| 6486 | ); |
| 6487 | } |
| 6488 | |
| 6489 | |
| 6490 | if ( in_array( $prefix, [ 'grid', 'list', 'slider' ] ) ) { |
| 6491 | if ( 'slider' == $prefix ) { |
| 6492 | $box_padding = [ |
| 6493 | $prefix . '_layout' => [ |
| 6494 | 'slider-layout1', |
| 6495 | 'slider-layout2', |
| 6496 | 'slider-layout3', |
| 6497 | ], |
| 6498 | ]; |
| 6499 | } else { |
| 6500 | $box_padding = [ |
| 6501 | $prefix . '_layout!' => [ |
| 6502 | 'grid-layout5', |
| 6503 | 'grid-layout5-2', |
| 6504 | 'grid-layout6', |
| 6505 | 'grid-layout6-2', |
| 6506 | 'grid-layout7', |
| 6507 | 'list-layout1', |
| 6508 | 'list-layout2', |
| 6509 | 'list-layout2-2', |
| 6510 | 'list-layout3', |
| 6511 | 'list-layout3-2', |
| 6512 | 'list-layout4', |
| 6513 | 'list-layout5', |
| 6514 | 'slider-layout1', |
| 6515 | 'slider-layout2', |
| 6516 | 'slider-layout3', |
| 6517 | ], |
| 6518 | ]; |
| 6519 | } |
| 6520 | $ref->add_responsive_control( |
| 6521 | 'content_box_padding', |
| 6522 | [ |
| 6523 | 'label' => esc_html__( 'Content Padding', 'the-post-grid' ), |
| 6524 | 'type' => Controls_Manager::DIMENSIONS, |
| 6525 | 'size_units' => [ 'px' ], |
| 6526 | 'allowed_dimensions' => 'all', |
| 6527 | 'selectors' => [ |
| 6528 | 'body {{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6529 | 'body {{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper-flex .post-right-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6530 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-holder .rt-el-content-wrapper .tpg-el-image-wrap' => 'margin-left: -{{LEFT}}{{UNIT}}; margin-right: -{{RIGHT}}{{UNIT}};', |
| 6531 | ], |
| 6532 | 'condition' => $box_padding, |
| 6533 | ] |
| 6534 | ); |
| 6535 | |
| 6536 | |
| 6537 | $ref->add_responsive_control( |
| 6538 | 'content_box_padding_offset', |
| 6539 | [ |
| 6540 | 'label' => esc_html__( 'Content Padding', 'the-post-grid' ), |
| 6541 | 'type' => Controls_Manager::DIMENSIONS, |
| 6542 | 'size_units' => [ 'px' ], |
| 6543 | 'allowed_dimensions' => 'all', |
| 6544 | 'selectors' => [ |
| 6545 | 'body {{WRAPPER}} .tpg-el-main-wrapper .offset-left .tpg-post-holder .offset-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6546 | '{{WRAPPER}} .rt-tpg-container .list-layout4 .post-right-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6547 | ], |
| 6548 | 'condition' => [ |
| 6549 | $prefix . '_layout' => [ |
| 6550 | 'grid-layout5', |
| 6551 | 'grid-layout5-2', |
| 6552 | 'list-layout4', |
| 6553 | ], |
| 6554 | ], |
| 6555 | ] |
| 6556 | ); |
| 6557 | } |
| 6558 | |
| 6559 | $ref->add_responsive_control( |
| 6560 | 'content_box_padding_2', |
| 6561 | [ |
| 6562 | 'label' => esc_html__( 'Content Padding', 'the-post-grid' ), |
| 6563 | 'type' => Controls_Manager::DIMENSIONS, |
| 6564 | 'size_units' => [ 'px' ], |
| 6565 | 'allowed_dimensions' => 'all', |
| 6566 | 'selectors' => [ |
| 6567 | 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 6568 | ], |
| 6569 | 'condition' => [ |
| 6570 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 6571 | ], |
| 6572 | ] |
| 6573 | ); |
| 6574 | |
| 6575 | $ref->add_responsive_control( |
| 6576 | 'box_radius', |
| 6577 | [ |
| 6578 | 'label' => esc_html__( 'Card Border Radius', 'the-post-grid' ), |
| 6579 | 'type' => Controls_Manager::DIMENSIONS, |
| 6580 | 'size_units' => [ 'px', '%' ], |
| 6581 | 'selectors' => [ |
| 6582 | 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};overflow:hidden;', |
| 6583 | 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};overflow:hidden;', |
| 6584 | ], |
| 6585 | 'condition' => [ |
| 6586 | $prefix . '_layout!' => [ |
| 6587 | 'list-layout2', |
| 6588 | 'list-layout2-2', |
| 6589 | 'list-layout3', |
| 6590 | 'list-layout3-2', |
| 6591 | 'list-layout4', |
| 6592 | 'list-layout4-2', |
| 6593 | 'list-layout5', |
| 6594 | 'list-layout5-2', |
| 6595 | 'slider-layout11', |
| 6596 | 'slider-layout12', |
| 6597 | 'slider-layout13', |
| 6598 | ], |
| 6599 | ], |
| 6600 | ] |
| 6601 | ); |
| 6602 | |
| 6603 | if ( in_array( $prefix, [ 'grid', 'list' ] ) ) { |
| 6604 | $ref->add_control( |
| 6605 | 'is_box_border', |
| 6606 | [ |
| 6607 | 'label' => esc_html__( 'Enable Border & Box Shadow', 'the-post-grid' ), |
| 6608 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 6609 | 'default' => 'enable', |
| 6610 | 'options' => [ |
| 6611 | 'enable' => esc_html__( 'Enable', 'the-post-grid' ), |
| 6612 | 'disable' => esc_html__( 'Disable', 'the-post-grid' ), |
| 6613 | ], |
| 6614 | 'prefix_class' => 'tpg-el-box-border-', |
| 6615 | 'condition' => [ |
| 6616 | $prefix . '_layout!' => [ |
| 6617 | 'slider-layout11', |
| 6618 | 'slider-layout12', |
| 6619 | 'slider-layout13', |
| 6620 | ], |
| 6621 | ], |
| 6622 | ] |
| 6623 | ); |
| 6624 | } |
| 6625 | |
| 6626 | if ( 'grid_hover' !== $prefix ) { |
| 6627 | //TODO: Start Tab |
| 6628 | $ref->start_controls_tabs( |
| 6629 | 'box_style_tabs' |
| 6630 | ); |
| 6631 | |
| 6632 | //TODO: Normal Tab |
| 6633 | $ref->start_controls_tab( |
| 6634 | 'box_style_normal_tab', |
| 6635 | [ |
| 6636 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 6637 | ] |
| 6638 | ); |
| 6639 | |
| 6640 | $ref->add_group_control( |
| 6641 | \Elementor\Group_Control_Background::get_type(), |
| 6642 | [ |
| 6643 | 'name' => 'box_background', |
| 6644 | 'label' => esc_html__( 'Background', 'the-post-grid' ), |
| 6645 | 'fields_options' => [ |
| 6646 | 'background' => [ |
| 6647 | 'label' => esc_html__( 'Card Background', 'the-post-grid' ), |
| 6648 | ], |
| 6649 | ], |
| 6650 | 'types' => [ 'classic', 'gradient' ], |
| 6651 | 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder', |
| 6652 | 'condition' => [ |
| 6653 | $prefix . '_layout!' => [ 'slider-layout13' ], |
| 6654 | ], |
| 6655 | ] |
| 6656 | ); |
| 6657 | |
| 6658 | $ref->add_group_control( |
| 6659 | \Elementor\Group_Control_Background::get_type(), |
| 6660 | [ |
| 6661 | 'name' => 'box_background2', |
| 6662 | 'label' => esc_html__( 'Background', 'the-post-grid' ), |
| 6663 | 'fields_options' => [ |
| 6664 | 'background' => [ |
| 6665 | 'label' => esc_html__( 'Card Background', 'the-post-grid' ), |
| 6666 | ], |
| 6667 | ], |
| 6668 | 'types' => [ 'classic', 'gradient' ], |
| 6669 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content', |
| 6670 | 'condition' => [ |
| 6671 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 6672 | ], |
| 6673 | ] |
| 6674 | ); |
| 6675 | |
| 6676 | if ( in_array( $prefix, [ 'grid', 'list' ] ) ) { |
| 6677 | $ref->add_control( |
| 6678 | 'box_border', |
| 6679 | [ |
| 6680 | 'label' => esc_html__( 'Border Color', 'the-post-grid' ), |
| 6681 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6682 | 'selectors' => [ |
| 6683 | 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border: 1px solid {{VALUE}}', |
| 6684 | ], |
| 6685 | 'condition' => [ |
| 6686 | 'is_box_border' => 'enable', |
| 6687 | $prefix . '_layout!' => [ |
| 6688 | 'slider-layout11', |
| 6689 | 'slider-layout12', |
| 6690 | 'slider-layout13', |
| 6691 | ], |
| 6692 | ], |
| 6693 | ] |
| 6694 | ); |
| 6695 | |
| 6696 | |
| 6697 | $ref->add_group_control( |
| 6698 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 6699 | [ |
| 6700 | 'name' => 'box_box_shadow', |
| 6701 | 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ), |
| 6702 | 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder', |
| 6703 | 'condition' => [ |
| 6704 | 'is_box_border' => 'enable', |
| 6705 | $prefix . '_layout!' => [ |
| 6706 | 'slider-layout11', |
| 6707 | 'slider-layout12', |
| 6708 | 'slider-layout13', |
| 6709 | ], |
| 6710 | ], |
| 6711 | ] |
| 6712 | ); |
| 6713 | } |
| 6714 | |
| 6715 | $ref->add_group_control( |
| 6716 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 6717 | [ |
| 6718 | 'name' => 'box_box_shadow2', |
| 6719 | 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ), |
| 6720 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content', |
| 6721 | 'condition' => [ |
| 6722 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 6723 | ], |
| 6724 | ] |
| 6725 | ); |
| 6726 | |
| 6727 | |
| 6728 | $ref->end_controls_tab(); |
| 6729 | |
| 6730 | |
| 6731 | //TODO: Hover Tab |
| 6732 | $ref->start_controls_tab( |
| 6733 | 'box_style_hover_tab', |
| 6734 | [ |
| 6735 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 6736 | ] |
| 6737 | ); |
| 6738 | |
| 6739 | $ref->add_group_control( |
| 6740 | \Elementor\Group_Control_Background::get_type(), |
| 6741 | [ |
| 6742 | 'name' => 'box_background_hover', |
| 6743 | 'label' => esc_html__( 'Background - Hover', 'the-post-grid' ), |
| 6744 | 'fields_options' => [ |
| 6745 | 'background' => [ |
| 6746 | 'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ), |
| 6747 | ], |
| 6748 | ], |
| 6749 | 'types' => [ 'classic', 'gradient' ], |
| 6750 | 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover', |
| 6751 | 'condition' => [ |
| 6752 | $prefix . '_layout!' => [ 'slider-layout13' ], |
| 6753 | ], |
| 6754 | ] |
| 6755 | ); |
| 6756 | |
| 6757 | $ref->add_group_control( |
| 6758 | \Elementor\Group_Control_Background::get_type(), |
| 6759 | [ |
| 6760 | 'name' => 'box_background_hover2', |
| 6761 | 'label' => esc_html__( 'Background - Hover', 'the-post-grid' ), |
| 6762 | 'fields_options' => [ |
| 6763 | 'background' => [ |
| 6764 | 'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ), |
| 6765 | ], |
| 6766 | ], |
| 6767 | 'types' => [ 'classic', 'gradient' ], |
| 6768 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content', |
| 6769 | 'condition' => [ |
| 6770 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 6771 | ], |
| 6772 | ] |
| 6773 | ); |
| 6774 | |
| 6775 | if ( in_array( $prefix, [ 'grid', 'list' ] ) ) { |
| 6776 | $ref->add_control( |
| 6777 | 'box_border_hover', |
| 6778 | [ |
| 6779 | 'label' => esc_html__( 'Border Color - Hover', 'the-post-grid' ), |
| 6780 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 6781 | 'selectors' => [ |
| 6782 | 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover' => 'border: 1px solid {{VALUE}}', |
| 6783 | ], |
| 6784 | 'condition' => [ |
| 6785 | 'is_box_border' => 'enable', |
| 6786 | $prefix . '_layout!' => [ |
| 6787 | 'slider-layout11', |
| 6788 | 'slider-layout12', |
| 6789 | 'slider-layout13', |
| 6790 | ], |
| 6791 | ], |
| 6792 | ] |
| 6793 | ); |
| 6794 | |
| 6795 | $ref->add_group_control( |
| 6796 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 6797 | [ |
| 6798 | 'name' => 'box_box_shadow_hover', |
| 6799 | 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ), |
| 6800 | 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover', |
| 6801 | 'condition' => [ |
| 6802 | 'is_box_border' => 'enable', |
| 6803 | $prefix . '_layout!' => [ |
| 6804 | 'slider-layout11', |
| 6805 | 'slider-layout12', |
| 6806 | 'slider-layout13', |
| 6807 | ], |
| 6808 | ], |
| 6809 | ] |
| 6810 | ); |
| 6811 | } |
| 6812 | |
| 6813 | |
| 6814 | $ref->add_group_control( |
| 6815 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 6816 | [ |
| 6817 | 'name' => 'box_box_shadow_hover2', |
| 6818 | 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ), |
| 6819 | 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content', |
| 6820 | 'condition' => [ |
| 6821 | $prefix . '_layout' => [ 'slider-layout13' ], |
| 6822 | ], |
| 6823 | ] |
| 6824 | ); |
| 6825 | |
| 6826 | |
| 6827 | $ref->end_controls_tab(); |
| 6828 | |
| 6829 | $ref->end_controls_tabs(); |
| 6830 | //TODO: End Tab |
| 6831 | |
| 6832 | } |
| 6833 | |
| 6834 | $ref->end_controls_section(); |
| 6835 | } |
| 6836 | |
| 6837 | |
| 6838 | /** |
| 6839 | * Slider Settings |
| 6840 | * |
| 6841 | * @param $ref |
| 6842 | */ |
| 6843 | |
| 6844 | public static function slider_settings( $ref, $layout_type = '' ) { |
| 6845 | $slider_condition = ''; |
| 6846 | if ( 'single' === $layout_type ) { |
| 6847 | $slider_condition = [ |
| 6848 | 'enable_related_slider!' => '', |
| 6849 | ]; |
| 6850 | } |
| 6851 | $prefix = $ref->prefix; |
| 6852 | $ref->start_controls_section( |
| 6853 | 'slider_settings', |
| 6854 | [ |
| 6855 | 'label' => esc_html__( 'Slider', 'the-post-grid' ), |
| 6856 | 'tab' => Controls_Manager::TAB_SETTINGS, |
| 6857 | 'condition' => $slider_condition, |
| 6858 | ] |
| 6859 | ); |
| 6860 | |
| 6861 | $ref->add_responsive_control( |
| 6862 | 'slider_gap', |
| 6863 | [ |
| 6864 | 'label' => esc_html__( 'Slider Gap', 'the-post-grid' ), |
| 6865 | 'type' => Controls_Manager::SLIDER, |
| 6866 | 'size_units' => [ 'px' ], |
| 6867 | 'range' => [ |
| 6868 | 'px' => [ |
| 6869 | 'min' => 0, |
| 6870 | 'max' => 100, |
| 6871 | 'step' => 1, |
| 6872 | ], |
| 6873 | ], |
| 6874 | 'selectors' => [ |
| 6875 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-slider-item' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};', |
| 6876 | 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-swiper-holder' => 'margin-left: calc(-{{SIZE}}{{UNIT}} - 5px);margin-right: -{{SIZE}}{{UNIT}};', |
| 6877 | '{{WRAPPER}} .rt-tpg-container .slider-column.swiper-slide .rt-slider-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', |
| 6878 | ], |
| 6879 | 'condition' => [ |
| 6880 | $prefix . '_layout!' => [ 'slider-layout10', |
| 6881 | 'slider-layout11', |
| 6882 | 'slider-layout12', |
| 6883 | 'slider-layout13' |
| 6884 | ], |
| 6885 | ], |
| 6886 | ] |
| 6887 | ); |
| 6888 | |
| 6889 | |
| 6890 | $ref->add_control( |
| 6891 | 'arrows', |
| 6892 | [ |
| 6893 | 'label' => esc_html__( 'Arrow Visibility', 'the-post-grid' ), |
| 6894 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 6895 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 6896 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 6897 | 'return_value' => 'yes', |
| 6898 | 'default' => 'yes', |
| 6899 | 'condition' => [ |
| 6900 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 6901 | ], |
| 6902 | ] |
| 6903 | ); |
| 6904 | |
| 6905 | |
| 6906 | $ref->add_control( |
| 6907 | 'arrow_position', |
| 6908 | [ |
| 6909 | 'label' => esc_html__( 'Arrow Position', 'the-post-grid' ), |
| 6910 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 6911 | 'default' => 'default', |
| 6912 | 'options' => [ |
| 6913 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 6914 | 'top-right' => esc_html__( 'Top Right', 'the-post-grid' ), |
| 6915 | 'top-left' => esc_html__( 'Top Left', 'the-post-grid' ), |
| 6916 | 'show-hover' => esc_html__( 'Center (Show on hover)', 'the-post-grid' ), |
| 6917 | ], |
| 6918 | 'condition' => [ |
| 6919 | 'arrows' => 'yes', |
| 6920 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 6921 | ], |
| 6922 | 'prefix_class' => 'slider-arrow-position-', |
| 6923 | ] |
| 6924 | ); |
| 6925 | |
| 6926 | $ref->add_control( |
| 6927 | 'dots', |
| 6928 | [ |
| 6929 | 'label' => esc_html__( 'Dots Visibility', 'the-post-grid' ), |
| 6930 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 6931 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 6932 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 6933 | 'return_value' => 'yes', |
| 6934 | 'default' => 'yes', |
| 6935 | 'prefix_class' => 'slider-dot-enable-', |
| 6936 | 'render_type' => 'template', |
| 6937 | 'condition' => [ |
| 6938 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 6939 | ], |
| 6940 | ] |
| 6941 | ); |
| 6942 | |
| 6943 | $ref->add_control( |
| 6944 | 'dynamic_dots', |
| 6945 | [ |
| 6946 | 'label' => esc_html__( 'Enable Dynamic Dots', 'the-post-grid' ), |
| 6947 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 6948 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 6949 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 6950 | 'return_value' => 'yes', |
| 6951 | 'default' => 'no', |
| 6952 | 'render_type' => 'template', |
| 6953 | 'condition' => [ |
| 6954 | 'dots' => 'yes', |
| 6955 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 6956 | ], |
| 6957 | ] |
| 6958 | ); |
| 6959 | |
| 6960 | $ref->add_control( |
| 6961 | 'dots_style', |
| 6962 | [ |
| 6963 | 'label' => esc_html__( 'Dots Style', 'the-post-grid' ), |
| 6964 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 6965 | 'default' => 'default', |
| 6966 | 'options' => [ |
| 6967 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 6968 | 'background' => esc_html__( 'With Background', 'the-post-grid' ), |
| 6969 | ], |
| 6970 | 'condition' => [ |
| 6971 | 'dots' => 'yes', |
| 6972 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 6973 | ], |
| 6974 | 'prefix_class' => 'slider-dots-style-', |
| 6975 | ] |
| 6976 | ); |
| 6977 | |
| 6978 | $ref->add_control( |
| 6979 | 'infinite', |
| 6980 | [ |
| 6981 | 'label' => esc_html__( 'Infinite', 'the-post-grid' ), |
| 6982 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 6983 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 6984 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 6985 | 'return_value' => 'yes', |
| 6986 | 'default' => 'yes', |
| 6987 | ] |
| 6988 | ); |
| 6989 | |
| 6990 | $ref->add_control( |
| 6991 | 'autoplay', |
| 6992 | [ |
| 6993 | 'label' => esc_html__( 'Autoplay', 'the-post-grid' ), |
| 6994 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 6995 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 6996 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 6997 | 'return_value' => 'yes', |
| 6998 | 'default' => false, |
| 6999 | ] |
| 7000 | ); |
| 7001 | |
| 7002 | $ref->add_control( |
| 7003 | 'autoplaySpeed', |
| 7004 | [ |
| 7005 | 'label' => esc_html__( 'Autoplay Speed', 'the-post-grid' ), |
| 7006 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 7007 | 'min' => 1000, |
| 7008 | 'max' => 10000, |
| 7009 | 'step' => 500, |
| 7010 | 'default' => 3000, |
| 7011 | 'condition' => [ |
| 7012 | 'autoplay' => 'yes', |
| 7013 | ], |
| 7014 | ] |
| 7015 | ); |
| 7016 | |
| 7017 | $ref->add_control( |
| 7018 | 'stopOnHover', |
| 7019 | [ |
| 7020 | 'label' => esc_html__( 'Stop On Hover', 'the-post-grid' ), |
| 7021 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7022 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7023 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7024 | 'return_value' => 'yes', |
| 7025 | 'default' => 'yes', |
| 7026 | 'condition' => [ |
| 7027 | 'autoplay' => 'yes', |
| 7028 | ], |
| 7029 | ] |
| 7030 | ); |
| 7031 | |
| 7032 | $ref->add_control( |
| 7033 | 'grabCursor', |
| 7034 | [ |
| 7035 | 'label' => esc_html__( 'Allow Touch Move', 'the-post-grid' ), |
| 7036 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7037 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7038 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7039 | 'return_value' => 'yes', |
| 7040 | 'default' => 'yes', |
| 7041 | ] |
| 7042 | ); |
| 7043 | |
| 7044 | |
| 7045 | $ref->add_control( |
| 7046 | 'autoHeight', |
| 7047 | [ |
| 7048 | 'label' => esc_html__( 'Auto Height', 'the-post-grid' ), |
| 7049 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7050 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7051 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7052 | 'return_value' => 'yes', |
| 7053 | 'default' => false, |
| 7054 | 'condition' => [ |
| 7055 | 'enable_2_rows!' => 'yes', |
| 7056 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7057 | ], |
| 7058 | ] |
| 7059 | ); |
| 7060 | |
| 7061 | $ref->add_control( |
| 7062 | 'lazyLoad', |
| 7063 | [ |
| 7064 | 'label' => esc_html__( 'lazy Load', 'the-post-grid' ), |
| 7065 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7066 | 'label_on' => esc_html__( 'Yes', 'the-post-grid' ), |
| 7067 | 'label_off' => esc_html__( 'No', 'the-post-grid' ), |
| 7068 | 'return_value' => 'yes', |
| 7069 | 'default' => false, |
| 7070 | 'prefix_class' => 'is-lazy-load-', |
| 7071 | 'render_type' => 'template', |
| 7072 | ] |
| 7073 | ); |
| 7074 | |
| 7075 | $ref->add_control( |
| 7076 | 'speed', |
| 7077 | [ |
| 7078 | 'label' => esc_html__( 'Speed', 'the-post-grid' ), |
| 7079 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 7080 | 'min' => 100, |
| 7081 | 'max' => 3000, |
| 7082 | 'step' => 100, |
| 7083 | 'default' => 500, |
| 7084 | ] |
| 7085 | ); |
| 7086 | |
| 7087 | $ref->add_control( |
| 7088 | 'enable_2_rows', |
| 7089 | [ |
| 7090 | 'label' => esc_html__( 'Enable 2 Rows', 'the-post-grid' ), |
| 7091 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 7092 | 'label_on' => esc_html__( 'Show', 'the-post-grid' ), |
| 7093 | 'label_off' => esc_html__( 'Hide', 'the-post-grid' ), |
| 7094 | 'return_value' => 'yes', |
| 7095 | 'default' => false, |
| 7096 | 'prefix_class' => 'enable-two-rows-', |
| 7097 | 'render_type' => 'template', |
| 7098 | 'description' => esc_html__( 'If you use 2 rows then you have to put an even number for post limit', 'the-post-grid' ), |
| 7099 | 'condition' => [ |
| 7100 | $prefix . '_layout!' => [ 'slider-layout13', |
| 7101 | 'slider-layout11', |
| 7102 | 'slider-layout12', |
| 7103 | 'slider-layout10' |
| 7104 | ], |
| 7105 | ], |
| 7106 | ] |
| 7107 | ); |
| 7108 | |
| 7109 | $ref->add_control( |
| 7110 | 'carousel_overflow', |
| 7111 | [ |
| 7112 | 'label' => esc_html__( 'Slider Overflow', 'the-post-grid' ), |
| 7113 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 7114 | 'default' => 'hidden', |
| 7115 | 'options' => [ |
| 7116 | 'hidden' => esc_html__( 'Hidden', 'the-post-grid' ), |
| 7117 | 'none' => esc_html__( 'None', 'the-post-grid' ), |
| 7118 | ], |
| 7119 | 'render_type' => 'template', |
| 7120 | 'prefix_class' => 'is-carousel-overflow-', |
| 7121 | 'condition' => [ |
| 7122 | 'lazyLoad!' => 'yes', |
| 7123 | ], |
| 7124 | ] |
| 7125 | ); |
| 7126 | |
| 7127 | $ref->add_control( |
| 7128 | 'slider_direction', |
| 7129 | [ |
| 7130 | 'label' => esc_html__( 'Direction', 'the-post-grid' ), |
| 7131 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 7132 | 'default' => 'ltr', |
| 7133 | 'options' => [ |
| 7134 | 'ltr' => esc_html__( 'LTR', 'the-post-grid' ), |
| 7135 | 'rtl' => esc_html__( 'RTL', 'the-post-grid' ), |
| 7136 | ], |
| 7137 | 'prefix_class' => 'slider-direction-', |
| 7138 | 'render_type' => 'template', |
| 7139 | ] |
| 7140 | ); |
| 7141 | |
| 7142 | $ref->end_controls_section(); |
| 7143 | } |
| 7144 | |
| 7145 | /** |
| 7146 | * Slider Style |
| 7147 | * |
| 7148 | * @param $ref |
| 7149 | */ |
| 7150 | |
| 7151 | public static function slider_style( $ref, $layout_type = '' ) { |
| 7152 | $prefix = $ref->prefix; |
| 7153 | if ( 'single' === $layout_type ) { |
| 7154 | $slider_condition = [ |
| 7155 | 'enable_related_slider!' => '', |
| 7156 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7157 | ]; |
| 7158 | } else { |
| 7159 | $slider_condition = [ |
| 7160 | $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ], |
| 7161 | ]; |
| 7162 | } |
| 7163 | |
| 7164 | $ref->start_controls_section( |
| 7165 | 'slider_style', |
| 7166 | [ |
| 7167 | 'label' => esc_html__( 'Slider', 'the-post-grid' ), |
| 7168 | 'tab' => Controls_Manager::TAB_STYLE, |
| 7169 | 'condition' => $slider_condition, |
| 7170 | ] |
| 7171 | ); |
| 7172 | |
| 7173 | $ref->add_control( |
| 7174 | 'arrow_style_heading', |
| 7175 | [ |
| 7176 | 'label' => esc_html__( 'Arrow Style', 'the-post-grid' ), |
| 7177 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 7178 | 'separator' => 'before', |
| 7179 | 'classes' => 'tpg-control-type-heading', |
| 7180 | 'condition' => [ |
| 7181 | 'arrows' => 'yes', |
| 7182 | ], |
| 7183 | ] |
| 7184 | ); |
| 7185 | |
| 7186 | $ref->add_responsive_control( |
| 7187 | 'arrow_font_size', |
| 7188 | [ |
| 7189 | 'label' => esc_html__( 'Arrow Font Size', 'the-post-grid' ), |
| 7190 | 'type' => Controls_Manager::SLIDER, |
| 7191 | 'size_units' => [ 'px' ], |
| 7192 | 'range' => [ |
| 7193 | 'px' => [ |
| 7194 | 'min' => 0, |
| 7195 | 'max' => 100, |
| 7196 | 'step' => 1, |
| 7197 | ], |
| 7198 | ], |
| 7199 | 'selectors' => [ |
| 7200 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'font-size: {{SIZE}}{{UNIT}};', |
| 7201 | ], |
| 7202 | 'condition' => [ |
| 7203 | 'arrows' => 'yes', |
| 7204 | ], |
| 7205 | ] |
| 7206 | ); |
| 7207 | |
| 7208 | $ref->add_responsive_control( |
| 7209 | 'arrow_border_radius', |
| 7210 | [ |
| 7211 | 'label' => esc_html__( 'Arrow Radius', 'the-post-grid' ), |
| 7212 | 'type' => Controls_Manager::SLIDER, |
| 7213 | 'size_units' => [ 'px', '%' ], |
| 7214 | 'range' => [ |
| 7215 | 'px' => [ |
| 7216 | 'min' => 0, |
| 7217 | 'max' => 100, |
| 7218 | 'step' => 1, |
| 7219 | ], |
| 7220 | '%' => [ |
| 7221 | 'min' => 0, |
| 7222 | 'max' => 100, |
| 7223 | 'step' => 1, |
| 7224 | ], |
| 7225 | ], |
| 7226 | 'selectors' => [ |
| 7227 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 7228 | ], |
| 7229 | 'condition' => [ |
| 7230 | 'arrows' => 'yes', |
| 7231 | ], |
| 7232 | ] |
| 7233 | ); |
| 7234 | |
| 7235 | $ref->add_responsive_control( |
| 7236 | 'arrow_width', |
| 7237 | [ |
| 7238 | 'label' => esc_html__( 'Arrow Width', 'the-post-grid' ), |
| 7239 | 'type' => Controls_Manager::SLIDER, |
| 7240 | 'size_units' => [ 'px' ], |
| 7241 | 'range' => [ |
| 7242 | 'px' => [ |
| 7243 | 'min' => 0, |
| 7244 | 'max' => 200, |
| 7245 | 'step' => 1, |
| 7246 | ], |
| 7247 | ], |
| 7248 | 'selectors' => [ |
| 7249 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'width: {{SIZE}}{{UNIT}};', |
| 7250 | ], |
| 7251 | 'condition' => [ |
| 7252 | 'arrows' => 'yes', |
| 7253 | ], |
| 7254 | ] |
| 7255 | ); |
| 7256 | |
| 7257 | $ref->add_responsive_control( |
| 7258 | 'arrow_height', |
| 7259 | [ |
| 7260 | 'label' => esc_html__( 'Arrow Height', 'the-post-grid' ), |
| 7261 | 'type' => Controls_Manager::SLIDER, |
| 7262 | 'size_units' => [ 'px' ], |
| 7263 | 'range' => [ |
| 7264 | 'px' => [ |
| 7265 | 'min' => 0, |
| 7266 | 'max' => 200, |
| 7267 | 'step' => 1, |
| 7268 | ], |
| 7269 | ], |
| 7270 | 'selectors' => [ |
| 7271 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'height: {{SIZE}}{{UNIT}}; line-height:{{SIZE}}{{UNIT}};', |
| 7272 | ], |
| 7273 | 'condition' => [ |
| 7274 | 'arrows' => 'yes', |
| 7275 | ], |
| 7276 | ] |
| 7277 | ); |
| 7278 | |
| 7279 | $ref->add_responsive_control( |
| 7280 | 'arrow_x_position', |
| 7281 | [ |
| 7282 | 'label' => esc_html__( 'Arrow X Position', 'the-post-grid' ), |
| 7283 | 'type' => Controls_Manager::SLIDER, |
| 7284 | 'size_units' => [ 'px' ], |
| 7285 | 'range' => [ |
| 7286 | 'px' => [ |
| 7287 | 'min' => - 300, |
| 7288 | 'max' => 300, |
| 7289 | 'step' => 1, |
| 7290 | ], |
| 7291 | ], |
| 7292 | 'selectors' => [ |
| 7293 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn.swiper-button-prev' => 'left: {{SIZE}}{{UNIT}};', |
| 7294 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn.swiper-button-next' => 'right: {{SIZE}}{{UNIT}};', |
| 7295 | '{{WRAPPER}}.slider-arrow-position-top-right .swiper-navigation' => 'right: {{SIZE}}{{UNIT}};', |
| 7296 | '{{WRAPPER}}.slider-arrow-position-top-left .swiper-navigation' => 'left: {{SIZE}}{{UNIT}};', |
| 7297 | ], |
| 7298 | 'condition' => [ |
| 7299 | 'arrows' => 'yes', |
| 7300 | ], |
| 7301 | ] |
| 7302 | ); |
| 7303 | |
| 7304 | $ref->add_responsive_control( |
| 7305 | 'arrow_y_position', |
| 7306 | [ |
| 7307 | 'label' => esc_html__( 'Arrow Y Position', 'the-post-grid' ), |
| 7308 | 'type' => Controls_Manager::SLIDER, |
| 7309 | 'size_units' => [ 'px', '%' ], |
| 7310 | 'range' => [ |
| 7311 | 'px' => [ |
| 7312 | 'min' => - 150, |
| 7313 | 'max' => 500, |
| 7314 | 'step' => 1, |
| 7315 | ], |
| 7316 | ], |
| 7317 | 'selectors' => [ |
| 7318 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'top: {{SIZE}}{{UNIT}};', |
| 7319 | '{{WRAPPER}}.slider-arrow-position-top-right .swiper-navigation, {{WRAPPER}}.slider-arrow-position-top-left .swiper-navigation' => 'top: {{SIZE}}{{UNIT}};', |
| 7320 | ], |
| 7321 | 'condition' => [ |
| 7322 | 'arrows' => 'yes', |
| 7323 | ], |
| 7324 | ] |
| 7325 | ); |
| 7326 | |
| 7327 | //TODO: Arrow Tabs Start |
| 7328 | $ref->start_controls_tabs( |
| 7329 | 'arrow_style_tabs', |
| 7330 | [ |
| 7331 | 'condition' => [ |
| 7332 | 'arrows' => 'yes', |
| 7333 | ], |
| 7334 | ] |
| 7335 | ); |
| 7336 | |
| 7337 | $ref->start_controls_tab( |
| 7338 | 'arrow_style_normal_tab', |
| 7339 | [ |
| 7340 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 7341 | ] |
| 7342 | ); |
| 7343 | |
| 7344 | $ref->add_control( |
| 7345 | 'arrow_color', |
| 7346 | [ |
| 7347 | 'type' => Controls_Manager::COLOR, |
| 7348 | 'label' => esc_html__( 'Arrow Icon Color', 'the-post-grid' ), |
| 7349 | 'selectors' => [ |
| 7350 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'color: {{VALUE}}', |
| 7351 | ], |
| 7352 | ] |
| 7353 | ); |
| 7354 | |
| 7355 | $ref->add_control( |
| 7356 | 'arrow_arrow_bg_color', |
| 7357 | [ |
| 7358 | 'type' => Controls_Manager::COLOR, |
| 7359 | 'label' => esc_html__( 'Arrow Background', 'the-post-grid' ), |
| 7360 | 'selectors' => [ |
| 7361 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'background-color: {{VALUE}}', |
| 7362 | ], |
| 7363 | ] |
| 7364 | ); |
| 7365 | |
| 7366 | $ref->add_group_control( |
| 7367 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 7368 | [ |
| 7369 | 'name' => 'arrow_box_shadow', |
| 7370 | 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ), |
| 7371 | 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn', |
| 7372 | ] |
| 7373 | ); |
| 7374 | |
| 7375 | $ref->add_group_control( |
| 7376 | \Elementor\Group_Control_Border::get_type(), |
| 7377 | [ |
| 7378 | 'name' => 'border', |
| 7379 | 'label' => esc_html__( 'Border', 'the-post-grid' ), |
| 7380 | 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn', |
| 7381 | ] |
| 7382 | ); |
| 7383 | |
| 7384 | $ref->end_controls_tab(); |
| 7385 | |
| 7386 | $ref->start_controls_tab( |
| 7387 | 'arrow_style_hover_tab', |
| 7388 | [ |
| 7389 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 7390 | ] |
| 7391 | ); |
| 7392 | |
| 7393 | $ref->add_control( |
| 7394 | 'arrow_hover_color', |
| 7395 | [ |
| 7396 | 'type' => Controls_Manager::COLOR, |
| 7397 | 'label' => esc_html__( 'Arrow Icon Color - Hover', 'the-post-grid' ), |
| 7398 | 'selectors' => [ |
| 7399 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'color: {{VALUE}}', |
| 7400 | ], |
| 7401 | ] |
| 7402 | ); |
| 7403 | |
| 7404 | $ref->add_control( |
| 7405 | 'arrow_bg_hover_color', |
| 7406 | [ |
| 7407 | 'type' => Controls_Manager::COLOR, |
| 7408 | 'label' => esc_html__( 'Arrow Background - Hover', 'the-post-grid' ), |
| 7409 | 'selectors' => [ |
| 7410 | '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'background-color: {{VALUE}}', |
| 7411 | ], |
| 7412 | ] |
| 7413 | ); |
| 7414 | |
| 7415 | $ref->add_group_control( |
| 7416 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 7417 | [ |
| 7418 | 'name' => 'arrow_box_shadow_hover', |
| 7419 | 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ), |
| 7420 | 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover', |
| 7421 | ] |
| 7422 | ); |
| 7423 | |
| 7424 | $ref->add_group_control( |
| 7425 | \Elementor\Group_Control_Border::get_type(), |
| 7426 | [ |
| 7427 | 'name' => 'border_hover', |
| 7428 | 'label' => esc_html__( 'Border - Hover', 'the-post-grid' ), |
| 7429 | 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover', |
| 7430 | ] |
| 7431 | ); |
| 7432 | |
| 7433 | $ref->end_controls_tab(); |
| 7434 | |
| 7435 | $ref->end_controls_tabs(); |
| 7436 | //TODO: Arrow Tabs End |
| 7437 | |
| 7438 | |
| 7439 | //TODO: Dots style Start |
| 7440 | |
| 7441 | $ref->add_control( |
| 7442 | 'dot_style_heading', |
| 7443 | [ |
| 7444 | 'label' => esc_html__( 'Dots Style', 'the-post-grid' ), |
| 7445 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 7446 | 'separator' => 'before', |
| 7447 | 'classes' => 'tpg-control-type-heading', |
| 7448 | 'condition' => [ |
| 7449 | 'dots' => 'yes', |
| 7450 | ], |
| 7451 | ] |
| 7452 | ); |
| 7453 | |
| 7454 | $ref->add_control( |
| 7455 | 'dots_text_align', |
| 7456 | [ |
| 7457 | 'label' => esc_html__( 'Dots Alignment', 'the-post-grid' ), |
| 7458 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 7459 | 'options' => [ |
| 7460 | 'left' => [ |
| 7461 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 7462 | 'icon' => 'eicon-text-align-left', |
| 7463 | ], |
| 7464 | 'center' => [ |
| 7465 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 7466 | 'icon' => 'eicon-text-align-center', |
| 7467 | ], |
| 7468 | 'right' => [ |
| 7469 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 7470 | 'icon' => 'eicon-text-align-right', |
| 7471 | ], |
| 7472 | ], |
| 7473 | 'toggle' => true, |
| 7474 | 'condition' => [ |
| 7475 | 'dots' => 'yes', |
| 7476 | ], |
| 7477 | 'prefix_class' => 'slider-dots-align-', |
| 7478 | ] |
| 7479 | ); |
| 7480 | |
| 7481 | |
| 7482 | $ref->add_responsive_control( |
| 7483 | 'dot_wrapper_radius', |
| 7484 | [ |
| 7485 | 'label' => esc_html__( 'Dots Wrapper Radius', 'the-post-grid' ), |
| 7486 | 'type' => Controls_Manager::SLIDER, |
| 7487 | 'size_units' => [ 'px', '%' ], |
| 7488 | 'range' => [ |
| 7489 | 'px' => [ |
| 7490 | 'min' => 0, |
| 7491 | 'max' => 1000, |
| 7492 | 'step' => 5, |
| 7493 | ], |
| 7494 | ], |
| 7495 | 'selectors' => [ |
| 7496 | '{{WRAPPER}}.slider-dots-style-background .tpg-el-main-wrapper .swiper-pagination' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 7497 | ], |
| 7498 | 'condition' => [ |
| 7499 | 'dots_style' => 'background', |
| 7500 | 'dots' => 'yes', |
| 7501 | ], |
| 7502 | ] |
| 7503 | ); |
| 7504 | |
| 7505 | $ref->add_responsive_control( |
| 7506 | 'dots_border_radius', |
| 7507 | [ |
| 7508 | 'label' => esc_html__( 'Dots Radius', 'the-post-grid' ), |
| 7509 | 'type' => Controls_Manager::SLIDER, |
| 7510 | 'size_units' => [ 'px', '%' ], |
| 7511 | 'range' => [ |
| 7512 | 'px' => [ |
| 7513 | 'min' => 0, |
| 7514 | 'max' => 100, |
| 7515 | 'step' => 1, |
| 7516 | ], |
| 7517 | '%' => [ |
| 7518 | 'min' => 0, |
| 7519 | 'max' => 100, |
| 7520 | 'step' => 1, |
| 7521 | ], |
| 7522 | ], |
| 7523 | 'selectors' => [ |
| 7524 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 7525 | ], |
| 7526 | 'condition' => [ |
| 7527 | 'dots' => 'yes', |
| 7528 | ], |
| 7529 | ] |
| 7530 | ); |
| 7531 | |
| 7532 | $ref->add_responsive_control( |
| 7533 | 'dots_width', |
| 7534 | [ |
| 7535 | 'label' => esc_html__( 'Dots Width', 'the-post-grid' ), |
| 7536 | 'type' => Controls_Manager::SLIDER, |
| 7537 | 'size_units' => [ 'px' ], |
| 7538 | 'range' => [ |
| 7539 | 'px' => [ |
| 7540 | 'min' => 0, |
| 7541 | 'max' => 200, |
| 7542 | 'step' => 1, |
| 7543 | ], |
| 7544 | ], |
| 7545 | 'selectors' => [ |
| 7546 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'width: {{SIZE}}{{UNIT}};', |
| 7547 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active' => 'width: calc({{SIZE}}{{UNIT}} + 15px);', |
| 7548 | ], |
| 7549 | 'condition' => [ |
| 7550 | 'dots' => 'yes', |
| 7551 | ], |
| 7552 | ] |
| 7553 | ); |
| 7554 | |
| 7555 | $ref->add_responsive_control( |
| 7556 | 'dots_height', |
| 7557 | [ |
| 7558 | 'label' => esc_html__( 'Dots Height', 'the-post-grid' ), |
| 7559 | 'type' => Controls_Manager::SLIDER, |
| 7560 | 'size_units' => [ 'px' ], |
| 7561 | 'range' => [ |
| 7562 | 'px' => [ |
| 7563 | 'min' => 0, |
| 7564 | 'max' => 200, |
| 7565 | 'step' => 1, |
| 7566 | ], |
| 7567 | ], |
| 7568 | 'selectors' => [ |
| 7569 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'height: {{SIZE}}{{UNIT}}', |
| 7570 | ], |
| 7571 | 'condition' => [ |
| 7572 | 'dots' => 'yes', |
| 7573 | ], |
| 7574 | ] |
| 7575 | ); |
| 7576 | |
| 7577 | |
| 7578 | $ref->add_responsive_control( |
| 7579 | 'dots_margin', |
| 7580 | [ |
| 7581 | 'label' => esc_html__( 'Dots Margin', 'the-post-grid' ), |
| 7582 | 'type' => Controls_Manager::SLIDER, |
| 7583 | 'size_units' => [ 'px' ], |
| 7584 | 'range' => [ |
| 7585 | 'px' => [ |
| 7586 | 'min' => 0, |
| 7587 | 'max' => 50, |
| 7588 | 'step' => 1, |
| 7589 | ], |
| 7590 | ], |
| 7591 | 'selectors' => [ |
| 7592 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'margin-left: {{SIZE}}{{UNIT}}; margin-right: {{SIZE}}{{UNIT}}', |
| 7593 | ], |
| 7594 | 'condition' => [ |
| 7595 | 'dots' => 'yes', |
| 7596 | ], |
| 7597 | ] |
| 7598 | ); |
| 7599 | |
| 7600 | $ref->add_responsive_control( |
| 7601 | 'dots_position', |
| 7602 | [ |
| 7603 | 'label' => esc_html__( 'Dots Y Position', 'the-post-grid' ), |
| 7604 | 'type' => Controls_Manager::SLIDER, |
| 7605 | 'size_units' => [ 'px' ], |
| 7606 | 'range' => [ |
| 7607 | 'px' => [ |
| 7608 | 'min' => - 150, |
| 7609 | 'max' => 150, |
| 7610 | 'step' => 1, |
| 7611 | ], |
| 7612 | ], |
| 7613 | 'selectors' => [ |
| 7614 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination' => 'bottom: {{SIZE}}{{UNIT}} !important ;', |
| 7615 | ], |
| 7616 | 'condition' => [ |
| 7617 | 'dots' => 'yes', |
| 7618 | ], |
| 7619 | ] |
| 7620 | ); |
| 7621 | |
| 7622 | |
| 7623 | //TODO: Dots Tab Start |
| 7624 | $ref->start_controls_tabs( |
| 7625 | 'dots_style_tabs', |
| 7626 | [ |
| 7627 | 'condition' => [ |
| 7628 | 'dots' => 'yes', |
| 7629 | ], |
| 7630 | ] |
| 7631 | ); |
| 7632 | |
| 7633 | $ref->start_controls_tab( |
| 7634 | 'dots_style_normal_tab', |
| 7635 | [ |
| 7636 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 7637 | ] |
| 7638 | ); |
| 7639 | |
| 7640 | $ref->add_control( |
| 7641 | 'dots_color', |
| 7642 | [ |
| 7643 | 'type' => Controls_Manager::COLOR, |
| 7644 | 'label' => esc_html__( 'Dots Color', 'the-post-grid' ), |
| 7645 | 'selectors' => [ |
| 7646 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'background-color: {{VALUE}}', |
| 7647 | ], |
| 7648 | 'condition' => [ |
| 7649 | 'dots' => 'yes', |
| 7650 | ], |
| 7651 | ] |
| 7652 | ); |
| 7653 | |
| 7654 | $ref->add_control( |
| 7655 | 'dots_border_color', |
| 7656 | [ |
| 7657 | 'type' => Controls_Manager::COLOR, |
| 7658 | 'label' => esc_html__( 'Active Dots Color', 'the-post-grid' ), |
| 7659 | 'selectors' => [ |
| 7660 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active' => 'background-color: {{VALUE}}', |
| 7661 | ], |
| 7662 | 'condition' => [ |
| 7663 | 'dots' => 'yes', |
| 7664 | ], |
| 7665 | ] |
| 7666 | ); |
| 7667 | |
| 7668 | $ref->add_control( |
| 7669 | 'dots_wrap_bg', |
| 7670 | [ |
| 7671 | 'type' => Controls_Manager::COLOR, |
| 7672 | 'label' => esc_html__( 'Dots Wrapper Background', 'the-post-grid' ), |
| 7673 | 'selectors' => [ |
| 7674 | '{{WRAPPER}}.slider-dots-style-background .tpg-el-main-wrapper .swiper-pagination' => 'background-color: {{VALUE}}', |
| 7675 | ], |
| 7676 | 'condition' => [ |
| 7677 | 'dots' => 'yes', |
| 7678 | 'dots_style' => 'background', |
| 7679 | ], |
| 7680 | ] |
| 7681 | ); |
| 7682 | |
| 7683 | |
| 7684 | $ref->end_controls_tab(); |
| 7685 | |
| 7686 | $ref->start_controls_tab( |
| 7687 | 'dots_style_hover_tab', |
| 7688 | [ |
| 7689 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 7690 | ] |
| 7691 | ); |
| 7692 | |
| 7693 | $ref->add_control( |
| 7694 | 'dots_color_hover', |
| 7695 | [ |
| 7696 | 'type' => Controls_Manager::COLOR, |
| 7697 | 'label' => esc_html__( 'Dots Color - Hover', 'the-post-grid' ), |
| 7698 | 'selectors' => [ |
| 7699 | '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet:hover' => 'background-color: {{VALUE}}', |
| 7700 | ], |
| 7701 | 'condition' => [ |
| 7702 | 'dots' => 'yes', |
| 7703 | ], |
| 7704 | ] |
| 7705 | ); |
| 7706 | |
| 7707 | $ref->end_controls_tab(); |
| 7708 | |
| 7709 | $ref->end_controls_tabs(); |
| 7710 | |
| 7711 | $ref->end_controls_section(); |
| 7712 | } |
| 7713 | |
| 7714 | |
| 7715 | /** |
| 7716 | * Link Style |
| 7717 | * |
| 7718 | * @param $ref |
| 7719 | */ |
| 7720 | |
| 7721 | public static function linkStyle( $ref ) { |
| 7722 | $ref->start_controls_section( |
| 7723 | 'linkStyle', |
| 7724 | [ |
| 7725 | 'label' => esc_html__( 'Popup Style', 'the-post-grid' ), |
| 7726 | 'tab' => Controls_Manager::TAB_STYLE, |
| 7727 | 'condition' => [ |
| 7728 | 'post_link_type' => [ 'popup', 'multi_popup' ], |
| 7729 | ], |
| 7730 | ] |
| 7731 | ); |
| 7732 | |
| 7733 | $ref->add_control( |
| 7734 | 'popup_head_bg', |
| 7735 | [ |
| 7736 | 'label' => esc_html__( 'Header Background', 'the-post-grid' ), |
| 7737 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 7738 | 'selectors' => [ |
| 7739 | 'body .rt-popup-wrap .rt-popup-navigation-wrap' => 'background-color: {{VALUE}}', |
| 7740 | ], |
| 7741 | ] |
| 7742 | ); |
| 7743 | |
| 7744 | $ref->add_control( |
| 7745 | 'popup_head_txt_color', |
| 7746 | [ |
| 7747 | 'label' => esc_html__( 'Header Text Color', 'the-post-grid' ), |
| 7748 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 7749 | 'selectors' => [ |
| 7750 | 'body #rt-popup-wrap .rt-popup-singlePage-counter' => 'color: {{VALUE}}', |
| 7751 | ], |
| 7752 | ] |
| 7753 | ); |
| 7754 | |
| 7755 | $ref->add_control( |
| 7756 | 'popup_title_color', |
| 7757 | [ |
| 7758 | 'label' => esc_html__( 'Popup Title Color', 'the-post-grid' ), |
| 7759 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 7760 | 'selectors' => [ |
| 7761 | 'body .md-content .rt-md-content-holder > .md-header .entry-title' => 'color: {{VALUE}}', |
| 7762 | 'body .rt-popup-content .rt-tpg-container h1.entry-title' => 'color: {{VALUE}}', |
| 7763 | ], |
| 7764 | |
| 7765 | ] |
| 7766 | ); |
| 7767 | |
| 7768 | |
| 7769 | $ref->add_control( |
| 7770 | 'popup_meta_color', |
| 7771 | [ |
| 7772 | 'label' => esc_html__( 'Popup Meta Color', 'the-post-grid' ), |
| 7773 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 7774 | 'selectors' => [ |
| 7775 | 'body .md-content .rt-md-content-holder > .md-header .post-meta-user *' => 'color: {{VALUE}}', |
| 7776 | 'body .rt-popup-content .rt-tpg-container .post-meta-user *' => 'color: {{VALUE}}', |
| 7777 | ], |
| 7778 | |
| 7779 | ] |
| 7780 | ); |
| 7781 | |
| 7782 | $ref->add_control( |
| 7783 | 'popup_content_color', |
| 7784 | [ |
| 7785 | 'label' => esc_html__( 'Popup Content Color', 'the-post-grid' ), |
| 7786 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 7787 | 'selectors' => [ |
| 7788 | 'body .md-content .rt-md-content *' => 'color: {{VALUE}}', |
| 7789 | 'body .rt-popup-content .rt-tpg-container .tpg-content *' => 'color: {{VALUE}}', |
| 7790 | ], |
| 7791 | |
| 7792 | ] |
| 7793 | ); |
| 7794 | |
| 7795 | $ref->add_control( |
| 7796 | 'popup_bg', |
| 7797 | [ |
| 7798 | 'label' => esc_html__( 'Popup Background', 'the-post-grid' ), |
| 7799 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 7800 | 'selectors' => [ |
| 7801 | 'body .md-content, body #rt-popup-wrap .rt-popup-content' => 'background-color: {{VALUE}}', |
| 7802 | ], |
| 7803 | |
| 7804 | ] |
| 7805 | ); |
| 7806 | |
| 7807 | |
| 7808 | $ref->end_controls_section(); |
| 7809 | } |
| 7810 | |
| 7811 | |
| 7812 | /** |
| 7813 | * Slider thumb Settings for layout- 11, 12 |
| 7814 | * |
| 7815 | * @param $ref |
| 7816 | */ |
| 7817 | |
| 7818 | public static function slider_thumb_style( $ref ) { |
| 7819 | $ref->start_controls_section( |
| 7820 | 'slider_thumb_style', |
| 7821 | [ |
| 7822 | 'label' => esc_html__( 'Slider', 'the-post-grid' ), |
| 7823 | 'tab' => Controls_Manager::TAB_STYLE, |
| 7824 | 'condition' => [ |
| 7825 | 'slider_layout' => [ 'slider-layout11', 'slider-layout12' ], |
| 7826 | ], |
| 7827 | ] |
| 7828 | ); |
| 7829 | |
| 7830 | //TODO: Crative slider style: |
| 7831 | $ref->add_control( |
| 7832 | 'scroll_bar_color', |
| 7833 | [ |
| 7834 | 'type' => Controls_Manager::COLOR, |
| 7835 | 'label' => esc_html__( 'Scroll Foreground Color', 'the-post-grid' ), |
| 7836 | 'selectors' => [ |
| 7837 | '{{WRAPPER}} .tpg-el-main-wrapper .swiper-thumb-pagination .swiper-pagination-progressbar-fill' => 'background-color: {{VALUE}}', |
| 7838 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper .post-thumbnail-wrap .p-thumbnail::before' => 'background-color: {{VALUE}}', |
| 7839 | ], |
| 7840 | ] |
| 7841 | ); |
| 7842 | |
| 7843 | |
| 7844 | $ref->add_control( |
| 7845 | 'scroll_bar_bg_color', |
| 7846 | [ |
| 7847 | 'type' => Controls_Manager::COLOR, |
| 7848 | 'label' => esc_html__( 'Scroll Background Color', 'the-post-grid' ), |
| 7849 | 'selectors' => [ |
| 7850 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-thumb-main-wrapper .swiper-pagination-progressbar' => 'background-color: {{VALUE}}', |
| 7851 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper::before' => 'background-color: {{VALUE}};opacity:1;', |
| 7852 | ], |
| 7853 | ] |
| 7854 | ); |
| 7855 | |
| 7856 | $ref->add_control( |
| 7857 | 'thumb_font_color', |
| 7858 | [ |
| 7859 | 'type' => Controls_Manager::COLOR, |
| 7860 | 'label' => esc_html__( 'Thumb Font Color', 'the-post-grid' ), |
| 7861 | 'selectors' => [ |
| 7862 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .p-content *' => 'color: {{VALUE}}', |
| 7863 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .swiper-thumb-wrapper .swiper-wrapper .p-content *' => 'color: {{VALUE}}', |
| 7864 | ], |
| 7865 | ] |
| 7866 | ); |
| 7867 | |
| 7868 | $ref->add_control( |
| 7869 | 'slider_thumb_bg', |
| 7870 | [ |
| 7871 | 'type' => Controls_Manager::COLOR, |
| 7872 | 'label' => esc_html__( 'Thumb Background', 'the-post-grid' ), |
| 7873 | 'selectors' => [ |
| 7874 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .p-thumbnail img' => 'background-color: {{VALUE}}', |
| 7875 | ], |
| 7876 | 'condition' => [ |
| 7877 | 'slider_layout' => [ 'slider-layout11' ], |
| 7878 | ], |
| 7879 | ] |
| 7880 | ); |
| 7881 | $ref->add_control( |
| 7882 | 'slider_thumb_bg_active', |
| 7883 | [ |
| 7884 | 'type' => Controls_Manager::COLOR, |
| 7885 | 'label' => esc_html__( 'Thumb Active/Hover Background', 'the-post-grid' ), |
| 7886 | 'selectors' => [ |
| 7887 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .swiper-slide:hover .p-thumbnail img' => 'background-color: {{VALUE}}', |
| 7888 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .swiper-slide-thumb-active .p-thumbnail img' => 'background-color: {{VALUE}}', |
| 7889 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .post-thumbnail-wrap::before' => 'background-color: {{VALUE}}', |
| 7890 | '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper .post-thumbnail-wrap .p-thumbnail' => 'background-color: {{VALUE}}', |
| 7891 | ], |
| 7892 | ] |
| 7893 | ); |
| 7894 | |
| 7895 | $ref->add_group_control( |
| 7896 | \Elementor\Group_Control_Background::get_type(), |
| 7897 | [ |
| 7898 | 'name' => 'thumb_wrapper_bg', |
| 7899 | 'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ), |
| 7900 | 'fields_options' => [ |
| 7901 | 'background' => [ |
| 7902 | 'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ), |
| 7903 | ], |
| 7904 | ], |
| 7905 | 'types' => [ 'classic', 'gradient' ], |
| 7906 | 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .slider-thumb-main-wrapper, {{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper', |
| 7907 | 'exclude' => [ 'image' ], |
| 7908 | ] |
| 7909 | ); |
| 7910 | |
| 7911 | $ref->end_controls_section(); |
| 7912 | } |
| 7913 | |
| 7914 | |
| 7915 | /** |
| 7916 | * Advanced Custom Field ACF Style |
| 7917 | * |
| 7918 | * @param $ref |
| 7919 | */ |
| 7920 | |
| 7921 | public static function tpg_acf_style( $ref ) { |
| 7922 | $cf = Fns::is_acf(); |
| 7923 | if ( ! $cf || ! rtTPG()->hasPro() ) { |
| 7924 | return; |
| 7925 | } |
| 7926 | |
| 7927 | $prefix = $ref->prefix; |
| 7928 | $ref->start_controls_section( |
| 7929 | 'tgp_acf_style', |
| 7930 | [ |
| 7931 | 'label' => esc_html__( 'Advanced Custom Field', 'the-post-grid' ), |
| 7932 | 'tab' => Controls_Manager::TAB_STYLE, |
| 7933 | 'condition' => [ |
| 7934 | 'show_acf' => 'show', |
| 7935 | $prefix . '_layout!' => [ 'grid-layout7' ], |
| 7936 | ], |
| 7937 | ] |
| 7938 | ); |
| 7939 | |
| 7940 | self::get_tpg_acf_style( $ref ); |
| 7941 | |
| 7942 | $ref->end_controls_section(); |
| 7943 | } |
| 7944 | |
| 7945 | public static function get_tpg_acf_style( $ref, $hover_control = true ) { |
| 7946 | $ref->add_group_control( |
| 7947 | \Elementor\Group_Control_Typography::get_type(), |
| 7948 | [ |
| 7949 | 'name' => 'acf_group_title_typography', |
| 7950 | 'label' => esc_html__( 'Group Title Typography', 'the-post-grid' ), |
| 7951 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-group-title', |
| 7952 | ] |
| 7953 | ); |
| 7954 | |
| 7955 | $ref->add_group_control( |
| 7956 | \Elementor\Group_Control_Typography::get_type(), |
| 7957 | [ |
| 7958 | 'name' => 'acf_typography', |
| 7959 | 'label' => esc_html__( 'ACF Fields Typography', 'the-post-grid' ), |
| 7960 | 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-fields', |
| 7961 | ] |
| 7962 | ); |
| 7963 | |
| 7964 | $ref->add_control( |
| 7965 | 'acf_label_style', |
| 7966 | [ |
| 7967 | 'label' => esc_html__( 'Label Style', 'the-post-grid' ), |
| 7968 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 7969 | 'default' => 'inline', |
| 7970 | 'options' => [ |
| 7971 | 'default' => esc_html__( 'Default', 'the-post-grid' ), |
| 7972 | 'inline' => esc_html__( 'Inline', 'the-post-grid' ), |
| 7973 | 'block' => esc_html__( 'Block', 'the-post-grid' ), |
| 7974 | ], |
| 7975 | 'condition' => [ |
| 7976 | 'cf_show_only_value' => 'yes', |
| 7977 | ], |
| 7978 | 'render_type' => 'template', |
| 7979 | 'prefix_class' => 'act-label-style-', |
| 7980 | ] |
| 7981 | ); |
| 7982 | |
| 7983 | $ref->add_responsive_control( |
| 7984 | 'acf_label_width', |
| 7985 | [ |
| 7986 | 'label' => esc_html__( 'Label Min Width', 'the-post-grid' ), |
| 7987 | 'type' => Controls_Manager::SLIDER, |
| 7988 | 'size_units' => [ 'px' ], |
| 7989 | 'range' => [ |
| 7990 | 'px' => [ |
| 7991 | 'min' => 0, |
| 7992 | 'max' => 1000, |
| 7993 | 'step' => 5, |
| 7994 | ], |
| 7995 | ], |
| 7996 | 'condition' => [ |
| 7997 | 'acf_label_style' => 'default', |
| 7998 | ], |
| 7999 | 'selectors' => [ |
| 8000 | '{{WRAPPER}} .tgp-cf-field-label' => 'min-width: {{SIZE}}{{UNIT}};', |
| 8001 | ], |
| 8002 | ] |
| 8003 | ); |
| 8004 | |
| 8005 | $ref->add_control( |
| 8006 | 'acf_alignment', |
| 8007 | [ |
| 8008 | 'label' => esc_html__( 'Text Align', 'the-post-grid' ), |
| 8009 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 8010 | 'options' => [ |
| 8011 | 'left' => [ |
| 8012 | 'title' => esc_html__( 'Left', 'the-post-grid' ), |
| 8013 | 'icon' => 'eicon-text-align-left', |
| 8014 | ], |
| 8015 | 'center' => [ |
| 8016 | 'title' => esc_html__( 'Center', 'the-post-grid' ), |
| 8017 | 'icon' => 'eicon-text-align-center', |
| 8018 | ], |
| 8019 | 'right' => [ |
| 8020 | 'title' => esc_html__( 'Right', 'the-post-grid' ), |
| 8021 | 'icon' => 'eicon-text-align-right', |
| 8022 | ], |
| 8023 | ], |
| 8024 | 'prefix_class' => 'tpg-acf-align-', |
| 8025 | 'toggle' => true, |
| 8026 | 'condition' => [ |
| 8027 | 'grid_layout!' => [ 'grid-layout7' ], |
| 8028 | ], |
| 8029 | |
| 8030 | ] |
| 8031 | ); |
| 8032 | |
| 8033 | |
| 8034 | if ( $hover_control ) { |
| 8035 | //Start Tab |
| 8036 | $ref->start_controls_tabs( |
| 8037 | 'acf_style_tabs' |
| 8038 | ); |
| 8039 | |
| 8040 | //Normal Tab |
| 8041 | $ref->start_controls_tab( |
| 8042 | 'acf_style_normal_tab', |
| 8043 | [ |
| 8044 | 'label' => esc_html__( 'Normal', 'the-post-grid' ), |
| 8045 | ] |
| 8046 | ); |
| 8047 | } |
| 8048 | $ref->add_control( |
| 8049 | 'acf_group_title_color', |
| 8050 | [ |
| 8051 | 'label' => esc_html__( 'Group Title Color', 'the-post-grid' ), |
| 8052 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8053 | 'selectors' => [ |
| 8054 | '{{WRAPPER}} .acf-custom-field-wrap .tpg-cf-group-title' => 'color: {{VALUE}}', |
| 8055 | ], |
| 8056 | 'condition' => [ |
| 8057 | 'cf_hide_group_title' => 'yes', |
| 8058 | ], |
| 8059 | ] |
| 8060 | ); |
| 8061 | |
| 8062 | $ref->add_control( |
| 8063 | 'acf_label_color', |
| 8064 | [ |
| 8065 | 'label' => esc_html__( 'Label Color', 'the-post-grid' ), |
| 8066 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8067 | 'selectors' => [ |
| 8068 | '{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-label' => 'color: {{VALUE}}', |
| 8069 | ], |
| 8070 | 'condition' => [ |
| 8071 | 'cf_show_only_value' => 'yes', |
| 8072 | ], |
| 8073 | ] |
| 8074 | ); |
| 8075 | |
| 8076 | $ref->add_control( |
| 8077 | 'acf_value_color', |
| 8078 | [ |
| 8079 | 'label' => esc_html__( 'Value Color', 'the-post-grid' ), |
| 8080 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8081 | 'selectors' => [ |
| 8082 | '{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-value' => 'color: {{VALUE}}', |
| 8083 | ], |
| 8084 | ] |
| 8085 | ); |
| 8086 | |
| 8087 | if ( $hover_control ) { |
| 8088 | $ref->end_controls_tab(); |
| 8089 | |
| 8090 | |
| 8091 | //Hover Tab |
| 8092 | $ref->start_controls_tab( |
| 8093 | 'acf_style_hover_tab', |
| 8094 | [ |
| 8095 | 'label' => esc_html__( 'Hover', 'the-post-grid' ), |
| 8096 | ] |
| 8097 | ); |
| 8098 | |
| 8099 | $ref->add_control( |
| 8100 | 'acf_group_title_color_hover', |
| 8101 | [ |
| 8102 | 'label' => esc_html__( 'Group Title Color - Hover', 'the-post-grid' ), |
| 8103 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8104 | 'selectors' => [ |
| 8105 | '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tpg-cf-group-title' => 'color: {{VALUE}}', |
| 8106 | ], |
| 8107 | 'condition' => [ |
| 8108 | 'cf_hide_group_title' => 'yes', |
| 8109 | ], |
| 8110 | ] |
| 8111 | ); |
| 8112 | |
| 8113 | $ref->add_control( |
| 8114 | 'acf_label_color_hover', |
| 8115 | [ |
| 8116 | 'label' => esc_html__( 'Label Color - Hover', 'the-post-grid' ), |
| 8117 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8118 | 'selectors' => [ |
| 8119 | '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-label' => 'color: {{VALUE}}', |
| 8120 | ], |
| 8121 | 'condition' => [ |
| 8122 | 'cf_show_only_value' => 'yes', |
| 8123 | ], |
| 8124 | ] |
| 8125 | ); |
| 8126 | |
| 8127 | $ref->add_control( |
| 8128 | 'acf_value_color_hover', |
| 8129 | [ |
| 8130 | 'label' => esc_html__( 'Value Color - Hover', 'the-post-grid' ), |
| 8131 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 8132 | 'selectors' => [ |
| 8133 | '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-value' => 'color: {{VALUE}}', |
| 8134 | ], |
| 8135 | ] |
| 8136 | ); |
| 8137 | |
| 8138 | $ref->end_controls_tab(); |
| 8139 | |
| 8140 | $ref->end_controls_tabs(); |
| 8141 | //End Tab |
| 8142 | } |
| 8143 | } |
| 8144 | } |
| 8145 |