-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
804 lines (600 loc) · 27.9 KB
/
functions.php
File metadata and controls
804 lines (600 loc) · 27.9 KB
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
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
<?php
//update_option('siteurl','http://testing.dev/wpsendit_227');
//update_option('home','http://testing.dev/wpsendit_227');
//include('libs/metabox.php');
include('libs/theme-customization.php');
include('libs/theme-init.php');
//metabox
include('libs/metaboxes/page.php');
include('libs/metaboxes/vehicle.php');
function myplugin_add_meta_box() {
$screens = array( 'accommodations','post');
foreach ( $screens as $screen ) {
add_meta_box(
'myplugin_sectionid',
__( 'Localize it', 'myplugin_textdomain' ),
'myplugin_meta_box_callback',
$screen
);
}
}
add_action( 'add_meta_boxes', 'myplugin_add_meta_box' );
add_action ( 'wp_ajax_nopriv_load-content', 'my_load_ajax_content' );
add_action ( 'wp_ajax_load-content', 'my_load_ajax_content' );
function my_load_ajax_content () {
$posts = get_posts('post_type=vehicles');
$i=0;
$response='';
foreach($posts as $post) {
$i++;
$content = apply_filters( 'the_content', $post->post_content );
$response.='<div class="col-sm-4 portfolio-item" data-target="#item" data-post-id="'.$post->ID.'">
<a href="#item" class="portfolio-link">
<div class="caption">
<div class="caption-content">
<i class="fa fa-search-plus fa-3x"></i> '.apply_filters('the_title',$post->post_title).'
</div>
</div>';
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'homepage-thumb');
$url = $thumb['0'];
$thumb_url = wp_get_attachment_url('thumbnail-size', true);
$response.='<img src="'.$url.'" class="img-responsive" alt="" />
</a>
</div>';
}
echo $response;
die(1);
}
add_action ( 'wp_ajax_nopriv_load-blog', 'blog_ajax_content' );
add_action ( 'wp_ajax_load-blog', 'blog_ajax_content' );
function blog_ajax_content () {
$posts = get_posts();
$i=0;
$response='';
foreach($posts as $post) {
$i++;
$content = apply_filters( 'the_content', $post->post_content );
$response.='<div class="col-sm-4 blog-item">
<a href="#portfolioModal'.$i.'" class="blog-link" data-toggle="modal">
<div class="caption">
<div class="caption-content">
<h3><i class="fa fa-search-plus fa-3x"></i> '.apply_filters('the_title',$post->post_title).'</h3>
</div>
</div>';
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'homepage-thumb');
$url = $thumb['0'];
$thumb_url = wp_get_attachment_url('full', true);
$response.='<img src="'.$url.'" class="img-responsive" alt="" />
</a>
</div>';
}
echo $response;
die(1);
}
add_action ( 'wp_ajax_nopriv_load-services', 'services_ajax_content' );
add_action ( 'wp_ajax_load-services', 'services_ajax_content' );
function services_ajax_content () {
$posts = get_posts('post_type=services');
$i=0;
$response='';
foreach($posts as $post) {
$i++;
$content = apply_filters( 'the_content', $post->post_content );
$response.='<div class="col-sm-4 portfolio-item" data-target="#item" data-post-id="'.$post->ID.'">
<a href="#item" class="portfolio-link">
<div class="caption">
<div class="caption-content">
<h3><i class="fa fa-search-plus fa-3x"></i> '.apply_filters('the_title',$post->post_title).'</h3>
</div>
</div>';
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'homepage-thumb');
$url = $thumb['0'];
$thumb_url = wp_get_attachment_url('full', true);
$response.='<img src="'.$url.'" class="img-responsive" alt="" />
</a>
</div>';
}
echo $response;
die(1);
}
add_action ( 'wp_ajax_nopriv_load-single', 'single_ajax_content' );
add_action ( 'wp_ajax_load-single', 'single_ajax_content' );
function single_ajax_content () {
$post_id=$_POST['post_id'];
$response='';
$post = get_post($post_id);
$content = apply_filters( 'the_content', $post->post_content );
$response.'<div class="col-md-8 col-md-offset-2">';
$response.='<h1> '.apply_filters('the_title',$post->post_title).'</h1>';
$response.='<hr />';
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
$url = $thumb['0'];
$thumb_url = wp_get_attachment_url('full', true);
$response.='<img src="'.$url.'" class="img-responsive" alt="'.apply_filters('the_title',$post->post_title).'" />';
$response.=apply_filters('the_content',$post->post_content);
$response.='<button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>';
$response.='</div>';
echo $response;
die(1);
}
add_action ( 'wp_ajax_nopriv_send-form', 'send_form' );
add_action ( 'wp_ajax_send-form', 'send_form' );
/**
* Prints the box content.
*
* @param WP_Post $post The object for the current post/page.
*/
function myplugin_meta_box_callback( $post ) {
// Add an nonce field so we can check for it later.
wp_nonce_field( 'address_meta_box_nonce', 'address_meta_box_nonce' );
/*
* Use get_post_meta() to retrieve an existing value
* from the database and use the value for the form.
*/
$address = get_post_meta( $post->ID, 'address', true );
$lat = get_post_meta( $post->ID, 'lat', true );
$lng = get_post_meta( $post->ID, 'lng', true );
$formatted_address = get_post_meta( $post->ID, 'formatted_address', true );
$html= '<label for="address">';
$html.=_e( 'Address', 'myplugin_textdomain' );
$html.= '</label>';
$html.= '<input type="text" id="geocomplete" name="address" value="' . esc_attr( $address ) . '" size="60" /><br />';
$html.= ' <fieldset> ';
$html.= ' <label>Latitude</label> ';
$html.= ' <input name="lat" type="text" value="' . esc_attr( $lat ) . '"> ';
$html.= ' ';
$html.= ' <label>Longitude</label> ';
$html.= ' <input name="lng" type="text" value="' . esc_attr( $lng ) . '"> ';
$html.= ' ';
$html.= ' <label>Formatted Address</label> ';
$html.= ' <input name="formatted_address" type="text" value="' . esc_attr( $formatted_address ) . '">';
$html.= ' </fieldset>';
$html.= '<div class="map_canvas" style="height:400px;width:800px; margin: 10px 20px 10px 0; border:1px solid #ccc;"></div>';
$html.='<a id="reset" href="#" style="display:none;">Reset Marker</a>';
echo $html;
}
/**
* get menu items and generate loop.
*
* @param stocazzo.
*/
function get_menu_pages(){
if (($locations = get_nav_menu_locations()) && $locations['primary_navi'] ) {
$menu = wp_get_nav_menu_object( $locations['primary_navi'] );
$menu_items = wp_get_nav_menu_items($menu->term_id);
$pageID = array();
foreach($menu_items as $item) {
if($item->object == 'page')
$pageID[] = $item->object_id;
}
return query_posts( array( 'post_type' => 'page','post__in' => $pageID, 'posts_per_page' => count($pageID), 'orderby' => 'post__in' ) );
}
}
/**
* When the post is saved, saves our custom data.
*
* @param int $post_id The ID of the post being saved.
*/
function address_save( $post_id ) {
/*
* We need to verify this came from our screen and with proper authorization,
* because the save_post action can be triggered at other times.
*/
// Check if our nonce is set.
if ( ! isset( $_POST['address_meta_box_nonce'] ) ) {
return;
}
// Verify that the nonce is valid.
if ( ! wp_verify_nonce( $_POST['address_meta_box_nonce'], 'address_meta_box_nonce' ) ) {
return;
}
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Check the user's permissions.
if ( isset( $_POST['post_type'] ) && 'accommodations' == $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_id ) ) {
return;
}
} else {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
}
/* OK, it's safe for us to save the data now. */
// Make sure that it is set.
if ( ! isset( $_POST['address'] ) ) {
return;
}
// Sanitize user input.
$address = sanitize_text_field( $_POST['address'] );
$lat = sanitize_text_field( $_POST['lat'] );
$lng = sanitize_text_field( $_POST['lng'] );
$formatted_address = sanitize_text_field( $_POST['formatted_address'] );
// Update the meta field in the database.
update_post_meta( $post_id, 'address', $address );
update_post_meta( $post_id, 'lat', $lat );
update_post_meta( $post_id, 'lng', $lng );
update_post_meta( $post_id, 'formatted_address', $formatted_address );
}
add_action( 'save_post', 'address_save' );
function the_post_thumbnail_caption() {
global $post;
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
if ($thumbnail_image) {
echo '<span class="caption"><strong>'.$thumbnail_image[0]->post_excerpt.'</strong></span>';
}
}
//comments
add_filter( 'comment_form_default_fields', 'bootstrap3_comment_form_fields' );
function bootstrap3_comment_form_fields( $fields ) {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$html5 = current_theme_supports( 'html5', 'comment-form' ) ? 1 : 0;
$fields = array(
'author' => '<div class="form-group comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input class="form-control" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></div>',
'email' => '<div class="form-group comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input class="form-control" id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></div>',
'url' => '<div class="form-group comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
'<input class="form-control" id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></div>',
);
return $fields;
}
add_filter( 'comment_form_defaults', 'bootstrap3_comment_form' );
function bootstrap3_comment_form( $args ) {
$args['comment_field'] = '<div class="form-group comment-form-comment">
<label for="comment">' . _x( 'Comment', 'noun' ) . '</label>
<textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
</div>';
return $args;
}
//navbar hack
add_filter('body_class', 'mbe_body_class');
function mbe_body_class($classes){
if(is_user_logged_in()){
$classes[] = 'body-logged-in';
} else{
$classes[] = 'body-logged-out';
}
return $classes;
}
add_action('wp_head', 'mbe_wp_head');
function mbe_wp_head(){
echo '<style>'.PHP_EOL;
//echo 'body{ padding-top: 70px !important; }'.PHP_EOL;
// Using custom CSS class name.
echo 'body.body-logged-in .navbar-fixed-top{ top: 28px !important; }'.PHP_EOL;
// Using WordPress default CSS class name.
echo 'body.logged-in .navbar-fixed-top{ top: 28px !important; }'.PHP_EOL;
echo '</style>'.PHP_EOL;
}
function exclude_widget_categories($args){
$exclude = "18"; // The IDs of the excluding categories
$args["exclude"] = $exclude;
return $args;
}
add_filter("widget_categories_args","exclude_widget_categories");
function add_google_fonts() {
wp_register_style('GoogleFonts', 'http://fonts.googleapis.com/css?family=Lato|Tangerine');
wp_enqueue_style('GoogleFonts');
}
add_action('wp_print_styles', 'add_google_fonts');
$args = array(
'name' => __( 'right', 'theme_text_domain' ),
'id' => 'right-page-sidebar',
'description' => '',
'class' => '',
'before_widget' => '<li id="%1$s" class="widget %2$s"><div class="panel panel-default">
<div class="panel-body">',
'after_widget' => '</div></div></li>',
'before_title' => '<h4>',
'after_title' => '</h4>' );
register_sidebar( $args );
$args = array(
'name' => __( 'left', 'theme_text_domain' ),
'id' => 'left-page-sidebar',
'description' => '',
'class' => '',
//'before_widget' => '<li id="%1$s" class="widget %2$s">',
//'after_widget' => '</li>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>' );
register_sidebar( $args );
$args = array(
'name' => __( 'top', 'theme_text_domain' ),
'id' => 'top-page-sidebar',
'description' => '',
'class' => '',
//'before_widget' => '<li id="%1$s" class="widget %2$s">',
//'after_widget' => '</li>',
'before_title' => '',
'after_title' => '' );
register_sidebar( $args );
class wp_bootstrap_navwalker extends Walker_Nav_Menu {
/**
* @see Walker::start_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n";
}
/**
* @see Walker::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param int $current_page Menu item ID.
* @param object $args
*/
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
/**
* Dividers, Headers or Disabled
* =============================
* Determine whether the item is a Divider, Header, Disabled or regular
* menu item. To prevent errors we use the strcasecmp() function to so a
* comparison that is not case sensitive. The strcasecmp() function returns
* a 0 if the strings are equal.
*/
if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="divider">';
} else if ( strcasecmp( $item->title, 'divider') == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="divider">';
} else if ( strcasecmp( $item->attr_title, 'dropdown-header') == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title );
} else if ( strcasecmp($item->attr_title, 'disabled' ) == 0 ) {
$output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>';
} else {
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
if ( $args->has_children )
$class_names .= ' dropdown';
if ( in_array( 'current-menu-item', $classes ) )
$class_names .= ' active';
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '<li' . $id . $value . $class_names .'>';
$atts = array();
$atts['title'] = ! empty( $item->title ) ? $item->title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
// If item has_children add atts to a.
if ( $args->has_children && $depth === 0 ) {
$atts['href'] = '#';
$atts['data-toggle'] = 'dropdown';
$atts['class'] = 'dropdown-toggle';
} else {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
}
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
/*
* Glyphicons
* ===========
* Since the the menu item is NOT a Divider or Header we check the see
* if there is a value in the attr_title property. If the attr_title
* property is NOT null we apply it as the class name for the glyphicon.
*/
if ( ! empty( $item->attr_title ) )
$item_output .= '<a'. $attributes .'><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span> ';
else
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
/**
* Traverse elements to create list from elements.
*
* Display one element if the element doesn't have any children otherwise,
* display the element and its children. Will only traverse up to the max
* depth and no ignore elements under that depth.
*
* This method shouldn't be called directly, use the walk() method instead.
*
* @see Walker::start_el()
* @since 2.5.0
*
* @param object $element Data object
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element )
return;
$id_field = $this->db_fields['id'];
// Display this element.
if ( is_object( $args[0] ) )
$args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
/**
* Menu Fallback
* =============
* If this function is assigned to the wp_nav_menu's fallback_cb variable
* and a manu has not been assigned to the theme location in the WordPress
* menu manager the function with display nothing to a non-logged in user,
* and will add a link to the WordPress menu manager if logged in as an admin.
*
* @param array $args passed from the wp_nav_menu function.
*
*/
public static function fallback( $args ) {
if ( current_user_can( 'manage_options' ) ) {
extract( $args );
$fb_output = null;
if ( $container ) {
$fb_output = '<' . $container;
if ( $container_id )
$fb_output .= ' id="' . $container_id . '"';
if ( $container_class )
$fb_output .= ' class="' . $container_class . '"';
$fb_output .= '>';
}
$fb_output .= '<ul';
if ( $menu_id )
$fb_output .= ' id="' . $menu_id . '"';
if ( $menu_class )
$fb_output .= ' class="' . $menu_class . '"';
$fb_output .= '>';
$fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">Add a menu</a></li>';
$fb_output .= '</ul>';
if ( $container )
$fb_output .= '</' . $container . '>';
echo $fb_output;
}
}
}
function OneGallery($id)
{
$args = array(
'post_type' => 'attachment',
'numberposts' => $limit,
'orderby' => 'menu_order',
'post_parent' => $id
);
$attachments = get_posts($args);
return $attachments;
}
function prices_table($post_ID)
{
$max_pax=get_post_meta($post_ID,'bookandpay_maxpeople',true);
$bookandpay_price_rule=get_post_meta($post_ID,'bookandpay_price_rule',true);
//echo $bookandpay_price_rule;
if($bookandpay_price_rule=='price_for_person'):
?>
<h5><?php _e("<!--:it-->Prezzi a persona<!--:--><!--:en-->Rates per person<!--:-->"); ?></h5>
<table id="rates" class="table table-hover table-striped">
<tr>
<thead>
<th><?php _e("<!--:it-->Persone<!--:--><!--:en-->People<!--:-->"); ?></th>
<?php for($i=1;$i<=$max_pax;$i++): ?>
<th><?php echo $i; ?> <?php echo get_post_meta($post_ID,"apartment-name-".$i,true); ?></th>
<?php endfor; ?>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e("<!--:it-->Bassa Stagione<!--:--><!--:en-->Low Season<!--:-->"); ?></td>
<?php for($i=1;$i<=$max_pax;$i++): ?>
<td>€ <?php echo get_post_meta($post_ID,"apartment-rate-1-".$i,true); ?></td>
<?php endfor; ?>
</tr>
<tr>
<td><?php _e("<!--:it-->Media Stagione<!--:--><!--:en-->Medium Season<!--:-->"); ?></td>
<?php for($i=1;$i<=$max_pax;$i++): ?>
<td><?php echo get_post_meta($post_ID,"apartment-rate-2-".$i,true); ?></td>
<?php endfor; ?>
</tr>
<tr>
<td><?php _e("<!--:it-->Alta Stagione<!--:--><!--:en-->High Season<!--:-->"); ?></td>
<?php for($i=1;$i<=$max_pax;$i++): ?>
<td><?php echo get_post_meta($post_ID,"apartment-rate-3-".$i,true); ?></td>
<?php endfor; ?>
</tr>
</tbody>
</table>
<?php else: ?>
<h5><?php _e("<!--:it-->Prezzi<!--:--><!--:en-->Property Rates<!--:-->"); ?></h5>
<table id="rates" class="table table-hover table-striped">
<tr>
<thead>
<th><?php _e("<!--:it-->Prezzi alloggio per notte<!--:--><!--:en-->Daily property price<!--:-->"); ?></th>
<?php for($i=$max_pax;$i<=$max_pax;$i++): ?>
<th><?php for($i=1;$i<=$max_pax;$i++): ?><i class="foundicon-person"></i><?php endfor; ?></th>
<?php endfor; ?>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e("<!--:it-->Bassa Stagione<!--:--><!--:en-->Low Season<!--:-->"); ?></td>
<?php for($i=$max_pax;$i<=$max_pax;$i++): ?>
<td>€ <?php echo get_post_meta($post_ID,"apartment-rate-1-".$i,true); ?></td>
<?php endfor; ?>
</tr>
<tr>
<td><?php _e("<!--:it-->Media Stagione<!--:--><!--:en-->Media Season<!--:-->"); ?></td>
<?php for($i=$max_pax;$i<=$max_pax;$i++): ?>
<td>€ <?php echo get_post_meta($post_ID,"apartment-rate-2-".$i,true); ?></td>
<?php endfor; ?>
</tr>
<tr>
<td><?php _e("<!--:it-->Alta Stagione<!--:--><!--:en-->High Season<!--:-->"); ?></td>
<?php for($i=$max_pax;$i<=$max_pax;$i++): ?>
<td>€ <?php echo get_post_meta($post_ID,"apartment-rate-3-".$i,true); ?></td>
<?php endfor; ?>
</tr>
</tbody>
</table>
<?php endif; ?>
<?php }
register_nav_menu( 'primary_navi', 'Primary Menu' );
class description_walker extends Walker_Nav_Menu{
function start_el(&$output, $item, $depth, $args){
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="'. esc_attr( $class_names ) . ' page-scroll"';
$output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
if($item->object == 'page')
{
$varpost = get_post($item->object_id);
if(is_home()){
$attributes .= ' href="#' . $varpost->post_name . '"';
}else{
$attributes .= ' href="'.home_url().'/#' . $varpost->post_name . '"';
}
}
else
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$item_output = $args->before;
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID );
$item_output .= $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
function the_slogan() {
global $post;
$slogan = get_post_meta($post->ID,'page_slogan',true);
echo $slogan;
}
function the_subcontent() {
global $post;
$subcontent = get_post_meta($post->ID,'page_subcontent',true);
echo apply_filters('the_content', $subcontent);
}
?>