Hotel Raxa - Advanced Booking System Implementation

🏨 Hotel Booking Enhancements:
- Implemented Eagle Booking Advanced Pricing add-on
- Added Booking.com-style rate management system
- Created professional calendar interface for pricing
- Integrated deals and discounts functionality

💰 Advanced Pricing Features:
- Dynamic pricing models (per room, per person, per adult)
- Base rates, adult rates, and child rates management
- Length of stay discounts and early bird deals
- Mobile rates and secret deals implementation
- Seasonal promotions and flash sales

📅 Availability Management:
- Real-time availability tracking
- Stop sell and restriction controls
- Closed to arrival/departure functionality
- Minimum/maximum stay requirements
- Automatic sold-out management

💳 Payment Integration:
- Maintained Redsys payment gateway integration
- Seamless integration with existing Eagle Booking
- No modifications to core Eagle Booking plugin

🛠️ Technical Implementation:
- Custom database tables for advanced pricing
- WordPress hooks and filters integration
- AJAX-powered admin interface
- Data migration from existing Eagle Booking
- Professional calendar view for revenue management

📊 Admin Interface:
- Booking.com-style management dashboard
- Visual rate and availability calendar
- Bulk operations for date ranges
- Statistics and analytics dashboard
- Modal dialogs for quick editing

🔧 Code Quality:
- WordPress coding standards compliance
- Secure database operations with prepared statements
- Proper input validation and sanitization
- Error handling and logging
- Responsive admin interface

🤖 Generated with Claude Code (https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Hotel Raxa Dev
2025-07-11 07:43:22 +02:00
commit 5b1e2453c7
9816 changed files with 2784509 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<?php
/*---------------------------------------------------------------------------------
Branches VC Elements
-----------------------------------------------------------------------------------*/
if( !function_exists('eb_vc_branches') ) {
add_action( 'vc_before_init', 'eb_vc_branches' );
function eb_vc_branches() {
vc_map( array(
"name" => esc_html__( "Branches", "eagle-booking" ),
"description" => '',
"base" => "eb-branches",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_js' => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"params" => array(
array(
"param_name" => "branches_limit",
"type" => "textfield",
"value" => "3",
"heading" => esc_html__("Items:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array(
'None' => 'none',
'ID' => 'ID',
'Title' => 'title',
'Date' => 'date',
'Random' => 'rand',
'Menu Order' => 'menu_order'
),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array('ASC' => 'ASC', 'DESC' => 'DESC' ),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
)
)
));
}
}
// Branches Layout
foreach ( glob ( plugin_dir_path( __FILE__ ) . "layout/*.php" ) as $file ){
include_once $file;
}

View File

@@ -0,0 +1,78 @@
<?php
/*---------------------------------------------------------------------------------
Branches
-----------------------------------------------------------------------------------*/
if( !function_exists('eb_branches') ) {
function eb_branches($atts, $content = null) {
extract(shortcode_atts(array(
'branches_filters' => '',
'branches_limit' => '',
'offset' => '',
'orderby' => '',
'order' => ''
), $atts));
ob_start();
$args = array(
'taxonomy' => 'eagle_branch',
'hide_empty' => false,
);
$branches_qry = new WP_Term_Query($args);
?>
<div class="eb-g-lg-3 eb-branches-grid">
<?php
if (!empty($branches_qry->terms)) {
foreach ($branches_qry->terms as $eb_branch_term) {
$eb_branch_id = $eb_branch_term->term_id;
$eb_branch_name = get_term_field( 'name', $eb_branch_term );
$eb_branch_logo = get_term_meta( $eb_branch_id, 'eb_branch_logo', true );
$eb_branch_bg = get_term_meta( $eb_branch_id, 'eb_branch_bg', true );
$eb_branch_address = get_term_meta( $eb_branch_id, 'eb_branch_address', true );
$eb_branch_phone = get_term_meta( $eb_branch_id, 'eb_branch_phone', true );
$eb_branch_email = get_term_meta( $eb_branch_id, 'eb_branch_email', true );
$eb_branch_url = get_term_link($eb_branch_id);
?>
<div class="eb-branch-item">
<a href="<?php echo esc_url( $eb_branch_url ) ?>">
<figure style="background-image: url(<?php echo esc_url( $eb_branch_bg ) ?>); background-size: cover">
<h3 class="eb-branch-item-title"><?php echo esc_html( $eb_branch_name ) ?></h3>
</figure>
<div class="eb-branch-item-info">
<ul>
<li><i class="las la-map-marker-alt"></i> <span class="text"><?php echo $eb_branch_address ?></span></li>
<li><i class="las la-phone"></i> <span class="text"><?php echo $eb_branch_phone ?></span></li>
<li><i class="las la-envelope"></i> <span class="text"><?php echo $eb_branch_email ?></span></li>
</ul>
</div>
</a>
</div>
<?php } } ?>
<?php wp_reset_postdata(); ?>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
// Shortcode
add_shortcode('eb-branches', 'eb_branches');
add_shortcode('eb_branches', 'eb_branches');
}

View File

@@ -0,0 +1,5 @@
<?php
// INCLUDE ALL SHRTCODES
foreach ( glob ( plugin_dir_path( __FILE__ ) . "*/index.php" ) as $file ){
include_once $file;
}

View File

@@ -0,0 +1,127 @@
<?php
/*---------------------------------------------------------------------------------
PLACES
-----------------------------------------------------------------------------------*/
if( !function_exists('eb_vc_places') ) {
add_action( 'vc_before_init', 'eb_vc_places' );
function eb_vc_places() {
vc_map( array(
"name" => esc_html__( "Places", "eagle-booking" ),
"description" => '',
"base" => "eb-places",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_js' => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"params" => array(
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array('None' => 'none', 'ID' => 'ID', 'Title' => 'title', 'Date' => 'date', 'Random' => 'rand', 'Menu Order' => 'menu_order' ),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array('ASC' => 'ASC', 'DESC' => 'DESC' ),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
)
)
));
}
}
/*---------------------------------------------------------------------------------
PLACES GRID
-----------------------------------------------------------------------------------*/
if( !function_exists('eb_vc_places_grid') ) {
add_action( 'vc_before_init', 'eb_vc_places_grid' );
function eb_vc_places_grid() {
vc_map( array(
"name" => esc_html__( "Places Grid", "eagle-booking" ),
"description" => '',
"base" => "eb-places-grid",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_js' => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"params" => array(
array(
"param_name" => "places_limit",
"type" => "textfield",
"value" => "6",
"heading" => esc_html__("Items:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "places_per_row",
"type" => "dropdown",
"value" => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '6' => '6'),
"default" => "3",
"heading" => esc_html__("Items per row:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array('None' => 'none', 'ID' => 'ID', 'Title' => 'title', 'Date' => 'date', 'Random' => 'rand', 'Menu Order' => 'menu_order' ),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array('ASC' => 'ASC', 'DESC' => 'DESC' ),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
)
)
));
}
}
// Include Palces Layout
foreach ( glob ( plugin_dir_path( __FILE__ ) . "layout/*.php" ) as $file ){
include_once $file;
}

