-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
632 lines (551 loc) · 22.1 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
<?php
/**
* Create Hemma Apartments custom post types
*
* @since 1.0.0
*/
function hemma_apartments_cpt() {
$labels = array(
'name' => _x( 'Apartments', 'post type general name', 'hemma-cpt-apartments' ),
'singular_name' => _x( 'Apartment', 'post type singular name', 'hemma-cpt-apartments' ),
'menu_name' => _x( 'Apartments', 'admin menu', 'hemma-cpt-apartments' ),
'name_admin_bar' => _x( 'Apartment', 'add new on admin bar', 'hemma-cpt-apartments' ),
'add_new' => _x( 'Add New', 'Apartment', 'hemma-cpt-apartments' ),
'add_new_item' => __( 'Add New Apartment', 'hemma-cpt-apartments' ),
'new_item' => __( 'New Apartment', 'hemma-cpt-apartments' ),
'edit_item' => __( 'Edit Apartment', 'hemma-cpt-apartments' ),
'view_item' => __( 'View Apartment', 'hemma-cpt-apartments' ),
'all_items' => __( 'All Apartments', 'hemma-cpt-apartments' ),
'search_items' => __( 'Search Apartments', 'hemma-cpt-apartments' ),
'parent_item_colon' => __( 'Parent Apartments:', 'hemma-cpt-apartments' ),
'not_found' => __( 'No Apartments Found', 'hemma-cpt-apartments'),
'not_found_in_trash' => __( 'No Apartments found in Trash', 'hemma-cpt-apartments' )
);
$args = array(
'labels' => $labels,
'singular_label' => __( 'Apartment', 'hemma-cpt-apartments' ),
'public' => true,
'show_ui' => true,
'hierarchical' => false,
'has_archive' => false,
'menu_icon' => 'dashicons-grid-view',
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'revisions' ),
'taxonomies' => array( 'apartmentcategory', 'post_tag' )
);
register_post_type( 'apartment' , $args );
}
add_action( 'init', 'hemma_apartments_cpt' );
/**
* Create Hemma Apartments taxonomy
*
* @since 1.0.0
*/
function hemma_apartments_taxonomy() {
$labels = array(
'name' => _x( 'Apartment Categories', 'taxonomy general name', 'hemma-cpt-apartments' ),
'singular_name' => _x( 'Category', 'taxonomy singular name', 'hemma-cpt-apartments' ),
'search_items' => __( 'Search Categories', 'hemma-cpt-apartments' ),
'popular_items' => __( 'Popular Categories', 'hemma-cpt-apartments' ),
'all_items' => __( 'All Categories', 'hemma-cpt-apartments' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Category', 'hemma-cpt-apartments' ),
'update_item' => __( 'Update Category', 'hemma-cpt-apartments' ),
'add_new_item' => __( 'Add New Category', 'hemma-cpt-apartments' ),
'new_item_name' => __( 'New Category Name', 'hemma-cpt-apartments' ),
'separate_items_with_commas' => __( 'Separate categories with commas', 'hemma-cpt-apartments' ),
'add_or_remove_items' => __( 'Add or remove categories', 'hemma-cpt-apartments' ),
'choose_from_most_used' => __( 'Choose from the most used categories', 'hemma-cpt-apartments' )
);
register_taxonomy( 'apartmentcategory', 'apartment', array(
'label' => __( 'Apartment Category', 'hemma-cpt-apartments' ),
'labels' => $labels,
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'apartment-category' ),
));
}
add_action( 'init', 'hemma_apartments_taxonomy', 0 );
/**
* Adds custom apartment classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function hemma_apartment_body_classes( $classes ) {
// Adds a class of group-blog to blogs with more than 1 published author.
if ( is_multi_author() ) {
$classes[] = 'group-blog';
}
// Adds a class of hfeed to non-singular pages.
if ( ! is_singular() ) {
$classes[] = 'hfeed';
}
$header_position = get_theme_mod( 'header_position', 'header-position-1' );
// Add hero class
if ( is_singular( array( 'apartment' ) ) || is_page_template( 'template-apartment.php' ) ) {
$classes[] = 'is-hero';
if ( $header_position == 'header-position-2' ) {
$classes[] = 'is-header-static';
}
}
// Handle body classes based on Customizer options
$logo_center_class = 'is-logo-centered';
$logo_image_class = 'is-logo-image';
$hamburger_left_class = 'is-hamburger-left';
$frame_layout_class = 'is-block-frame';
$menu_desktop_class = 'is-menu-desktop';
$preloader_class = 'is-loader';
$gallery_class = 'gallery-first-big';
$lightbox_class = "is-lightbox-enabled";
$block_animation_class = 'is-block-animation';
$no_sidebar_class = 'has-no-sidebar';
$header_layout = get_theme_mod( 'header_layout', 'header-1' );
$logo_img_1x_regul = get_theme_mod( 'logo_image_1', '' );
$logo_img_2x_regul = get_theme_mod( 'logo_image_2', '' );
$site_layout = get_theme_mod( 'site_layout', '' );
$accent_color = get_theme_mod( 'accent_color', '' );
$preloader = get_theme_mod( 'preloader', false );
$gallery_first_post = get_theme_mod( 'gallery_first_post', false );
$enable_lightbox = get_theme_mod( 'enable_lightbox', false );
$enable_block_animation = get_theme_mod( 'enable_block_animation', false );
switch ( $header_layout ) {
case 'header-1' :
$classes[] = '';
break;
case 'header-2' :
$classes[] = join( ' ', array( $menu_desktop_class ) );
break;
case 'header-3' :
$classes[] = join( ' ', array( $hamburger_left_class, $logo_center_class ) );
break;
case 'header-4' :
$classes[] = join( ' ', array( $logo_center_class ) );
break;
}
if ( $logo_img_1x_regul !== '' || $logo_img_2x_regul !== '' ) {
$classes[] = $logo_image_class;
}
if ( $site_layout == 'layout-2' ) {
$classes[] = $frame_layout_class;
}
if ( $accent_color && $accent_color != 'is-default' ) {
$classes[] = 'accent-' . $accent_color;
}
if ( $preloader == true ) {
$classes[] = $preloader_class;
}
if ( $gallery_first_post == true ) {
$classes[] = $gallery_class;
}
if ( $enable_lightbox == true ) {
$classes[] = $lightbox_class;
}
if ( $enable_block_animation == true ) {
$classes[] = $block_animation_class;
}
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
$classes[] = $no_sidebar_class;
}
return $classes;
}
add_filter( 'body_class', 'hemma_apartment_body_classes' );
/**
* Adds custom apartment classes to the array of header classes.
*
* @param array $classes Classes for the header element.
* @return array
*/
function hemma_apartment_header_classes( $classes ) {
global $post;
$header_position = get_theme_mod( 'header_position', 'header-position-1' );
// Add hero class
if ( ( is_singular( array( 'apartment' ) ) || is_page_template( 'template-apartment.php' ) ) && ( $header_position != 'header-position-2' ) ) {
$classes[] = 'is-hero-on';
}
return $classes;
}
add_filter( 'post_class', 'hemma_apartment_header_classes' );
function hemma_customize_child_theme_setup() {
/**
* Add the Enable comments on apartment single posts control
*/
hemma_Kirki::add_field( 'hemma_theme', array(
'type' => 'switch',
'settings' => 'enable_apartment_comments',
'label' => esc_html__( 'Comments on apartment posts', 'hemma' ),
'description' => esc_html__( 'Enable comments on apartment single posts.', 'hemma' ),
'section' => 'post_settings',
'priority' => 10,
'default' => 'off',
'choices' => array(
'on' => esc_html__( 'On', 'hemma' ),
'off' => esc_html__( 'Off', 'hemma' ),
),
) );
/**
* Add the Apartment pages show at most control
*/
hemma_Kirki::add_field( 'hemma_theme', array(
'type' => 'number',
'settings' => 'apartment_posts_per_page',
'label' => esc_html__( 'Apartment posts per page.', 'hemma' ),
'description' => esc_html__( 'Set the value to -1 if to show all posts.', 'hemma' ),
'section' => 'post_settings',
'priority' => 10,
'default' => 5,
) );
}
add_action( 'after_setup_theme', 'hemma_customize_child_theme_setup' );
/**
* Add Subtitle Meta Box in Apartment pages
*/
add_action( 'cmb2_admin_init', 'opendept_register_apartment_subtitle_metabox' );
function opendept_register_apartment_subtitle_metabox() {
$prefix = 'opendept_apartment_subtitle_';
$cmb_subtitle = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Add Subtitle', 'hemma' ),
'object_types' => array( 'apartment' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => false,
) );
$cmb_subtitle->add_field( array(
'name' => esc_html__( 'Add Subtitle', 'hemma' ),
'desc' => esc_html__( 'Leave empty if you don\'t want to show a subtitle', 'hemma' ),
'id' => $prefix . 'subtitle',
'type' => 'text',
) );
}
/**
* Add Filter Posts Meta Box in Apartment pages
*/
add_action( 'cmb2_admin_init', 'opendept_register_filter_apartment_metabox' );
function opendept_register_filter_apartment_metabox() {
$prefix = 'opendept_filter_apartment_';
$cmb_filter = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Filter Apartments', 'hemma' ),
'object_types' => array( 'page' ),
'show_on' => array( 'key' => 'cpt-template', 'value' => array( 'template-apartment' ) ),
'context' => 'normal',
'priority' => 'high',
'show_names' => false,
) );
$cmb_filter->add_field( array(
'name' => esc_html__( 'Filter posts by Category', 'hemma' ),
'desc' => esc_html__( 'Select the apartment category you want to filter or leave "None". If you can\'t see any option in the list that\'s because you haven\'t any apartment category yet.', 'hemma' ),
'id' => $prefix . 'filter_category',
'type' => 'select',
'options_cb' => 'cmb2_get_term_options',
'get_terms_args' => array(
'taxonomy' => 'apartmentcategory',
'hide_empty' => true,
),
) );
}
/**
* Add Hero Setting Meta Box in Apartment posts and Apartment pages
*/
add_action( 'cmb2_admin_init', 'opendept_register_apartment_hero_settings_metabox' );
function opendept_register_apartment_hero_settings_metabox() {
$prefix = 'opendept_hero_apartment_';
$cmb_hero = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Hero Settings', 'hemma' ),
'object_types' => array( 'apartment' ),
'context' => 'side',
'priority' => 'core',
'show_names' => false,
) );
$cmb_hero->add_field( array(
'name' => esc_html__( 'Fade color', 'hemma' ),
'desc' => esc_html__( 'Fade background image with an overlay color', 'hemma' ),
'id' => $prefix . 'color',
'type' => 'rgba_colorpicker',
'default' => 'rgba(53,63,73,0)',
) );
$cmb_hero->add_field( array(
'name' => esc_html__( 'Titles alignment', 'hemma' ),
'desc' => esc_html__( 'Align the title and the subtitle to left or center', 'hemma' ),
'id' => $prefix . 'align',
'type' => 'radio',
'default' => 'is-centered',
'options' => array(
'is-left' => esc_html__( 'Align left', 'hemma' ),
'is-centered' => esc_html__( 'Align center', 'hemma' ),
),
) );
$cmb_hero->add_field( array(
'name' => esc_html__( 'Hero Height', 'hemma' ),
'desc' => esc_html__( 'The minimum height of the hero', 'hemma' ),
'id' => $prefix . 'height',
'type' => 'select',
'options' => array(
'is-contentheight' => esc_html__( 'Content Height', 'hemma' ),
'is-halfheight' => esc_html__( 'Half browser height', 'hemma' ),
'is-fullheight' => esc_html__( 'Full browser height', 'hemma' ),
),
'default' => 'is-fullheight'
) );
$cmb_hero->add_field( array(
'name' => esc_html__( 'Hero Background Color', 'hemma' ),
'desc' => esc_html__( 'The background color of the hero (useful if there is no image)', 'hemma' ),
'id' => $prefix . 'bg_color',
'type' => 'select',
'show_option_none' => true,
'options' => array(
'is-red' => esc_html__( 'Red', 'hemma' ),
'is-orange' => esc_html__( 'Orange', 'hemma' ),
'is-yellow' => esc_html__( 'Yellow', 'hemma' ),
'is-green' => esc_html__( 'Green', 'hemma' ),
'is-light-blue' => esc_html__( 'Light Blue', 'hemma' ),
'is-blue' => esc_html__( 'Blue', 'hemma' ),
'is-purple' => esc_html__( 'Purple', 'hemma' ),
'is-pink' => esc_html__( 'Pink', 'hemma' ),
'is-brown' => esc_html__( 'Brown', 'hemma' ),
'is-dark' => esc_html__( 'Dark', 'hemma' ),
),
) );
$cmb_hero->add_field( array(
'name' => esc_html__( 'Display mouse scroll icon', 'hemma' ),
'desc' => esc_html__( 'Tick this if you want to show a mouse scroll icon at the bottom of the section', 'hemma' ),
'id' => $prefix . 'mouse_icon',
'type' => 'checkbox',
) );
}
/**
* Add Edit Apartment Meta Box in Apartment posts
*/
add_action( 'cmb2_admin_init', 'opendept_register_apartment_metabox' );
function opendept_register_apartment_metabox() {
$prefix = 'opendept_apartment_';
$cmb_apartment = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Edit Apartment', 'hemma' ),
'object_types' => array( 'apartment' ),
'context' => 'normal',
'priority' => 'high',
) );
$cmb_apartment->add_field( array(
'name' => esc_html__( 'Guests per apartment', 'hemma' ),
'desc' => esc_html__( 'Leave empty if you don\'t want to show the guests information', 'hemma' ),
'id' => $prefix . 'guests',
'type' => 'text_small',
) );
$cmb_apartment->add_field( array(
'name' => esc_html__( 'Beds per apartment', 'hemma' ),
'desc' => esc_html__( 'Leave empty if you don\'t want to show the beds information', 'hemma' ),
'id' => $prefix . 'beds',
'type' => 'text_small',
) );
$cmb_apartment->add_field( array(
'name' => esc_html__( 'Apartment size', 'hemma' ),
'desc' => esc_html__( 'Leave empty if you don\'t want to show the apartment size', 'hemma' ),
'id' => $prefix . 'size',
'type' => 'text_small',
) );
}
/**
* Add Apartment Sidebar Meta Box in Apartment posts
*/
add_action( 'cmb2_admin_init', 'opendept_register_apartment_sidebar_metabox' );
function opendept_register_apartment_sidebar_metabox() {
$prefix = 'opendept_apartment_sidebar_';
$cmb_apartment_sidebar = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Sidebar Settings', 'hemma' ),
'object_types' => array( 'apartment' ),
'context' => 'normal',
'priority' => 'high',
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Enable apartment sidebar', 'hemma' ),
'desc' => esc_html__( 'Tick this to show the sidebar on this page', 'hemma' ),
'id' => $prefix . 'enable_sidebar',
'type' => 'checkbox',
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Show price box', 'hemma' ),
'desc' => esc_html__( 'That\'s the grey zone where you can set the apartment price and the call-to-action button', 'hemma' ),
'id' => $prefix . 'enable_box',
'type' => 'checkbox',
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Price box title', 'hemma' ),
'desc' => esc_html__( 'The first paragraph in the grey box (e.g. “Rates from”)', 'hemma' ),
'id' => $prefix . 'box_title',
'type' => 'text',
'default' => esc_html__( 'Rates from', 'hemma' ),
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Apartment Price', 'hemma' ),
'desc' => esc_html__( 'Price of the apartment', 'hemma' ),
'id' => $prefix . 'box_price',
'type' => 'text_small',
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Price details', 'hemma' ),
'desc' => esc_html__( 'The paragraph below the price (e.g. “per night”)', 'hemma' ),
'id' => $prefix . 'box_price_per',
'type' => 'text',
'default' => esc_html__( 'per night', 'hemma' ),
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Button text', 'hemma' ),
'desc' => esc_html__( 'Leave empty if you don\'t want to show the button', 'hemma' ),
'id' => $prefix . 'box_button_text',
'type' => 'text',
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Button link', 'hemma' ),
'desc' => esc_html__( 'The button link (e.g. http://www.website.com)', 'hemma' ),
'id' => $prefix . 'box_button_link',
'type' => 'text_url',
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Button color', 'hemma' ),
'id' => $prefix . 'box_button_color',
'type' => 'select',
'show_option_none' => true,
'options' => array(
'is-red' => esc_html__( 'Red', 'hemma' ),
'is-orange' => esc_html__( 'Orange', 'hemma' ),
'is-yellow' => esc_html__( 'Yellow', 'hemma' ),
'is-green' => esc_html__( 'Green', 'hemma' ),
'is-light-blue' => esc_html__( 'Light Blue', 'hemma' ),
'is-blue' => esc_html__( 'Blue', 'hemma' ),
'is-purple' => esc_html__( 'Purple', 'hemma' ),
'is-pink' => esc_html__( 'Pink', 'hemma' ),
'is-brown' => esc_html__( 'Brown', 'hemma' ),
'is-dark' => esc_html__( 'Dark', 'hemma' ),
'is-white' => esc_html__( 'White', 'hemma' ),
),
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Button link opens a new page?', 'hemma' ),
'desc' => esc_html__( 'Tick this if you want to open the link in a new page', 'hemma' ),
'id' => $prefix . 'box_button_target',
'type' => 'checkbox',
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Extra notes', 'hemma' ),
'desc' => esc_html__( 'Use this field to add extra notes to the grey box', 'hemma' ),
'id' => $prefix . 'box_notes',
'type' => 'textarea',
) );
$cmb_apartment_sidebar->add_field( array(
'name' => esc_html__( 'Other sidebar informations', 'hemma' ),
'id' => $prefix . 'content',
'type' => 'wysiwyg',
'options' => array(
'media_buttons' => false,
'teeny' => true,
'wpautop' => true,
),
) );
}
/**
* Add Post Summary Meta Box in Apartment posts
*/
add_action( 'cmb2_admin_init', 'opendept_register_summary_apartment_metabox' );
function opendept_register_summary_apartment_metabox() {
$prefix = 'opendept_summary_apartment_';
$cmb_summary = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Post Summary', 'hemma' ),
'object_types' => array( 'apartment' ),
'context' => 'normal',
'priority' => 'high',
) );
$cmb_summary->add_field( array(
'name' => esc_html__( 'Post Summary Content', 'hemma' ),
'show_names' => false,
'desc' => esc_html__( 'Type here the summary that you want to display on the parent page.', 'hemma' ),
'id' => $prefix . 'content',
'type' => 'wysiwyg',
'options' => array(
'media_buttons' => false,
'teeny' => true,
'wpautop' => true,
),
) );
}
/**
* Add Post Summary Settings Meta Box in Apartment pages
*/
add_action( 'cmb2_admin_init', 'opendept_register_listed_posts_apartment_metabox' );
function opendept_register_listed_posts_apartment_metabox() {
$prefix = 'opendept_listed_posts_apartment_';
$cmb_listed_posts_apartment = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Post Summary Settings', 'hemma' ),
'object_types' => array( 'page' ),
'show_on' => array( 'key' => 'cpt-template', 'value' => array( 'template-apartment' ) ),
'context' => 'normal',
'priority' => 'high',
) );
$cmb_listed_posts_apartment->add_field( array(
'name' => esc_html__( 'Show Subtitle', 'hemma' ),
'desc' => esc_html__( 'Tick this to display the subtitle in the post summary', 'hemma' ),
'id' => $prefix . 'enable_subtitle',
'type' => 'checkbox',
) );
$cmb_listed_posts_apartment->add_field( array(
'name' => esc_html__( 'Show Meta Informations', 'hemma' ),
'desc' => esc_html__( 'Tick this to display the meta informations (i.e. the icons with labels) in the post summary', 'hemma' ),
'id' => $prefix . 'enable_meta_info',
'type' => 'checkbox',
) );
$cmb_listed_posts_apartment->add_field( array(
'name' => esc_html__( 'Show Button', 'hemma' ),
'desc' => esc_html__( 'Tick this to display the button in the post summary', 'hemma' ),
'id' => $prefix . 'enable_button',
'type' => 'checkbox',
) );
$cmb_listed_posts_apartment->add_field( array(
'name' => esc_html__( 'Button text', 'hemma' ),
'id' => $prefix . 'button_text',
'type' => 'text',
'default' => esc_html__( 'Read More', 'hemma' ),
) );
$cmb_listed_posts_apartment->add_field( array(
'name' => esc_html__( 'Button color', 'hemma' ),
'id' => $prefix . 'button_color',
'type' => 'select',
'show_option_none' => true,
'options' => array(
'is-red' => esc_html__( 'Red', 'hemma' ),
'is-orange' => esc_html__( 'Orange', 'hemma' ),
'is-yellow' => esc_html__( 'Yellow', 'hemma' ),
'is-green' => esc_html__( 'Green', 'hemma' ),
'is-light-blue' => esc_html__( 'Light Blue', 'hemma' ),
'is-blue' => esc_html__( 'Blue', 'hemma' ),
'is-purple' => esc_html__( 'Purple', 'hemma' ),
'is-pink' => esc_html__( 'Pink', 'hemma' ),
'is-brown' => esc_html__( 'Brown', 'hemma' ),
'is-dark' => esc_html__( 'Dark', 'hemma' ),
'is-white' => esc_html__( 'White', 'hemma' ),
),
) );
$cmb_listed_posts_apartment->add_field( array(
'name' => esc_html__( 'Strip link from the title', 'hemma' ),
'desc' => esc_html__( 'Tick this if you want to strip the link frome the title', 'hemma' ),
'id' => $prefix . 'strip_title_link',
'type' => 'checkbox',
) );
$cmb_listed_posts_apartment->add_field( array(
'name' => esc_html__( 'Blocks Height', 'hemma' ),
'desc' => esc_html__( 'The minimum height of the blocks', 'hemma' ),
'id' => $prefix . 'height',
'type' => 'select',
'options' => array(
'is-contentheight' => esc_html__( 'Content Height', 'hemma' ),
'is-halfheight' => esc_html__( 'Half browser height', 'hemma' ),
'is-fullheight' => esc_html__( 'Full browser height', 'hemma' ),
),
'default' => 'is-contentheight'
) );
}