View File

@@ -0,0 +1,73 @@
<?php
/*---------------------------------------------------------------------------------
places
-----------------------------------------------------------------------------------*/
if( !function_exists('eb_places_grid') ) {
function eb_places_grid($atts, $content = null)
{
extract(shortcode_atts(array(
'places_filters' => '',
'places_limit' => '',
'places_per_row' => '',
'offset' => '',
'orderby' => '',
'order' => ''
), $atts));
ob_start();
$args = array(
'post_type' => 'eagle_places',
'posts_per_page' => $places_limit,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset
);
$places_qry = new WP_Query($args);
?>
<div class="row">
<?php
if ($places_qry->have_posts()): while ($places_qry->have_posts()): $places_qry->the_post();
$places_title = get_the_title();
$places_url = get_permalink();
$places_img_url = get_the_post_thumbnail_url('', 'eagle_booking_image_size_720_470');
$col_class = '4';
if ($places_per_row == '6') { $col_class = '2'; }
if ($places_per_row == '4') { $col_class = '3'; }
if ($places_per_row == '3') { $col_class = '4'; }
if ($places_per_row == '2') { $col_class = '6'; }
if ($places_per_row == '1') { $col_class = '12'; }
?>
<!-- places ITEM -->
<div class="col-lg-<?php echo esc_attr( $col_class ) ?> col-sm-6">
<div class="place-item">
<figure class="gradient-overlay zoom-hover">
<a href="<?php echo esc_url( $places_url ) ?>">
<img src="<?php echo esc_url( $places_img_url ) ?>" class="img-responsive">
<div class="place-name">
<h3><?php echo esc_html( $places_title ) ?></h3>
</div>
</a>
</figure>
</div>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
// Depracated Shortcode
add_shortcode('zante-places-grid', 'eb_places_grid');
// New Shortcode
add_shortcode('eb-places-grid', 'eb_places_grid');
}

View File

@@ -0,0 +1,103 @@
<?php
/*---------------------------------------------------------------------------------
VC Places
-----------------------------------------------------------------------------------*/
if( !function_exists('eb_places') ) {
function eb_places($atts, $content = null)
{
extract(shortcode_atts(array(
'offset' => '',
'orderby' => '',
'order' => ''
), $atts));
ob_start();
$args = array(
'post_type' => 'eagle_places',
'posts_per_page' => 4,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset
);
$places_qry = new WP_Query($args);
?>
<div class="row">
<?php
// Counter
$eb_places_counter = '0';
// Start Loop
if ($places_qry->have_posts()): while ($places_qry->have_posts()): $places_qry->the_post();
$eb_place_id = get_the_ID();
$eb_place_title = get_the_title();
$eb_place_url = get_permalink();
$eb_place_img = get_the_post_thumbnail_url('', 'eagle_booking_image_size_720_470');
// Counter
$eb_places_counter++;
// Item Class
if ( $eb_places_counter == 1 ) {
$eb_place_class = 'first-place';
} elseif($eb_places_counter == 2) {
$eb_place_class = 'second-place';
} elseif($eb_places_counter == 3) {
$eb_place_class = 'third-place';
} else {
$eb_place_class = 'fourth-place';
}
?>
<?php if ( $eb_places_counter == 3) : ?>
<div class="col-lg-6">
<div class="row">
<?php endif ?>
<div class="col-md-6 <?php echo esc_attr($eb_place_class) ?>">
<div class="place-item">
<figure class="gradient-overlay zoom-hover">
<a href="<?php echo esc_url( $eb_place_url ) ?>">
<img src="<?php echo esc_url( $eb_place_img ) ?>" class="img-responsive" alt="<?php echo esc_html( $eb_place_title ) ?>">
<h3 class="place-title"><?php echo esc_html( $eb_place_title ) ?></h3>
</a>
</figure>
</div>
</div>
<?php if ( $eb_places_counter == 4) : ?>
</div>
</div>
<?php endif ?>
<?php endwhile; endif; ?>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
// Depracated Shortcode
add_shortcode('zante-places', 'eb_places');
// New Shortcode
add_shortcode('eb-places', 'eb_places');
add_shortcode('eb_places', 'eb_places');
}

View File

@@ -0,0 +1,350 @@
<?php
/*---------------------------------------------------------------------------------
ROOMS VC ELEMENT SETTINGS/OPTIONS - Deprecated
-----------------------------------------------------------------------------------*/
add_action( 'vc_before_init', 'eagle_booking_rooms_vc' );
function eagle_booking_rooms_vc() {
/*---------------------------------------------------------------------------------
ROOMS NORMAL VIEW VC ELEMENT
-----------------------------------------------------------------------------------*/
vc_map( array(
"name" => esc_html__( "Rooms (Deprecated)", "eagle-booking" ),
"description" => '',
"base" => "eagle-booking-rooms",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_js' => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"deprecated" => true,
"params" => array(
array(
"param_name" => "branch_id",
"type" => "dropdown",
"value" => eb_sort_by_branch(),
"heading" => __("Branch:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "rooms_limit",
"type" => "textfield",
"value" => "6",
"heading" => esc_html__("Items:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "rooms_per_row",
"type" => "dropdown",
"value" => array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'6' => '6'
),
"default" => "3",
"heading" => esc_html__("Items per row:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array(
'None' => 'none',
'ID' => 'ID',
'Title' => 'title',
'Date' => 'date',
'Random' => 'rand',
'Menu Order' => 'menu_order'
),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array(
'ASC' => 'ASC',
'DESC' => 'DESC'
),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
),
)
));
/*---------------------------------------------------------------------------------
ROOMS LIST VIEW VC ELEMENT
-----------------------------------------------------------------------------------*/
vc_map( array(
"name" => esc_html__( "Rooms List (Deprecated)", "eagle-booking" ),
"description" => '',
"base" => "eagle-booking-rooms-list",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_js' => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"deprecated" => true,
"params" => array(
array(
"param_name" => "branch_id",
"type" => "dropdown",
"value" => eb_sort_by_branch(),
"heading" => __("Branch:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "rooms_limit",
"type" => "textfield",
"value" => "6",
"heading" => esc_html__("Items:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "branch",
"type" => "dropdown",
"value" => 'eagle_branch',
"heading" => esc_html__("Branch:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array(
'None' => 'none',
'ID' => 'ID',
'Title' => 'title',
'Date' => 'date',
'Random' => 'rand',
'Menu Order' => 'menu_order'
),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array(
'ASC' => 'ASC',
'DESC' => 'DESC'
),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
),
)
));
/*---------------------------------------------------------------------------------
ROOMS GRID VC ELEMENT SETTINGS
-----------------------------------------------------------------------------------*/
vc_map( array(
"name" => esc_html__( "Rooms Grid (Deprecated)", "eagle-booking" ),
"description" => '',
"base" => "eagle-booking-rooms-grid",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_js' => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"deprecated" => true,
"params" => array(
array(
"param_name" => "branch_id",
"type" => "dropdown",
"value" => eb_sort_by_branch(),
"heading" => __("Branch:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array(
'None' => 'none',
'ID' => 'ID',
'Title' => 'title',
'Date' => 'date',
'Random' => 'rand',
'Menu Order' => 'menu_order'
),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array(
'ASC' => 'ASC',
'DESC' => 'DESC'
),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
),
)
));
/*---------------------------------------------------------------------------------
ROOMS CAROUSEL VC ELEMENTS SETTINGS
-----------------------------------------------------------------------------------*/
vc_map( array(
"name" => esc_html__( "Rooms Carousel (Deprecated)", "eagle-booking" ),
"description" => '',
"base" => "eagle-booking-rooms-carousel",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_js' => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"deprecated" => true,
"params" => array(
array(
"param_name" => "branch_id",
"type" => "dropdown",
"value" => eb_sort_by_branch(),
"heading" => __("Branch:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "rooms_limit",
"type" => "textfield",
"value" => "6",
"heading" => esc_html__("Items:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "rooms_per_view",
"type" => "dropdown",
"value" => array(
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5'
),
"default" => "3",
"heading" => esc_html__("Items per View:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"type" => "dropdown",
"class" => "",
"heading" => "Navigation Buttons",
"param_name" => "gallery_carousel_nav",
"value" => array(
"True" => true,
"False" => false,
),
"default" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array(
'None' => 'none',
'ID' => 'ID',
'Title' => 'title',
'Date' => 'date',
'Random' => 'rand',
'Menu Order' => 'menu_order'
),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array(
'ASC' => 'ASC',
'DESC' => 'DESC'
),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
),
)
));
}
foreach ( glob ( plugin_dir_path( __FILE__ ) . "layout/*.php" ) as $file ){
include_once $file;
}

View File

@@ -0,0 +1,117 @@
<?php
/*---------------------------------------------------------------------------------
ROOMS CAROUSEL VC ELEMENT
-----------------------------------------------------------------------------------*/
if( !function_exists('eagle_rooms_carousel') ) {
function eagle_rooms_carousel($atts, $content = null)
{
extract(shortcode_atts(array(
'branch_id' => '',
'rooms_limit' => '',
'rooms_per_view' => '',
'gallery_carousel_nav' => '',
'offset' => '',
'orderby' => '',
'order' => '',
), $atts));
ob_start();
$args = array(
'post_type' => 'eagle_rooms',
'posts_per_page' => $rooms_limit,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset
);
// Sort by branch
if ( isset($branch_id) && $branch_id != '' && $branch_id != '0' ) {
$args['tax_query'][] = array(
'taxonomy' => 'eagle_branch',
'field' => 'term_id',
'terms' => $branch_id,
);
}
$rooms_qry = new WP_Query($args);
?>
<?php
$token = wp_generate_password(5, false, false);
?>
<script>
jQuery(document).ready(function ($) {
function gallery_carousel() {
$('#rooms-carousel-<?php echo esc_attr( $token ); ?>').owlCarousel({
loop: false,
margin: 30,
<?php if( $gallery_carousel_nav == true) : ?>
nav: true,
<?php endif ?>
navText: [
"<i class='fa fa-angle-left' aria-hidden='true'></i>",
"<i class='fa fa-angle-right' aria-hidden='true'></i>"
],
responsiveClass:true,
responsive:{
0:{
items: 1,
nav: false
},
600:{
items: 2,
nav: true
},
1000:{
items: <?php echo esc_attr( $rooms_per_view ); ?>,
nav: true,
}
}
});
}
setTimeout(gallery_carousel, 1)
});
</script>
<div id="rooms-carousel-<?php echo esc_attr( $token ); ?>" class="rooms-carousel owl-carousel">
<?php
if ($rooms_qry->have_posts()): while ($rooms_qry->have_posts()): $rooms_qry->the_post();
$eb_room_id = get_the_ID();
$eb_room_title = get_the_title();
$eb_room_url = get_permalink();
$eb_room_img_url = get_the_post_thumbnail_url('', 'eagle_booking_image_size_720_470');
$eb_room_price = eagle_booking_room_min_price($eb_room_id);
?>
<?php
/**
* Include room grid
*/
include eb_load_template('room-grid.php');
?>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
add_shortcode('eagle-booking-rooms-carousel', 'eagle_rooms_carousel');
}

View File

@@ -0,0 +1,118 @@
<?php
/*---------------------------------------------------------------------------------
ROOMS VC ELEMENT
-----------------------------------------------------------------------------------*/
if( !function_exists('eagle_rooms_grid') ) {
function eagle_rooms_grid($atts, $content = null) {
extract( shortcode_atts ( array(
'branch_id' => '',
'rooms_limit' => '5',
'offset' => '',
'orderby' => '',
'order' => '',
), $atts));
ob_start();
$args = array(
'post_type' => 'eagle_rooms',
'posts_per_page' => $rooms_limit,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset,
);
/**
* Sort by branch
*/
if ( isset($branch_id) && $branch_id != '' && $branch_id != '0' ) {
$args['tax_query'][] = array(
'taxonomy' => 'eagle_branch',
'field' => 'term_id',
'terms' => $branch_id,
);
}
$eb_rooms_qry = new WP_Query($args);
?>
<div class="eb-rooms-grid">
<?php
$eb_rooms_counter = 0;
if ( $eb_rooms_qry->have_posts() ): while ( $eb_rooms_qry->have_posts() ): $eb_rooms_qry->the_post();
$eb_room_id = get_the_ID();
$eb_room_title = get_the_title();
$eb_room_url = get_permalink();
$eb_room_img_url = get_the_post_thumbnail_url('', 'eagle_booking_image_size_720_470');
$eb_room_price = eagle_booking_room_min_price($eb_room_id);
$eb_rooms_counter++;
/**
* Add container class
*/
if ( $eb_rooms_counter == 1 ) {
$eb_rooms_columns_class = 'first';
} else {
$eb_rooms_columns_class = 'second';
}
$eb_room_item_class = '';
/**
* Add 'small' class to all items except the 1st one
*/
if ( $eb_rooms_counter != 1 ) $eb_room_item_class .= 'small-item';
/**
* Open before 1st and on 2nd item
*/
if ( $eb_rooms_counter == 1 || $eb_rooms_counter == 2 ) echo '<div class="'.$eb_rooms_columns_class.'-col">';
/**
* Include room grid
*/
include eb_load_template('room-grid.php');
/**
* Close after 1st and 5th item
*/
if ( $eb_rooms_counter == 1 || $eb_rooms_counter == 5 ) echo '</div>';
?>
<?php endwhile; endif; wp_reset_postdata();
?>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
// Old shortcode
add_shortcode('eagle-booking-rooms-grid', 'eagle_rooms_grid');
}

View File

@@ -0,0 +1,76 @@
<?php
/*---------------------------------------------------------------------------------
ROOMS VC ELEMENT
-----------------------------------------------------------------------------------*/
if( !function_exists('eagle_rooms_list') ) {
function eagle_rooms_list($atts, $content = null) {
extract(shortcode_atts(array(
'branch_id' => '',
'rooms_limit' => '',
'rooms_per_row' => '',
'offset' => '',
'orderby' => '',
'order' => '',
), $atts));
ob_start();
$args = array(
'post_type' => 'eagle_rooms',
'posts_per_page' => $rooms_limit,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset
);
// Sort by branch
if ( isset($branch_id) && $branch_id != '' && $branch_id != '0' ) {
$args['tax_query'][] = array(
'taxonomy' => 'eagle_branch',
'field' => 'term_id',
'terms' => $branch_id,
);
}
$rooms_qry = new WP_Query($args);
?>
<?php if ($rooms_qry->have_posts()): while ($rooms_qry->have_posts()) : $rooms_qry->the_post();
// Default
$eb_room_id = get_the_ID();
$eb_room_title = get_the_title();
$eb_room_url = get_permalink();
$eb_room_image = get_the_post_thumbnail_url();
// MTB
$eb_room_price = get_post_meta(get_the_ID(), 'eagle_booking_mtb_room_price', true);
$eb_room_header = get_post_meta(get_the_ID(), 'eagle_booking_mtb_room_header', true);
$eagke_booking_room_sidebar = get_post_meta( get_the_ID(), 'eagle_booking_mtb_room_sidebar', true);
$eb_room_similar = get_post_meta( get_the_ID(), 'eagle_booking_mtb_room_similar', true);
$eb_room_description = get_post_meta( get_the_ID(), 'eagle_booking_mtb_room_description', true );
?>
<?php
/**
* Include room grid
*/
include eb_load_template('room-list.php');
?>
<?php endwhile; endif; ?>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
add_shortcode('eagle-booking-rooms-list', 'eagle_rooms_list');
}

View File

@@ -0,0 +1,85 @@
<?php
/*---------------------------------------------------------------------------------
ROOMS VC ELEMENT
-----------------------------------------------------------------------------------*/
if( !function_exists('eagle_rooms') ) {
function eagle_rooms($atts, $content = null)
{
extract(shortcode_atts(array(
'branch_id' => '',
'rooms_limit' => '',
'rooms_per_row' => '',
'offset' => '',
'orderby' => '',
'order' => '',
), $atts));
ob_start();
$args = array(
'post_type' => 'eagle_rooms',
'posts_per_page' => $rooms_limit,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset
);
// Sort by branch
if ( isset($branch_id) && $branch_id != '' && $branch_id != '0' ) {
$args['tax_query'][] = array(
'taxonomy' => 'eagle_branch',
'field' => 'term_id',
'terms' => $branch_id,
);
}
$rooms_qry = new WP_Query($args);
?>
<div class="row flex-row">
<?php
if ($rooms_qry->have_posts()): while ($rooms_qry->have_posts()): $rooms_qry->the_post();
$eb_room_id = get_the_ID();
$eb_room_title = get_the_title();
$eb_room_url = get_permalink();
$eb_room_img_url = get_the_post_thumbnail_url('', 'eagle_booking_image_size_720_470');
$eb_room_price = eagle_booking_room_min_price($eb_room_id);
$col_class = '4';
if ($rooms_per_row == '6') { $col_class = '2'; }
if ($rooms_per_row == '4') { $col_class = '3'; }
if ($rooms_per_row == '3') { $col_class = '4'; }
if ($rooms_per_row == '2') { $col_class = '6'; }
if ($rooms_per_row == '1') { $col_class = '12'; }
?>
<!-- Room Item -->
<div class="col-lg-<?php echo esc_attr( $col_class ) ?> col-sm-6">
<?php
/**
* Include room grid
*/
include eb_load_template('room-grid.php');
?>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
add_shortcode('eagle-booking-rooms', 'eagle_rooms');
}

View File

@@ -0,0 +1,120 @@
<?php
/*-----------------------------------------------------------------------------------*/
/* SEARCH FORM VC ELEMENT SETTINGS
/*-----------------------------------------------------------------------------------*/
function eb_search_form_shortcode($atts, $content = null) {
$atts = shortcode_atts(
array(
'eagle_booking_search_form_layout' => '',
'eagle_booking_search_form_class' => '',
'layout' => '',
'branches' => '',
'class' => ''
),
$atts);
ob_start();
// Include form parameters
include_once EB_PATH . '/core/admin/form-parameters.php';
// Class
$eb_search_form_class = $atts['class'];
// If the new class att value is empty then check the old one
if ( empty( $eb_search_form_class ) ) $eb_search_form_class = $atts['eagle_booking_search_form_class'];
// Layout
$eb_layout = $atts['layout'];
// If the new layout att value is empty then check the old one
if ( empty( $eb_layout ) ) $eb_layout = $atts['eagle_booking_search_form_layout'];
// If still empty then set default layout
if ( empty( $eb_layout ) ) $eb_layout = 'vertical';
// Branched
$include_branches = $atts['branches'];
// if ( $include_branches === 'false' ) $include_branches = false;
// Include Selected Layout
include 'layout/'.$eb_layout.'.php';
$result = ob_get_contents();
ob_end_clean();
return $result;
}
// Depracated
add_shortcode('eagle_booking_search_form', 'eb_search_form_shortcode');
// New Shortcode
add_shortcode('eb_search_form', 'eb_search_form_shortcode');
/*-----------------------------------------------------------------------------------*/
/* SEARCH FORM VC ELEMENT
/* @since 1.0.0
/*-----------------------------------------------------------------------------------*/
add_action( 'vc_before_init', 'eb_vc_search_form' );
function eb_vc_search_form() {
vc_map( array(
"name" => __( "Booking Search Form", "eagle-booking" ),
"base" => "eagle_booking_search_form",
'show_settings_on_create' => true,
"icon" => "icon-eagle",
"class" => "",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"params" => array(
array(
'type' => 'dropdown',
'heading' => __( 'Layout', 'eagle-booking' ),
'param_name' => 'eagle_booking_search_form_layout',
"value" => array(
'Vertical' => 'vertical',
'Horizontal' => 'horizontal',
'Horizontal Style 2' => 'horizontal-2',
'Horizontal Style 3' => 'horizontal-3'
),
'description' => __( "Choose the layout", "eagle-booking" ),
"save_always" => true,
),
// Branch Selector
array(
"type" => "dropdown",
"class" => "",
"heading" => "Branches",
"param_name" => "branches",
"value" => array(
"False" => false,
"True" => true
),
),
array(
"type" => "textfield",
"class" => "",
"heading" => __( "Custom class", "eagle-booking" ),
"param_name" => "eagle_booking_search_form_class",
)
)
) );
}

View File

@@ -0,0 +1,33 @@
<div class="hbf-2 <?php echo esc_attr( $eb_search_form_class ); ?>">
<div class="inner">
<!--START FORM-->
<form id="search-form" class="search-form" action="<?php echo $eagle_booking_action ?>" method="get" target="<?php echo esc_attr( $eagle_booking_target ) ?>">
<div class="row">
<!-- Custom Parameters -->
<?php include eb_load_template('elements/custom-parameters.php'); ?>
<!-- Check-In/Out-->
<div class="<?php echo ( $include_branches == true ) ? "col-md-3" : "col-md-4" ?>">
<?php include eb_load_template('elements/dates-picker.php'); ?>
</div>
<!-- Guests -->
<div class="<?php echo ( $include_branches == true ) ? "col-md-3" : "col-md-4" ?>"">
<?php include eb_load_template('elements/guests-picker.php'); ?>
</div>
<!-- Branches -->
<?php if ( $include_branches == true ) : ?>
<div class="col-md-3">
<?php include eb_load_template('elements/branch-selector.php'); ?>
</div>
<?php endif ?>
<!-- Buttom -->
<div class="<?php echo ( $include_branches == true ) ? "col-md-3" : "col-md-4" ?>"">
<button id="eb_search_form" class="button eb-btn" type="submit">
<span class="eb-btn-text"><?php echo __('Check Availability','eagle-booking') ?></span>
</button>
</div>
</div>
</form>
</div>
</div>

View File

@@ -0,0 +1,35 @@
<div class="hbf-3 <?php echo esc_attr( $eb_search_form_class ); ?>">
<div class="inner">
<div class="container">
<!--START FORM-->
<form id="search-form" class="search-form" action="<?php echo $eagle_booking_action ?>" method="get" target="<?php echo esc_attr( $eagle_booking_target ) ?>">
<div class="row">
<!-- Custom Parameters -->
<?php include eb_load_template('elements/custom-parameters.php'); ?>
<!-- Check-In/Out-->
<div class="<?php echo ( $include_branches == true ) ? "col-md-3" : "col-md-4" ?>">
<?php include eb_load_template('elements/dates-picker.php'); ?>
</div>
<!-- Guests -->
<div class="<?php echo ( $include_branches == true ) ? "col-md-3" : "col-md-4" ?>"">
<?php include eb_load_template('elements/guests-picker.php'); ?>
</div>
<!-- Branches -->
<?php if ( $include_branches == true ) : ?>
<div class="col-md-3">
<?php include eb_load_template('elements/branch-selector.php'); ?>
</div>
<?php endif ?>
<!-- Buttom -->
<div class="<?php echo ( $include_branches == true ) ? "col-md-3" : "col-md-4" ?>"">
<button id="eb_search_form" class="button eb-btn" type="submit">
<span class="eb-btn-text"><?php echo __('Check Availability','eagle-booking') ?></span>
</button>
</div>
</div>
</form>
</div>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<div class="hbf eb-search-form eb-horizontal-search-form <?php echo esc_attr( $eb_search_form_class ); ?>">
<div class="inner">
<form id="search-form" class="search-form" action="<?php echo $eagle_booking_action ?>" method="get" target="<?php echo esc_attr( $eagle_booking_target ) ?>">
<div class="eb-form-fields">
<?php
include eb_load_template('elements/custom-parameters.php');
include eb_load_template('elements/dates-picker.php');
include eb_load_template('elements/guests-picker.php');
if ( $include_branches == true ) include eb_load_template('elements/branch-selector.php');
?>
<button id="eb_search_form" class="button btn eb-btn eb-btn-search-form" type="submit">
<span class="eb-btn-text"><?php echo __('Check Availability','eagle-booking') ?></span>
</button>
</div>
</form>
</div>
</div>

View File

@@ -0,0 +1,26 @@
<div class="eb-search-form eb-vertical-search-form vbf vbf-over-slider <?php echo esc_attr($eb_search_form_class) ?>">
<h3 class="form_title"><?php echo __('Book Your Stay','eagle-booking') ?></h3>
<div class="inner">
<form id="search-form" class="search-form" action="<?php echo $eagle_booking_action ?>" method="get" target="<?php echo esc_attr( $eagle_booking_target ) ?>">
<?php
include eb_load_template('elements/custom-parameters.php');
include eb_load_template('elements/dates-picker.php');
include eb_load_template('elements/guests-picker.php');
if ( $include_branches == true ) include eb_load_template('elements/branch-selector.php');
?>
<button id="eb_search_form" class="button btn eb-btn" type="submit">
<span class="eb-btn-text"><?php echo __('Check Availability','eagle-booking') ?></span>
</button>
</form>
</div>
</div>

View File

@@ -0,0 +1,89 @@
<?php
/*---------------------------------------------------------------------------------
SERVICES GRID
-----------------------------------------------------------------------------------*/
add_action( 'vc_before_init', 'eagle_vc_room_services' );
function eagle_vc_room_services() {
vc_map( array(
"name" => esc_html__( "Room Services", "eagle-booking" ),
"description" => '',
"base" => "eb-services",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"params" => array(
array(
"param_name" => "posts_limit",
"type" => "textfield",
"value" => "3",
"heading" => esc_html__("Items", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "posts_per_row",
"type" => "dropdown",
"value" => array('2' => '2', '3' => '3', '4' => '4', '6' => '6'),
"default" => "3",
"heading" => esc_html__("Items per Row", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "type",
"type" => "dropdown",
"value" => array(
'All' => 'all',
'Normal' => 'normal',
'Additional' => 'additional'
),
"default" => "all",
"heading" => esc_html__("Services Type", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array('None' => 'none', 'ID' => 'ID', 'Title' => 'title', 'Date' => 'date', 'Random' => 'rand', 'Menu Order' => 'menu_order' ),
"heading" => esc_html__("Order By", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array('ASC' => 'ASC', 'DESC' => 'DESC' ),
"heading" => esc_html__("Order", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
),
)
));
}
// INCLUDE ROOM SERVICES LAYOUT
foreach ( glob ( plugin_dir_path( __FILE__ ) . "layout/*.php" ) as $file ){
include_once $file;
}

View File

@@ -0,0 +1,100 @@
<?php
/*---------------------------------------------------------------------------------
SERVICES GRID
-----------------------------------------------------------------------------------*/
if( !function_exists('eagle_room_services') ) {
function eagle_room_services($atts, $content = null)
{
extract(shortcode_atts(array(
'posts_limit' => '',
'posts_per_row' => '',
'offset' => '',
'orderby' => '',
'order' => '',
'type' => '',
), $atts));
ob_start();
if ( $type === 'all' || $type === '' ) $type = array ( 'normal', 'additional' );
$args = array(
'post_type' => 'eagle_services',
'posts_per_page' => $posts_limit,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset,
'meta_query'=> array(
array(
'key' => 'eagle_booking_mtb_service_type',
'compare' => 'IN',
'value' => $type,
)
)
);
$service_qry = new WP_Query($args);
?>
<div class="room-services-list room-services-list-page">
<div class="row">
<?php
if ($service_qry->have_posts()): while ($service_qry->have_posts()): $service_qry->the_post();
$eagle_booking_service_id = get_the_ID();
$eagle_booking_service_name = get_the_title($eagle_booking_service_id);
// Service Icon
$eagle_booking_service_icon_type = get_post_meta( $eagle_booking_service_id, 'eagle_booking_mtb_service_icon_type', true );
if ($eagle_booking_service_icon_type == 'fontawesome') {
$eagle_booking_service_icon = get_post_meta( $eagle_booking_service_id, 'eagle_booking_mtb_service_icon_fontawesome', true );
} else {
$eagle_booking_service_icon = get_post_meta( $eagle_booking_service_id, 'eagle_booking_mtb_service_icon', true );
}
$eagle_booking_mtb_service_image = get_post_meta( $eagle_booking_service_id, 'eagle_booking_mtb_service_image', true );
$eagle_booking_mtb_service_image_class_original = str_replace(' ', '-', $eagle_booking_service_name);
$eagle_booking_mtb_service_image_class = strtolower($eagle_booking_mtb_service_image_class_original);
$eagle_booking_service_description = get_post_meta( $eagle_booking_service_id, 'eagle_booking_mtb_service_description', true );
$col_class = '4';
if ($posts_per_row == '6') { $col_class = '2'; }
if ($posts_per_row == '4') { $col_class = '3'; }
if ($posts_per_row == '3') { $col_class = '4'; }
if ($posts_per_row == '2') { $col_class = '6'; }
?>
<!-- SERVICE GRID ITEM -->
<div class="col-lg-<?php echo esc_attr( $col_class ) ?>">
<div class="room-services-item">
<?php if ($eagle_booking_service_icon_type == 'customicon') : ?>
<img src="<?php echo esc_url($eagle_booking_mtb_service_image) ?>" class="<?php echo esc_attr($eagle_booking_mtb_service_image_class) ?>">
<?php else : ?>
<i class="<?php echo $eagle_booking_service_icon ?>"></i>
<?php endif ?>
<?php echo esc_html($eagle_booking_service_name) ?>
</div>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
// Depracated Shortcode
add_shortcode('zante-room-services', 'eagle_room_services');
// New Shortcode
add_shortcode('eb-services', 'eagle_room_services');
add_shortcode('eb_services', 'eagle_room_services');
}

View File

@@ -0,0 +1,123 @@
<?php
/*---------------------------------------------------------------------------------
TESTIMONIALS GRID
-----------------------------------------------------------------------------------*/
add_action( 'vc_before_init', 'eagle_vc_testimonials' );
function eagle_vc_testimonials() {
vc_map( array(
"name" => esc_html__( "Testimonials", "eagle-booking" ),
"description" => '',
"base" => "eb-testimonials",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"params" => array(
array(
"param_name" => "posts_limit",
"type" => "textfield",
"value" => "3",
"heading" => esc_html__("Items:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "posts_per_row",
"type" => "dropdown",
"value" => array('2' => '2', '3' => '3', '4' => '4', '6' => '6'),
"default" => "3",
"heading" => esc_html__("Items per row:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array('None' => 'none', 'ID' => 'ID', 'Title' => 'title', 'Date' => 'date', 'Random' => 'rand', 'Menu Order' => 'menu_order' ),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array('ASC' => 'ASC', 'DESC' => 'DESC' ),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
),
)
));
/*---------------------------------------------------------------------------------
TESTIMONIALS CAROUSEL
-----------------------------------------------------------------------------------*/
vc_map( array(
"name" => esc_html__( "Testimonials Carousel", "eagle-booking" ),
"description" => '',
"base" => "eb-testimonials-carousel",
'category' => esc_html__("Eagle Themes",'eagle-booking'),
"class" => "",
'admin_enqueue_js' => "",
'admin_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
'front_enqueue_css' => get_template_directory_uri()."/assets/css/admin/global.css",
"icon" => "icon-eagle",
"params" => array(
array(
"param_name" => "posts_limit",
"type" => "textfield",
"value" => "3",
"heading" => esc_html__("Number of testimonials to show:", "eagle-booking"),
"description" => "",
"save_always" => true,
),
array(
"param_name" => "orderby",
"type" => "dropdown",
"value" => array('None' => 'none', 'ID' => 'ID', 'Title' => 'title', 'Date' => 'date', 'Random' => 'rand', 'Menu Order' => 'menu_order' ),
"heading" => esc_html__("Order By:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "order",
"type" => "dropdown",
"value" => array('ASC' => 'ASC', 'DESC' => 'DESC' ),
"heading" => esc_html__("Order:", "eagle-booking"),
"description" => '',
"save_always" => true,
),
array(
"param_name" => "offset",
"type" => "textfield",
"value" => "",
"heading" => esc_html__("Offset:", "eagle-booking"),
"description" => "",
"save_always" => true
),
)
));
// INCLUDE TESTIMONIAL LAYOUT
foreach ( glob ( plugin_dir_path( __FILE__ ) . "layout/*.php" ) as $file ){
include_once $file;
}
}

View File

@@ -0,0 +1,95 @@
<?php
/*---------------------------------------------------------------------------------
TESTIMONIALS CAROUSEL
-----------------------------------------------------------------------------------*/
if( !function_exists('eagle_testimonials_carousel') ) {
function eagle_testimonials_carousel($atts, $content = null)
{
extract(shortcode_atts(array(
'posts_limit' => '',
'posts_per_row' => '',
'offset' => '',
'orderby' => '',
'order' => ''
), $atts));
ob_start();
$args = array(
'post_type' => 'eagle_reviews',
'posts_per_page' => $posts_limit,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset
);
$testi_qry = new WP_Query($args);
?>
<?php
$token = wp_generate_password(5, false, false);
?>
<script>
jQuery(document).ready(function ($) {
$('#testimonial-carousel-<?php echo esc_attr( $token ); ?>').owlCarousel({
loop: true,
margin: 10,
items: 1,
nav: false,
});
});
</script>
<!-- TESTIMONIAL SLIDE ITEM -->
<div id="testimonial-carousel-<?php echo esc_attr( $token ); ?>" class="testimonials-slider owl-carousel">
<?php
if ($testi_qry->have_posts()): while ($testi_qry->have_posts()) : $testi_qry->the_post();
$testimonial_title = get_the_title();
$testimonial_quote = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_quote', true);
$testimonial_name = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_author', true);
$testimonial_location = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_author_location', true);
$testimonial_avatar_file_id = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_image_id', true );
$testimonial_avatar = wp_get_attachment_image_url( $testimonial_avatar_file_id);
$testimonial_starnumber = get_post_meta( get_the_ID(), 'eagle_booking_mtb_review_rating', true );
?>
<div class="item">
<?php if ( $testimonial_avatar ) : ?>
<img src="<?php echo esc_url( $testimonial_avatar ) ?>" alt="<?php echo esc_html( $testimonial_name ) ?>" width="80">
<?php endif ?>
<div class="review_content">
<p><?php echo esc_html( $testimonial_quote ) ?></p>
<div class="review_rating">
<?php
for($x=1;$x<=$testimonial_starnumber;$x++) {
echo '<i class="fa fa-star" aria-hidden="true"></i>';
}
if (strpos($testimonial_starnumber,'.')) {
echo '<i class="fa fa-star-half-o" aria-hidden="true"></i>';
$x++;
}
while ($x<=5) {
echo '<i class="fa fa-star-o" aria-hidden="true"></i>';
$x++;
}
?>
</div>
<div class="review_author"><?php echo $testimonial_name ?> - <?php echo esc_html( $testimonial_location ) ?></div>
</div>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
// Depracated Shortcode
add_shortcode('zante-testimonials-carousel', 'eagle_testimonials_carousel');
// New Shortcode
add_shortcode('eb-testimonials-carousel', 'eagle_testimonials_carousel');
}

View File

@@ -0,0 +1,97 @@
<?php
/*---------------------------------------------------------------------------------
TESTIMONIALS GRID
-----------------------------------------------------------------------------------*/
if( !function_exists('eagle_testimonials') ) {
function eagle_testimonials($atts, $content = null)
{
extract(shortcode_atts(array(
'posts_limit' => '',
'posts_per_row' => '',
'offset' => '',
'orderby' => '',
'order' => '',
), $atts));
ob_start();
$args = array(
'post_type' => 'eagle_reviews',
'posts_per_page' => $posts_limit,
'orderby' => $orderby,
'order' => $order,
'offset' => $offset
);
$testi_qry = new WP_Query($args);
?>
<div class="row flex-row">
<?php
if ($testi_qry->have_posts()): while ($testi_qry->have_posts()): $testi_qry->the_post();
$testimonial_title = get_the_title();
$testimonial_quote = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_quote', true);
$testimonial_name = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_author', true);
$testimonial_location = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_author_location', true);
$testimonial_avatar_file_id = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_image_id', true );
$testimonial_avatar = wp_get_attachment_image_url( $testimonial_avatar_file_id);
$testimonial_starnumber = get_post_meta( get_the_ID(), 'eagle_booking_mtb_review_rating', true );
$col_class = '4';
if ($posts_per_row == '6') { $col_class = '2'; }
if ($posts_per_row == '4') { $col_class = '3'; }
if ($posts_per_row == '3') { $col_class = '4'; }
if ($posts_per_row == '2') { $col_class = '6'; }
?>
<!-- TESTIMONIAL GRID ITEM -->
<div class="col-lg-<?php echo esc_attr( $col_class ); ?> col-sm-6 ">
<div class="testimonial-item">
<div class="review">
<h3><?php echo esc_html( $testimonial_title ) ?></h3>
<div class="rating">
<?php
for($x=1;$x<=$testimonial_starnumber;$x++) {
echo '<i class="fa fa-star" aria-hidden="true"></i>';
}
if (strpos($testimonial_starnumber,'.')) {
echo '<i class="fa fa-star-half-o" aria-hidden="true"></i>';
$x++;
}
while ($x<=5) {
echo '<i class="fa fa-star-o" aria-hidden="true"></i>';
$x++;
}
?>
</div>
<p><?php echo esc_html( $testimonial_quote ) ?></p>
</div>
<div class="author">
<?php if ( $testimonial_avatar ) : ?>
<img src="<?php echo esc_url( $testimonial_avatar ) ?>" alt="<?php echo esc_html( $testimonial_name ) ?>" width="80">
<?php endif ?>
<div class="author-info">
<h5><?php echo esc_html( $testimonial_name ) ?></h5>
<span class="author-loacation"><?php echo esc_html( $testimonial_location ) ?></span>
</div>
</div>
</div>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div>
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}
// Depracated Shortcode
add_shortcode('zante-testimonials', 'eagle_testimonials');
// New Shortcode
add_shortcode('eb-testimonials', 'eagle_testimonials');
add_shortcode('eb_testimonials', 'eagle_testimonials');
}