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:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace EB_ELEMENTOR_PLUGIN;
|
||||
|
||||
/* Class Plugin */
|
||||
class EB_ELEMENTOR {
|
||||
|
||||
/* Instance */
|
||||
private static $_instance = null;
|
||||
public static function instance() {
|
||||
if ( is_null( self::$_instance ) ) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/* widget_scripts */
|
||||
public function widget_scripts() {
|
||||
// wp_register_script( 'core-js', plugins_url( '/assets/js/core.js', __FILE__ ), [ 'jquery' ], false, true );
|
||||
// wp_enqueue_style( 'core-css', plugins_url( '/assets/css/style.css', __FILE__ ), false, false);
|
||||
}
|
||||
|
||||
/* Include Widgets files */
|
||||
private function include_widgets_files() {
|
||||
require_once( __DIR__ . '/widgets/search.php' );
|
||||
require_once( __DIR__ . '/widgets/rooms/rooms.php' );
|
||||
require_once( __DIR__ . '/widgets/places/places.php' );
|
||||
require_once( __DIR__ . '/widgets/testimonials.php' );
|
||||
require_once( __DIR__ . '/widgets/services.php' );
|
||||
require_once( __DIR__ . '/widgets/branches.php' );
|
||||
}
|
||||
|
||||
/* Register Widgets */
|
||||
public function register_widgets() {
|
||||
|
||||
// Its is now safe to include Widgets files
|
||||
$this->include_widgets_files();
|
||||
|
||||
// Register Widgets
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\EB_SEARCH_FORMS() );
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\EB_ROOMS() );
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\EB_PLACES() );
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\EB_REVIEWS() );
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\EB_SERVICES() );
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\EB_BRANCHES() );
|
||||
}
|
||||
|
||||
/* Plugin class constructor */
|
||||
public function __construct() {
|
||||
|
||||
// Register widget scripts
|
||||
add_action( 'elementor/frontend/after_register_scripts', [ $this, 'widget_scripts' ] );
|
||||
|
||||
// Register widgets
|
||||
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_widgets' ] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Instantiate Plugin Class
|
||||
EB_ELEMENTOR::instance();
|
||||
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
/**
|
||||
* Package: Eagle Booking Elementor Widgets
|
||||
* Version: 1.0.0
|
||||
* Author: Eagle Themes
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/**
|
||||
* Main Elementor Hello World Class
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
final class Elementor_Eagle_Booking {
|
||||
|
||||
/**
|
||||
* Plugin Version
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @var string The plugin version.
|
||||
*/
|
||||
const VERSION = '1.2.0';
|
||||
|
||||
/**
|
||||
* Minimum Elementor Version
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @var string Minimum Elementor version required to run the plugin.
|
||||
*/
|
||||
const MINIMUM_ELEMENTOR_VERSION = '2.0.0';
|
||||
|
||||
/**
|
||||
* Minimum PHP Version
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @var string Minimum PHP version required to run the plugin.
|
||||
*/
|
||||
const MINIMUM_PHP_VERSION = '7.0';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
// Load translation
|
||||
add_action( 'init', array( $this, 'i18n' ) );
|
||||
|
||||
// Init Plugin
|
||||
add_action( 'plugins_loaded', array( $this, 'init' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Textdomain
|
||||
*
|
||||
* Load plugin localization files.
|
||||
* Fired by `init` action hook.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @access public
|
||||
*/
|
||||
public function i18n() {
|
||||
load_plugin_textdomain( 'eagle-booking' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the plugin
|
||||
*
|
||||
* Validates that Elementor is already loaded.
|
||||
* Checks for basic plugin requirements, if one check fail don't continue,
|
||||
* if all check have passed include the plugin class.
|
||||
*
|
||||
* Fired by `plugins_loaded` action hook.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @access public
|
||||
*/
|
||||
public function init() {
|
||||
|
||||
// Check if Elementor installed and activated
|
||||
if ( ! did_action( 'elementor/loaded' ) ) {
|
||||
//add_action( 'admin_notices', array( $this, 'admin_notice_missing_main_plugin' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for required Elementor version
|
||||
if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
|
||||
add_action( 'admin_notices', array( $this, 'admin_notice_minimum_elementor_version' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for required PHP version
|
||||
if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
|
||||
add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Once we get here, We have passed all validation checks so we can safely include our plugin
|
||||
require_once( 'elementor-plugin.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin notice
|
||||
*
|
||||
* Warning when the site doesn't have Elementor installed or activated.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function admin_notice_missing_main_plugin() {
|
||||
if ( isset( $_GET['activate'] ) ) {
|
||||
unset( $_GET['activate'] );
|
||||
}
|
||||
|
||||
$message = sprintf(
|
||||
/* translators: 1: Plugin name 2: Elementor */
|
||||
esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'eagle-booking' ),
|
||||
'<strong>' . esc_html__( 'Elementor Hello World', 'eagle-booking' ) . '</strong>',
|
||||
'<strong>' . esc_html__( 'Elementor', 'eagle-booking' ) . '</strong>'
|
||||
);
|
||||
|
||||
printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin notice
|
||||
*
|
||||
* Warning when the site doesn't have a minimum required Elementor version.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function admin_notice_minimum_elementor_version() {
|
||||
if ( isset( $_GET['activate'] ) ) {
|
||||
unset( $_GET['activate'] );
|
||||
}
|
||||
|
||||
$message = sprintf(
|
||||
/* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */
|
||||
esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'eagle-booking' ),
|
||||
'<strong>' . esc_html__( 'Elementor Hello World', 'eagle-booking' ) . '</strong>',
|
||||
'<strong>' . esc_html__( 'Elementor', 'eagle-booking' ) . '</strong>',
|
||||
self::MINIMUM_ELEMENTOR_VERSION
|
||||
);
|
||||
|
||||
printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin notice
|
||||
*
|
||||
* Warning when the site doesn't have a minimum required PHP version.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function admin_notice_minimum_php_version() {
|
||||
if ( isset( $_GET['activate'] ) ) {
|
||||
unset( $_GET['activate'] );
|
||||
}
|
||||
|
||||
$message = sprintf(
|
||||
/* translators: 1: Plugin name 2: PHP 3: Required PHP version */
|
||||
esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'eagle-booking' ),
|
||||
'<strong>' . esc_html__( 'Elementor Hello World', 'eagle-booking' ) . '</strong>',
|
||||
'<strong>' . esc_html__( 'PHP', 'eagle-booking' ) . '</strong>',
|
||||
self::MINIMUM_PHP_VERSION
|
||||
);
|
||||
|
||||
printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Instantiate Elementor_Eagle_Booking.
|
||||
new Elementor_Eagle_Booking();
|
||||
|
||||
// Register New Widgets Categorie 'Eagle Themes'
|
||||
|
||||
function eagle_booking_add_elementor_widget_categories( $elements_manager ) {
|
||||
|
||||
$elements_manager->add_category(
|
||||
'eaglebooking',
|
||||
[
|
||||
'title' => __( 'Eagle Booking', 'eagle-booking' ),
|
||||
'icon' => 'fa fa-plug',
|
||||
]
|
||||
);
|
||||
}
|
||||
add_action( 'elementor/elements/categories_registered', 'eagle_booking_add_elementor_widget_categories' );
|
||||
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
namespace EB_ELEMENTOR_PLUGIN\Widgets;
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Branches Elementor Widget
|
||||
* Author: Eagle Themes
|
||||
* Since: 1.0.0
|
||||
---------------------------------------------------------------------------*/
|
||||
class EB_BRANCHES extends Widget_Base {
|
||||
|
||||
/* Retrieve the widget name. */
|
||||
public function get_name() {
|
||||
return 'eb_branches';
|
||||
}
|
||||
|
||||
/* Retrieve the widget title. */
|
||||
public function get_title() {
|
||||
return __( 'EB Branches', 'eagle-booking' );
|
||||
}
|
||||
|
||||
/* Retrieve the widget icon. */
|
||||
public function get_icon() {
|
||||
return 'eicon-sitemap';
|
||||
}
|
||||
|
||||
/* Retrieve the list of categories the widget belongs to.*/
|
||||
public function get_categories() {
|
||||
return [ 'eaglebooking' ];
|
||||
}
|
||||
|
||||
/*Retrieve the list of scripts the widget depended on. */
|
||||
public function get_script_depends() {
|
||||
return [ 'core-js', 'core-css' ];
|
||||
}
|
||||
|
||||
/* Register the widget controls. */
|
||||
protected function register_controls() {
|
||||
$this->start_controls_section(
|
||||
'section_layout',
|
||||
[
|
||||
'label' => __( 'Settings', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
// Items to Display
|
||||
$this->add_control(
|
||||
'items',
|
||||
[
|
||||
'label' => __( 'Items to Display', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '8',
|
||||
]
|
||||
);
|
||||
|
||||
// Columns
|
||||
$this->add_responsive_control(
|
||||
'columns',
|
||||
[
|
||||
'label' => __( 'Columns', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
||||
'options' => [
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6'
|
||||
],
|
||||
|
||||
'desktop_default' => '3',
|
||||
'tablet_default' => '2',
|
||||
'mobile_default' => '1',
|
||||
]
|
||||
);
|
||||
|
||||
// Order By
|
||||
$this->add_control(
|
||||
'orderby',
|
||||
[
|
||||
'label' => __( 'Order By', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'term_id',
|
||||
'options' => [
|
||||
'none' => __( 'None', 'eagle-booking' ),
|
||||
'term_id' => __( 'ID', 'eagle-booking' ),
|
||||
'name' => __( 'Title', 'eagle-booking' ),
|
||||
'slug' => __( 'Slug', 'eagle-booking' ),
|
||||
'term_group' => __( 'Term Group', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Order
|
||||
$this->add_control(
|
||||
'order',
|
||||
[
|
||||
'label' => __( 'Order', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ASC',
|
||||
'options' => [
|
||||
'ASC' => __( 'ASC', 'eagle-booking' ),
|
||||
'DESC' => __( 'DESC', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Offset
|
||||
$this->add_control(
|
||||
'offset',
|
||||
[
|
||||
'label' => __( 'Offset', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_title',
|
||||
[
|
||||
'label' => __( 'Title', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color', [
|
||||
'label' => __( 'Text Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-branch-details .title' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'label' => __( 'Typography', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-branch-details .title',
|
||||
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
/* Render */
|
||||
protected function render() {
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
$desktop_cols = !empty( $settings['columns'] ) ? $settings['columns'] : 3;
|
||||
$tablet_cols = !empty( $settings['columns_tablet'] ) ? $settings['columns_tablet'] : 3;
|
||||
$mobile_cols = !empty( $settings['columns_mobile'] ) ? $settings['columns_mobile'] : 1;
|
||||
|
||||
$args = array(
|
||||
'taxonomy' => 'eagle_branch',
|
||||
'hide_empty' => false,
|
||||
'number' => $settings['items'],
|
||||
'orderby' => $settings['orderby'],
|
||||
'order' => $settings['order'],
|
||||
'offset' => $settings['offset']
|
||||
);
|
||||
|
||||
$branches_qry = new \WP_Term_Query($args);
|
||||
$class = '';
|
||||
$class = 'eb-g-lg-'.$desktop_cols.' '.'eb-g-md-'.$tablet_cols.' '.'eb-g-sm-'.$mobile_cols;
|
||||
|
||||
?>
|
||||
|
||||
<div class="<?php echo esc_attr( $class ) ?> eb-braches">
|
||||
|
||||
<?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">
|
||||
<div class="eb-branch-details">
|
||||
<div class="eb-branch-details-inner ">
|
||||
<h4 class="title"><?php echo esc_html( $eb_branch_name ) ?></h4>
|
||||
<div class="eb-branch-location"><i class="icon-location-pin"></i> <?php echo $eb_branch_address ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</figure>
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<div class="eb-place-item" style="background-image: url( <?php echo $eb_place_img_url ?> ) ">
|
||||
<a href="<?php echo esc_url( $eb_place_url ) ?>"></a>
|
||||
<?php if ( $settings['title'] == true ) : ?>
|
||||
<div class="details">
|
||||
<h4 class="title"><?php echo esc_html( $eb_place_title ) ?><span></span></h4>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
@@ -0,0 +1,466 @@
|
||||
<?php
|
||||
namespace EB_ELEMENTOR_PLUGIN\Widgets;
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Elementor Places
|
||||
* Author: Eagle Themes (Jomin Muskaj)
|
||||
* Since: 1.0.0s
|
||||
---------------------------------------------------------------------------*/
|
||||
class EB_PLACES extends Widget_Base {
|
||||
|
||||
/* Retrieve the widget name. */
|
||||
public function get_name() {
|
||||
return 'eb_places';
|
||||
}
|
||||
|
||||
/* Retrieve the widget title. */
|
||||
public function get_title() {
|
||||
return __( 'EB Places', 'eagle' );
|
||||
}
|
||||
|
||||
/* Retrieve the widget icon. */
|
||||
public function get_icon() {
|
||||
return 'eicon-featured-image';
|
||||
}
|
||||
|
||||
/* Retrieve the list of categories the widget belongs to.*/
|
||||
public function get_categories() {
|
||||
return [ 'eaglebooking' ];
|
||||
}
|
||||
|
||||
/*Retrieve the list of scripts the widget depended on. */
|
||||
public function get_script_depends() {
|
||||
return [ 'core-js', 'core-css' ];
|
||||
}
|
||||
|
||||
/* Register the widget controls. */
|
||||
protected function register_controls() {
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_layout',
|
||||
[
|
||||
'label' => __( 'Layout', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
// Layout
|
||||
$this->add_control(
|
||||
'layout',
|
||||
[
|
||||
'label' => __( 'Layout', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'normal',
|
||||
'options' => [
|
||||
'normal' => __( 'Normal', 'eagle-booking' ),
|
||||
'grid' => __( 'Grid', 'eagle-booking' ),
|
||||
'carousel' => __( 'Carousel', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Items
|
||||
$this->add_control(
|
||||
'items',
|
||||
[
|
||||
'label' => __( 'Items to Display', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '10',
|
||||
]
|
||||
);
|
||||
|
||||
// Columns
|
||||
$this->add_responsive_control(
|
||||
'columns',
|
||||
[
|
||||
'label' => __( 'Columns', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
||||
'options' => [
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6'
|
||||
],
|
||||
|
||||
'condition' => [
|
||||
'layout!' => 'grid',
|
||||
],
|
||||
|
||||
'desktop_default' => '4',
|
||||
'tablet_default' => '3',
|
||||
'mobile_default' => '1',
|
||||
]
|
||||
);
|
||||
|
||||
// Height
|
||||
$this->add_control(
|
||||
'height',
|
||||
[
|
||||
'label' => esc_html__( 'Height', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 400,
|
||||
],
|
||||
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-place-item' => 'height: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Vertical Spacing
|
||||
$this->add_control(
|
||||
'vertical_spacing',
|
||||
[
|
||||
'label' => esc_html__( 'Vertical Spacing', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 30,
|
||||
],
|
||||
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-places' => 'column-gap: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
// Horizontal Spacing
|
||||
$this->add_control(
|
||||
'horizontal_spacing',
|
||||
[
|
||||
'label' => esc_html__( 'Horizontal Spacing', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 30,
|
||||
],
|
||||
|
||||
'condition' => [
|
||||
'layout!' => 'carousel',
|
||||
],
|
||||
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-places' => 'row-gap: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Order By
|
||||
$this->add_control(
|
||||
'order_by',
|
||||
[
|
||||
'label' => __( 'Order By', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ID',
|
||||
'options' => [
|
||||
'none' => __( 'None', 'eagle-booking' ),
|
||||
'ID' => __( 'ID', 'eagle-booking' ),
|
||||
'title' => __( 'Title', 'eagle-booking' ),
|
||||
'date' => __( 'Date', 'eagle-booking' ),
|
||||
'rand' => __( 'Random', 'eagle-booking' ),
|
||||
'menu_order' => __( 'Menu Order', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Order
|
||||
$this->add_control(
|
||||
|
||||
'order',
|
||||
[
|
||||
'label' => __( 'Order', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ASC',
|
||||
'options' => [
|
||||
'ASC' => __( 'ASC', 'eagle-booking' ),
|
||||
'DESC' => __( 'DESC', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Offset
|
||||
$this->add_control(
|
||||
|
||||
'offset',
|
||||
[
|
||||
'label' => __( 'Offset', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
// Loop (Carousel)
|
||||
$this->add_control(
|
||||
'loop',
|
||||
[
|
||||
'label' => __( 'Loop', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'True', 'eagle-booking' ),
|
||||
'label_off' => __( 'False', 'eagle-booking' ),
|
||||
'return_value' => 'true',
|
||||
'conditions' => [
|
||||
'terms' => [
|
||||
[
|
||||
'name' => 'layout',
|
||||
'operator' => 'in',
|
||||
'value' => [
|
||||
'carousel',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Navigation (Carousel)
|
||||
$this->add_control(
|
||||
'navigation',
|
||||
[
|
||||
'label' => __( 'Navigation', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'True', 'eagle-booking' ),
|
||||
'label_off' => __( 'False', 'eagle-booking' ),
|
||||
'return_value' => 'true',
|
||||
'conditions' => [
|
||||
'terms' => [
|
||||
[
|
||||
'name' => 'layout',
|
||||
'operator' => 'in',
|
||||
'value' => [
|
||||
'carousel',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_image',
|
||||
[
|
||||
'label' => __( 'Image', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-place-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Background::get_type(),
|
||||
[
|
||||
'name' => 'background',
|
||||
'label' => __( 'Gradient Overlay', 'eagle-booking' ),
|
||||
'types' => [ 'gradient' ],
|
||||
'selector' => '{{WRAPPER}} .eb-place-item:after',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_title',
|
||||
[
|
||||
'label' => __( 'Title', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
// Title
|
||||
$this->add_control(
|
||||
'title',
|
||||
[
|
||||
'label' => __( 'Show', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'True', 'eagle-booking' ),
|
||||
'label_off' => __( 'False', 'eagle-booking' ),
|
||||
'return_value' => 'true',
|
||||
'default' => 'true'
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color', [
|
||||
'label' => __( 'Text Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-place-item .title' => 'color: {{VALUE}}',
|
||||
],
|
||||
'condition' => [
|
||||
'title' => 'true',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'label' => __( 'Typography', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-place-item .title',
|
||||
'condition' => [
|
||||
'title' => 'true',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
/* Render */
|
||||
protected function render() {
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
// Places QRY
|
||||
$eb_args = array(
|
||||
'post_type' => 'eagle_places',
|
||||
'posts_per_page' => $settings['items'],
|
||||
'orderby' => $settings['order_by'],
|
||||
'order' => $settings['order'],
|
||||
'offset' => $settings['offset'],
|
||||
);
|
||||
|
||||
$eb_places_qry = new \WP_Query( $eb_args );
|
||||
$eb_unique_token = wp_generate_password(5, false, false);
|
||||
|
||||
$class = '';
|
||||
|
||||
$desktop_cols = !empty( $settings['columns'] ) ? $settings['columns'] : 4;
|
||||
$tablet_cols = !empty( $settings['columns_tablet'] ) ? $settings['columns_tablet'] : 3;
|
||||
$mobile_cols = !empty( $settings['columns_mobile'] ) ? $settings['columns_mobile'] : 1;
|
||||
|
||||
?>
|
||||
|
||||
<?php if ( $settings['layout'] === 'carousel' ) { ?>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
jQuery(function($) {
|
||||
|
||||
var owl = $('#places-<?php echo esc_attr( $eb_unique_token ) ?>');
|
||||
owl.owlCarousel({
|
||||
loop: true,
|
||||
margin: <?php echo $settings['vertical_spacing']['size'] ?>,
|
||||
dots: false,
|
||||
nav: <?php echo $settings['navigation'] ? 'true' : 'false' ?>,
|
||||
navText: [
|
||||
"<i class='ion-ios-arrow-back'></i>",
|
||||
"<i class='ion-ios-arrow-forward'></i>"
|
||||
|
||||
],
|
||||
responsive: {
|
||||
|
||||
0: {
|
||||
items: <?php echo $mobile_cols ?>
|
||||
},
|
||||
|
||||
768: {
|
||||
items: <?php echo $tablet_cols ?>
|
||||
},
|
||||
|
||||
992: {
|
||||
items: <?php echo $desktop_cols ?>
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
$class .= 'owl-carousel';
|
||||
|
||||
|
||||
|
||||
} elseif ( $settings['layout'] === 'normal' ) {
|
||||
|
||||
$class = 'eb-g-lg-'.$desktop_cols.' '.'eb-g-md-'.$tablet_cols.' '.'eb-g-sm-'.$mobile_cols;
|
||||
|
||||
} else {
|
||||
|
||||
$class .= 'eb-g-2-1-1 eb-g-sm-1';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div id="places-<?php echo esc_attr( $eb_unique_token ) ?>" class="<?php echo esc_attr( $class. ' eb-places' ) ?>">
|
||||
|
||||
<?php
|
||||
|
||||
// Start Places Loop
|
||||
if ( $eb_places_qry->have_posts() ) : while ($eb_places_qry->have_posts()) : $eb_places_qry->the_post();
|
||||
|
||||
$eb_place_id = get_the_ID();
|
||||
$eb_place_title = get_the_title();
|
||||
$eb_place_url = get_permalink();
|
||||
$eb_place_img_url = get_the_post_thumbnail_url('', 'eagle_booking_image_size_720_470');
|
||||
|
||||
/**
|
||||
* Include place item
|
||||
*/
|
||||
include "place-item.php";
|
||||
|
||||
endwhile;
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
<div class="room-item">
|
||||
|
||||
<figure>
|
||||
|
||||
<a href="<?php echo esc_url( $eb_room_url ) ?>">
|
||||
<img src="<?php echo esc_url( $eb_room_img_url ) ?>" alt="<?php echo esc_html( $eb_room_title ) ?>">
|
||||
</a>
|
||||
|
||||
</figure>
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Room Price
|
||||
*/
|
||||
eb_room_price( get_the_ID(), ' / '.__('night', 'eagle-booking') )
|
||||
|
||||
?>
|
||||
|
||||
<div class="room-details">
|
||||
|
||||
<div class="room-details-inner">
|
||||
|
||||
<h4 class="room-title"><a href="<?php echo esc_url( $eb_room_url ) ?>"><?php echo esc_html( $eb_room_title ) ?></a></h4>
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Room Info
|
||||
*/
|
||||
include eb_load_template('room-info.php');
|
||||
|
||||
/**
|
||||
* Include room services
|
||||
*/
|
||||
include eb_load_template('room-services.php');
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,341 @@
|
||||
<?php
|
||||
namespace EB_ELEMENTOR_PLUGIN\Widgets;
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Elementor rooms
|
||||
* Author: Eagle Themes
|
||||
* Since: 1.0.0
|
||||
---------------------------------------------------------------------------*/
|
||||
class EB_ROOMS extends Widget_Base {
|
||||
|
||||
/* Retrieve the widget name. */
|
||||
public function get_name() {
|
||||
return 'eb_rooms';
|
||||
}
|
||||
|
||||
/* Retrieve the widget title. */
|
||||
public function get_title() {
|
||||
return __( 'EB Rooms', 'eagle-booking' );
|
||||
}
|
||||
|
||||
/* Retrieve the widget icon. */
|
||||
public function get_icon() {
|
||||
return 'eicon-apps';
|
||||
}
|
||||
|
||||
/* Retrieve the list of categories the widget belongs to.*/
|
||||
public function get_categories() {
|
||||
return [ 'eaglebooking' ];
|
||||
}
|
||||
|
||||
/*Retrieve the list of scripts the widget depended on. */
|
||||
public function get_script_depends() {
|
||||
return [ 'core-js', 'core-css' ];
|
||||
}
|
||||
|
||||
/* Register the widget controls. */
|
||||
protected function register_controls() {
|
||||
$this->start_controls_section(
|
||||
'section_content',
|
||||
[
|
||||
'label' => __( 'Settings', 'eagle-booking' ),
|
||||
]
|
||||
);
|
||||
|
||||
// Layout
|
||||
$this->add_control(
|
||||
'layout',
|
||||
[
|
||||
'label' => __( 'Style', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'normal',
|
||||
'options' => [
|
||||
'normal' => __( 'Normal', 'eagle-booking' ),
|
||||
'grid' => __( 'Grid', 'eagle-booking' ),
|
||||
'carousel' => __( 'Carousel', 'eagle-booking' ),
|
||||
// 'list' => __( 'List', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Columns
|
||||
$this->add_responsive_control(
|
||||
'columns',
|
||||
[
|
||||
'label' => __( 'Columns', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
||||
'options' => [
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6'
|
||||
],
|
||||
|
||||
'desktop_default' => '4',
|
||||
'tablet_default' => '2',
|
||||
'mobile_default' => '1',
|
||||
|
||||
'condition' => [
|
||||
'layout!' => 'grid',
|
||||
],
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
// Items to Display
|
||||
$this->add_control(
|
||||
'items',
|
||||
[
|
||||
'label' => __( 'Items to Display', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '10',
|
||||
'condition' => [
|
||||
'layout!' => 'grid',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Branches
|
||||
$this->add_control(
|
||||
'branch_id',
|
||||
[
|
||||
'label' => __( 'Branch', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '0',
|
||||
'options' => eb_sort_by_branch()
|
||||
]
|
||||
);
|
||||
|
||||
// Order By
|
||||
$this->add_control(
|
||||
'order_by',
|
||||
[
|
||||
'label' => __( 'Order By', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ID',
|
||||
'options' => [
|
||||
'none' => __( 'None', 'eagle-booking' ),
|
||||
'ID' => __( 'ID', 'eagle-booking' ),
|
||||
'title' => __( 'Title', 'eagle-booking' ),
|
||||
'date' => __( 'Date', 'eagle-booking' ),
|
||||
'rand' => __( 'Random', 'eagle-booking' ),
|
||||
'menu_order' => __( 'Menu Order', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Order
|
||||
$this->add_control(
|
||||
'order',
|
||||
[
|
||||
'label' => __( 'Order', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ASC',
|
||||
'options' => [
|
||||
'ASC' => __( 'ASC', 'eagle-booking' ),
|
||||
'DESC' => __( 'DESC', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Offset
|
||||
$this->add_control(
|
||||
'offset',
|
||||
[
|
||||
'label' => __( 'Offset', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
// Loop (Carousel)
|
||||
$this->add_control(
|
||||
'loop',
|
||||
[
|
||||
'label' => __( 'Loop', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'True', 'eagle-booking' ),
|
||||
'label_off' => __( 'False', 'eagle-booking' ),
|
||||
'return_value' => 'true',
|
||||
'conditions' => [
|
||||
'terms' => [
|
||||
[
|
||||
'name' => 'layout',
|
||||
'operator' => 'in',
|
||||
'value' => [
|
||||
'carousel',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Navigation (Carousel)
|
||||
$this->add_control(
|
||||
'navigation',
|
||||
[
|
||||
'label' => __( 'Navigation', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'True', 'eagle-booking' ),
|
||||
'label_off' => __( 'False', 'eagle-booking' ),
|
||||
'return_value' => 'true',
|
||||
'conditions' => [
|
||||
'terms' => [
|
||||
[
|
||||
'name' => 'layout',
|
||||
'operator' => 'in',
|
||||
'value' => [
|
||||
'carousel',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
/* Render */
|
||||
protected function render() {
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
$desktop_cols = !empty( $settings['columns'] ) ? $settings['columns'] : 4;
|
||||
$tablet_cols = !empty( $settings['columns_tablet'] ) ? $settings['columns_tablet'] : 3;
|
||||
$mobile_cols = !empty( $settings['columns_mobile'] ) ? $settings['columns_mobile'] : 1;
|
||||
|
||||
|
||||
$items = $settings['items'];
|
||||
|
||||
if ( $settings['layout'] === 'grid' ) $items = 3;
|
||||
|
||||
// rooms
|
||||
$eagle_query_args = array(
|
||||
'post_type' => 'eagle_rooms',
|
||||
'posts_per_page' => $items,
|
||||
'orderby' => $settings['order_by'],
|
||||
'order' => $settings['order'],
|
||||
'offset' => $settings['offset'],
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* Sort by branch
|
||||
*/
|
||||
if ( isset($settings['branch_id']) && !empty( ($settings['branch_id']) ) && $settings['branch_id'] != '' && $settings['branch_id'] != '0' ) {
|
||||
|
||||
$eagle_query_args['tax_query'][] = array(
|
||||
'taxonomy' => 'eagle_branch',
|
||||
'field' => 'term_id',
|
||||
'terms' => $settings['branch_id'],
|
||||
);
|
||||
}
|
||||
|
||||
$eb_rooms_qry = new \WP_Query($eagle_query_args);
|
||||
$eb_unique_token = wp_generate_password(5, false, false);
|
||||
|
||||
$class = '';
|
||||
$image_size = '';
|
||||
|
||||
?>
|
||||
|
||||
<?php if ( $settings['layout'] === 'carousel' ) { ?>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
jQuery(function($) {
|
||||
|
||||
var owl = $('#rooms-<?php echo esc_attr( $eb_unique_token ) ?>');
|
||||
owl.owlCarousel({
|
||||
loop: <?php echo $settings['navigation'] ? 'true' : 'false' ?>,
|
||||
margin: 30,
|
||||
dots: false,
|
||||
nav: <?php echo $settings['navigation'] ? 'true' : 'false' ?>,
|
||||
navText: [
|
||||
"<i class='ion-ios-arrow-back'></i>",
|
||||
"<i class='ion-ios-arrow-forward'></i>"
|
||||
],
|
||||
responsive: {
|
||||
|
||||
0: {
|
||||
items: <?php echo $mobile_cols ?>
|
||||
},
|
||||
|
||||
768: {
|
||||
items: <?php echo $tablet_cols ?>
|
||||
},
|
||||
|
||||
992: {
|
||||
items: <?php echo $desktop_cols ?>
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
$class .= 'owl-carousel testimonials-owl';
|
||||
$image_size = 'eagle_booking_image_size_370_485';
|
||||
|
||||
} elseif ( $settings['layout'] === 'normal' ) {
|
||||
|
||||
$class = 'eb-g-lg-'.$desktop_cols.' '.'eb-g-md-'.$tablet_cols.' '.'eb-g-sm-'.$mobile_cols;
|
||||
$image_size = 'eagle_booking_image_size_370_485';
|
||||
|
||||
} elseif ( $settings['layout'] === 'grid' ) {
|
||||
|
||||
$class = 'eb-g-2-1-1 eb-g-sm-1';
|
||||
$image_size = 'eagle_booking_image_size_720_470';
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="<?php echo esc_attr( 'rooms-'.$eb_unique_token ) ?>" class="<?php echo esc_attr( $class ) ?> eb-rooms">
|
||||
|
||||
<?php
|
||||
|
||||
$eb_counter = 0;
|
||||
|
||||
// Loop
|
||||
if ( $eb_rooms_qry->have_posts()) : while ( $eb_rooms_qry->have_posts() ) : $eb_rooms_qry->the_post();
|
||||
|
||||
// Grid Style
|
||||
if ( ( $settings['layout'] === 'grid' ) && ( $eb_counter == 1 || $eb_counter == 2 ) ) $image_size = 'eagle_booking_image_size_370_485';
|
||||
|
||||
$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('', $image_size);
|
||||
|
||||
/**
|
||||
* Include room item
|
||||
*/
|
||||
include('room-item.php');
|
||||
|
||||
$eb_counter++;
|
||||
|
||||
?>
|
||||
|
||||
<?php endwhile; endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,728 @@
|
||||
<?php
|
||||
namespace EB_ELEMENTOR_PLUGIN\Widgets;
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Eagle Booking Elementor Search Widget
|
||||
* Author: Eagle Themes (Jomin Muskaj)
|
||||
* Since: 1.0.0
|
||||
---------------------------------------------------------------------------*/
|
||||
class EB_SEARCH_FORMS extends Widget_Base {
|
||||
|
||||
/* Retrieve the widget name. */
|
||||
public function get_name() {
|
||||
return 'eb_search_form';
|
||||
}
|
||||
|
||||
/* Retrieve the widget title. */
|
||||
public function get_title() {
|
||||
return __( 'EB Search Form', 'eagle-booking' );
|
||||
}
|
||||
|
||||
/* Retrieve the widget icon. */
|
||||
public function get_icon() {
|
||||
return 'eicon-site-search';
|
||||
}
|
||||
|
||||
/* Retrieve the list of categories the widget belongs to.*/
|
||||
public function get_categories() {
|
||||
return [ 'eaglebooking' ];
|
||||
}
|
||||
|
||||
/*Retrieve the list of scripts the widget depended on. */
|
||||
public function get_script_depends() {
|
||||
return [ 'core-js', 'core-css' ];
|
||||
}
|
||||
|
||||
/* Register the widget controls. */
|
||||
protected function register_controls() {
|
||||
|
||||
// Style Tab
|
||||
$this->start_controls_section(
|
||||
'section_style',
|
||||
[
|
||||
'label' => __( 'Layout', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
// Layout
|
||||
$this->add_control(
|
||||
'layout',
|
||||
[
|
||||
'label' => __( 'Layout', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'horizontal',
|
||||
'options' => [
|
||||
'horizontal' => __( 'Horizontal', 'eagle-booking' ),
|
||||
'vertical' => __( 'Vertical', 'eagle-booking' ),
|
||||
// 'popup' => __( 'Popup', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Form Label
|
||||
$this->add_control(
|
||||
'branch',
|
||||
[
|
||||
'label' => __( 'Branch Selector', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'Show', 'eagle-booking' ),
|
||||
'label_off' => __( 'Hide', 'eagle-booking' ),
|
||||
'return_value' => 'true',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'bg_color', [
|
||||
'label' => __( 'Background Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form' => 'background: {{VALUE}}'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'margin',
|
||||
[
|
||||
'type' => \Elementor\Controls_Manager::DIMENSIONS,
|
||||
'label' => esc_html__( 'Margin', 'eagle-booking' ),
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'padding',
|
||||
[
|
||||
'type' => \Elementor\Controls_Manager::DIMENSIONS,
|
||||
'label' => esc_html__( 'Padding', 'eagle-booking' ),
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'default' => [
|
||||
'top' => '30',
|
||||
'right' => '30',
|
||||
'bottom' => '30',
|
||||
'left' => '30',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'border',
|
||||
'label' => esc_html__( 'Border', 'eagle-booking' ),
|
||||
'fields_options' => [
|
||||
'border' => [
|
||||
'default' => 'solid',
|
||||
],
|
||||
'width' => [
|
||||
'default' => [
|
||||
'top' => '1',
|
||||
'right' => '1',
|
||||
'bottom' => '1',
|
||||
'left' => '1',
|
||||
'isLinked' => false,
|
||||
],
|
||||
],
|
||||
'color' => [
|
||||
'default' => '#ededed',
|
||||
],
|
||||
],
|
||||
'selector' => '{{WRAPPER}} .eb-search-form',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px'],
|
||||
'default' => [
|
||||
'top' => '4',
|
||||
'right' => '4',
|
||||
'bottom' => '4',
|
||||
'left' => '4',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'box_shadow',
|
||||
'label' => __( 'Box Shadow', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-search-form',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// New Section [Title]
|
||||
$this->start_controls_section(
|
||||
'title_section',
|
||||
[
|
||||
'label' => __( 'Title', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_availability',
|
||||
[
|
||||
'raw' => '<strong>' . esc_html__( 'Please note!', 'eagle-booking' ) . '</strong> ' . esc_html__( 'Title is available only for the horizontal search form', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
|
||||
'render_type' => 'ui',
|
||||
'condition' => [
|
||||
'layout!' => 'vertical',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_text', [
|
||||
'label' => __( 'Title', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::TEXT,
|
||||
'default' => __( 'Book Your Stay' , 'eagle-booking' ),
|
||||
'condition' => ['layout' => 'vertical'],
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'eagle-booking' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'eagle-booking' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'eagle-booking' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'default' => 'center',
|
||||
'toggle' => true,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form .form-title' => 'text-align: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color', [
|
||||
'label' => __( 'Text Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form .form-title' => 'color: {{VALUE}}'
|
||||
],
|
||||
'condition' => ['layout' => 'vertical'],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'label' => __( 'Title Typography', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-search-form .form-title',
|
||||
'condition' => ['layout' => 'vertical'],
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_padding',
|
||||
[
|
||||
'type' => \Elementor\Controls_Manager::DIMENSIONS,
|
||||
'label' => esc_html__( 'Padding', 'eagle-booking' ),
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form .form-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'condition' => ['layout' => 'vertical'],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_margin',
|
||||
[
|
||||
'type' => \Elementor\Controls_Manager::DIMENSIONS,
|
||||
'label' => esc_html__( 'Margin', 'eagle-booking' ),
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'default' => [
|
||||
'top' => '0',
|
||||
'right' => '15',
|
||||
'bottom' => '30',
|
||||
'left' => '15',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form .form-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'title_border',
|
||||
'label' => esc_html__( 'Border', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-search-form .form-title',
|
||||
'condition' => ['layout' => 'vertical'],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// New Section [Fields]
|
||||
$this->start_controls_section(
|
||||
'fields_section',
|
||||
[
|
||||
'label' => __( 'Fields', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'field_margin',
|
||||
[
|
||||
'type' => \Elementor\Controls_Manager::DIMENSIONS,
|
||||
'label' => esc_html__( 'Margin', 'eagle-booking' ),
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'default' => [
|
||||
'top' => '0',
|
||||
'right' => '0',
|
||||
'bottom' => '0',
|
||||
'left' => '0',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form .eb-field-group' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'field_padding',
|
||||
[
|
||||
'type' => \Elementor\Controls_Manager::DIMENSIONS,
|
||||
'label' => esc_html__( 'Padding', 'eagle-booking' ),
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'default' => [
|
||||
'top' => '0',
|
||||
'right' => '0',
|
||||
'bottom' => '0',
|
||||
'left' => '0',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form .eb-field-group .eb-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Form Label
|
||||
$this->add_control(
|
||||
'label',
|
||||
[
|
||||
'label' => __( 'Labels', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'Show', 'eagle-booking' ),
|
||||
'label_off' => __( 'Hide', 'eagle-booking' ),
|
||||
'return_value' => 'block',
|
||||
'default' => false,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-field-group label' => 'display: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'label_color', [
|
||||
'label' => __( 'Label Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'condition' => ['label' => 'block'],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-field-group > label' => 'color: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'label_typography',
|
||||
'label' => __( 'Label Typography', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-field-group label',
|
||||
'condition' => ['label' => 'block'],
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'field_color', [
|
||||
'label' => __( 'Field Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-field-group ::-webkit-input-placeholder' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eb-field-group .guestspicker' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .eb-field-group .eb-field' => 'color: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'field_typography',
|
||||
'label' => __( 'Field Typography', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-field-group .eb-field',
|
||||
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'field_bg_color', [
|
||||
'label' => __( 'Background Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form .eb-field' => 'background: {{VALUE}}'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'field_border',
|
||||
'label' => esc_html__( 'Border', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-search-form .eb-field',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'field_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => '1',
|
||||
'right' => '1',
|
||||
'bottom' => '1',
|
||||
'left' => '1',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-search-form .eb-field' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// New Section [Button]
|
||||
$this->start_controls_section(
|
||||
'button_section',
|
||||
[
|
||||
'label' => __( 'Button', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
// Buton Text
|
||||
$this->add_control(
|
||||
'button_text', [
|
||||
'label' => __( 'Button Text', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::TEXT,
|
||||
'default' => __( 'Book Your Room' , 'eagle-booking' ),
|
||||
// 'condition' => ['layout' => 'popup'],
|
||||
]
|
||||
);
|
||||
|
||||
$this->start_controls_tabs(
|
||||
'style_tabs'
|
||||
);
|
||||
|
||||
$this->start_controls_tab(
|
||||
'style_normal_tab',
|
||||
[
|
||||
'label' => esc_html__( 'Normal', 'eagle-booking' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'button_color', [
|
||||
'label' => __( 'Text Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-btn-search-form' => 'color: {{VALUE}}'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'button_bg_color', [
|
||||
'label' => __( 'Background Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'default' => '#19a1f7',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-btn-search-form' => 'background: {{VALUE}}'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'button_border',
|
||||
'label' => esc_html__( 'Border', 'eagle-booking' ),
|
||||
'fields_options' => [
|
||||
'border' => [
|
||||
'default' => 'solid',
|
||||
],
|
||||
'width' => [
|
||||
'default' => [
|
||||
'top' => '1',
|
||||
'right' => '1',
|
||||
'bottom' => '1',
|
||||
'left' => '1',
|
||||
'isLinked' => false,
|
||||
],
|
||||
],
|
||||
'color' => [
|
||||
'default' => '#19a1f7',
|
||||
],
|
||||
],
|
||||
|
||||
'selector' => '{{WRAPPER}} .eb-btn-search-form',
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->start_controls_tab(
|
||||
'style_hover_tab',
|
||||
[
|
||||
'label' => esc_html__( 'Hover', 'eagle-booking' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'button_color_hover', [
|
||||
'label' => __( 'Text Color Hover', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-btn-search-form:hover' => 'color: {{VALUE}}'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'button_bg_color_hover', [
|
||||
'label' => __( 'Background Color Hover', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'default' => '#19a1f7',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-btn-search-form:hover' => 'background: {{VALUE}}'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'button_border_hover',
|
||||
'label' => esc_html__( 'Border Hover', 'eagle-booking' ),
|
||||
'fields_options' => [
|
||||
'border' => [
|
||||
'default' => 'solid',
|
||||
],
|
||||
'width' => [
|
||||
'default' => [
|
||||
'top' => '1',
|
||||
'right' => '1',
|
||||
'bottom' => '1',
|
||||
'left' => '1',
|
||||
'isLinked' => false,
|
||||
],
|
||||
],
|
||||
'color' => [
|
||||
'default' => '#19a1f7',
|
||||
],
|
||||
],
|
||||
|
||||
'selector' => '{{WRAPPER}} .eb-btn-search-form:hover',
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->end_controls_tabs();
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'button_typography',
|
||||
'label' => __( 'Typography', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-btn-search-form',
|
||||
'condition!' => ['layout' => 'popup'],
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'button_padding',
|
||||
[
|
||||
'type' => \Elementor\Controls_Manager::DIMENSIONS,
|
||||
'label' => esc_html__( 'Padding', 'eagle-booking' ),
|
||||
'size_units' => [ 'px', 'em', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-btn-search-form' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'button_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-btn-search-form' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
/* Render */
|
||||
protected function render() {
|
||||
|
||||
// Include form parameters
|
||||
include EB_PATH . '/core/admin/form-parameters.php';
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
?>
|
||||
|
||||
<?php if ( $settings['layout'] === 'horizontal' ) : ?>
|
||||
|
||||
<div class="eb-search-form eb-horizontal-search-form eb-elementor">
|
||||
<form id="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 Custom Parameters
|
||||
*/
|
||||
include eb_load_template('elements/custom-parameters.php');
|
||||
|
||||
/**
|
||||
* Include Dates Picker
|
||||
*/
|
||||
include eb_load_template('elements/dates-picker.php');
|
||||
|
||||
/**
|
||||
* Include Guests Picker
|
||||
*/
|
||||
include eb_load_template('elements/guests-picker.php');
|
||||
|
||||
/**
|
||||
* Include Branch Selector
|
||||
*/
|
||||
if ( $settings['branch'] == true ) include eb_load_template('elements/branch-selector.php');
|
||||
|
||||
?>
|
||||
|
||||
<div class="eb-field-button">
|
||||
<button id="eb_search_form" class="btn eb-btn-search-form" type="submit" >
|
||||
<span class="eb-btn-text"><?php echo $settings['button_text'] ?></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php elseif ( $settings['layout'] === 'vertical' ) : ?>
|
||||
|
||||
<div class="eb-search-form eb-vertical-search-form eb-elementor">
|
||||
<h3 class="form-title"><?php echo $settings['title_text'] ?></h3>
|
||||
<form id="search-form" action="<?php echo $eagle_booking_action ?>" method="get" target="<?php echo esc_attr( $eagle_booking_target ) ?>">
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Include Custom Parameters
|
||||
*/
|
||||
include eb_load_template('elements/custom-parameters.php');
|
||||
|
||||
/**
|
||||
* Include Dates Picker
|
||||
*/
|
||||
include eb_load_template('elements/dates-picker.php');
|
||||
|
||||
/**
|
||||
* Include Guests Picker
|
||||
*/
|
||||
include eb_load_template('elements/guests-picker.php');
|
||||
|
||||
/**
|
||||
* Include Branch Selector
|
||||
*/
|
||||
if ( $settings['branch'] == true ) include eb_load_template('elements/branch-selector.php');
|
||||
|
||||
?>
|
||||
|
||||
<div class="eb-field-button">
|
||||
<button id="eb_search_form" class="btn eb-btn-search-form" type="submit" >
|
||||
<span class="eb-btn-text"><?php echo $settings['button_text'] ?></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<button id="eb-popup-search-form" class="eb-btn eb-popup-search-form-btn booking-form-toggle"><?php echo $settings['button_text'] ?><i class="fa fa-calendar" aria-hidden="true"></i></button>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,421 @@
|
||||
<?php
|
||||
namespace EB_ELEMENTOR_PLUGIN\Widgets;
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Elementor Gallery
|
||||
* Author: Eagle Themes
|
||||
* Since: 1.0.0
|
||||
---------------------------------------------------------------------------*/
|
||||
class EB_SERVICES extends Widget_Base {
|
||||
|
||||
/* Retrieve the widget name. */
|
||||
public function get_name() {
|
||||
return 'eb_services';
|
||||
}
|
||||
|
||||
/* Retrieve the widget title. */
|
||||
public function get_title() {
|
||||
return __( 'EB Services', 'eagle-booking' );
|
||||
}
|
||||
|
||||
/* Retrieve the widget icon. */
|
||||
public function get_icon() {
|
||||
return 'eicon-editor-list-ul';
|
||||
}
|
||||
|
||||
/* Retrieve the list of categories the widget belongs to.*/
|
||||
public function get_categories() {
|
||||
return [ 'eaglebooking' ];
|
||||
}
|
||||
|
||||
/*Retrieve the list of scripts the widget depended on. */
|
||||
public function get_script_depends() {
|
||||
return [ 'core-js', 'core-css' ];
|
||||
}
|
||||
|
||||
/* Register the widget controls. */
|
||||
protected function register_controls() {
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_content',
|
||||
[
|
||||
'label' => __( 'Layout', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_LAYOUT,
|
||||
]
|
||||
);
|
||||
|
||||
// Items to Display
|
||||
$this->add_control(
|
||||
'items',
|
||||
[
|
||||
'label' => __( 'Items to Display', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '10',
|
||||
]
|
||||
);
|
||||
|
||||
// Columns
|
||||
$this->add_responsive_control(
|
||||
'columns',
|
||||
[
|
||||
'label' => __( 'Columns', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
||||
'options' => [
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6'
|
||||
],
|
||||
|
||||
'desktop_default' => '4',
|
||||
'tablet_default' => '2',
|
||||
'mobile_default' => '1',
|
||||
]
|
||||
);
|
||||
|
||||
// Vertical Spacing
|
||||
$this->add_control(
|
||||
'vertical_spacing',
|
||||
[
|
||||
'label' => esc_html__( 'Vertical Spacing', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 30,
|
||||
],
|
||||
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-services' => 'column-gap: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
// Horizontal Spacing
|
||||
$this->add_control(
|
||||
'horizontal_spacing',
|
||||
[
|
||||
'label' => esc_html__( 'Horizontal Spacing', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 30,
|
||||
],
|
||||
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-services' => 'row-gap: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'padding',
|
||||
[
|
||||
'type' => \Elementor\Controls_Manager::DIMENSIONS,
|
||||
'label' => esc_html__( 'Padding', 'eagle-booking' ),
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => '15',
|
||||
'right' => '15',
|
||||
'bottom' => '15',
|
||||
'left' => '15',
|
||||
'isLinked' => true,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-service-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'background', [
|
||||
'label' => __( 'Background Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-service-item' => 'background: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'border',
|
||||
'label' => esc_html__( 'Border', 'eagle-booking' ),
|
||||
'fields_options' => [
|
||||
'border' => [
|
||||
'default' => 'solid',
|
||||
],
|
||||
'width' => [
|
||||
'default' => [
|
||||
'top' => '1',
|
||||
'right' => '1',
|
||||
'bottom' => '1',
|
||||
'left' => '1',
|
||||
'isLinked' => false,
|
||||
],
|
||||
],
|
||||
'color' => [
|
||||
'default' => '#ededed',
|
||||
],
|
||||
],
|
||||
'selector' => '{{WRAPPER}} .eb-service-item'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'sperator_color', [
|
||||
'label' => __( 'Seperator Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'default' => '#ededed',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-service-item span:after' => 'background: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px'],
|
||||
'default' => [
|
||||
'top' => '4',
|
||||
'right' => '4',
|
||||
'bottom' => '4',
|
||||
'left' => '4',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-service-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Order By
|
||||
$this->add_control(
|
||||
'orderby',
|
||||
[
|
||||
'label' => __( 'Order By', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ID',
|
||||
'options' => [
|
||||
'none' => __( 'None', 'eagle-booking' ),
|
||||
'ID' => __( 'ID', 'eagle-booking' ),
|
||||
'title' => __( 'Title', 'eagle-booking' ),
|
||||
'date' => __( 'Date', 'eagle-booking' ),
|
||||
'rand' => __( 'Random', 'eagle-booking' ),
|
||||
'menu_order' => __( 'Menu Order', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Order
|
||||
$this->add_control(
|
||||
'order',
|
||||
[
|
||||
'label' => __( 'Order', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ASC',
|
||||
'options' => [
|
||||
'ASC' => __( 'ASC', 'eagle-booking' ),
|
||||
'DESC' => __( 'DESC', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Offset
|
||||
$this->add_control(
|
||||
'offset',
|
||||
[
|
||||
'label' => __( 'Offset', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_icon',
|
||||
[
|
||||
'label' => __( 'Icon', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'icon_color', [
|
||||
'label' => __( 'Icon Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-service-item i' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Vertical Spacing
|
||||
$this->add_control(
|
||||
'icon_size',
|
||||
[
|
||||
'label' => esc_html__( 'Size', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 15,
|
||||
],
|
||||
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-service-item i' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_title',
|
||||
[
|
||||
'label' => __( 'Title', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color', [
|
||||
'label' => __( 'Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .eb-service-item .title' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'label' => __( 'Typography', 'eagle-booking' ),
|
||||
'selector' => '{{WRAPPER}} .eb-service-item .title',
|
||||
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
/* Render */
|
||||
protected function render() {
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
$desktop_cols = !empty( $settings['columns'] ) ? $settings['columns'] : 4;
|
||||
$tablet_cols = !empty( $settings['columns_tablet'] ) ? $settings['columns_tablet'] : 3;
|
||||
$mobile_cols = !empty( $settings['columns_mobile'] ) ? $settings['columns_mobile'] : 1;
|
||||
|
||||
// Services QRY
|
||||
$eb_services_qry = array(
|
||||
'post_type' => 'eagle_services',
|
||||
'posts_per_page' => $settings['items'],
|
||||
'orderby' => $settings['orderby'],
|
||||
'order' => $settings['order'],
|
||||
'offset' => $settings['offset']
|
||||
);
|
||||
|
||||
$eb_services_qry = new \WP_Query($eb_services_qry);
|
||||
|
||||
$class = 'eb-g-lg-'.$desktop_cols.' '.'eb-g-md-'.$tablet_cols.' '.'eb-g-sm-'.$mobile_cols;
|
||||
|
||||
?>
|
||||
|
||||
<div class="<?php echo esc_attr( $class ) ?> eb-services">
|
||||
|
||||
<?php
|
||||
|
||||
if ( $eb_services_qry->have_posts() ) : while ( $eb_services_qry->have_posts() ) : $eb_services_qry->the_post();
|
||||
|
||||
$eb_service_id = get_the_ID();
|
||||
|
||||
$service_title = get_the_title( $eb_service_id );
|
||||
|
||||
$eb_service_icon_type = get_post_meta( $eb_service_id, 'eagle_booking_mtb_service_icon_type', true );
|
||||
|
||||
if ( $eb_service_icon_type === 'fontawesome') {
|
||||
|
||||
$eb_service_icon = get_post_meta( $eb_service_id, 'eagle_booking_mtb_service_icon_fontawesome', true );
|
||||
|
||||
} elseif ( $eb_service_icon_type == 'fonticon' ) {
|
||||
|
||||
$eb_service_icon = get_post_meta( $eb_service_id, 'eagle_booking_mtb_service_icon', true );
|
||||
|
||||
} else {
|
||||
|
||||
$eb_service_icon = get_post_meta( $eb_service_id, 'eagle_booking_mtb_service_image', true );
|
||||
}
|
||||
|
||||
$html = '<div class="eb-service-item">';
|
||||
$html .= '<span class="icon">';
|
||||
|
||||
if ( $eb_service_icon_type === 'customicon' ) {
|
||||
|
||||
$html .= '<img src="' .esc_url( $eb_service_icon ).'">';
|
||||
|
||||
} else {
|
||||
|
||||
$html .= '<i class="'. $eb_service_icon. '"></i>';
|
||||
|
||||
}
|
||||
|
||||
$html .= '</span>';
|
||||
|
||||
$html .= '<h5 class="title">'.$service_title.'</h5>';
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
|
||||
echo $html;
|
||||
|
||||
endwhile;
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,394 @@
|
||||
<?php
|
||||
namespace EB_ELEMENTOR_PLUGIN\Widgets;
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Testimonials Elementor Widget
|
||||
* Author: Eagle Themes
|
||||
* Since: 1.0.0
|
||||
---------------------------------------------------------------------------*/
|
||||
class EB_REVIEWS extends Widget_Base {
|
||||
|
||||
/* Retrieve the widget name. */
|
||||
public function get_name() {
|
||||
return 'eb_reviews';
|
||||
}
|
||||
|
||||
/* Retrieve the widget title. */
|
||||
public function get_title() {
|
||||
return __( 'EB Reviews', 'eagle-booking' );
|
||||
}
|
||||
|
||||
/* Retrieve the widget icon. */
|
||||
public function get_icon() {
|
||||
return 'eicon-review';
|
||||
}
|
||||
|
||||
/* Retrieve the list of categories the widget belongs to.*/
|
||||
public function get_categories() {
|
||||
return [ 'eaglebooking' ];
|
||||
}
|
||||
|
||||
/*Retrieve the list of scripts the widget depended on. */
|
||||
public function get_script_depends() {
|
||||
return [ 'core-js', 'core-css' ];
|
||||
}
|
||||
|
||||
/* Register the widget controls. */
|
||||
protected function register_controls() {
|
||||
$this->start_controls_section(
|
||||
'section_layout',
|
||||
[
|
||||
'label' => __( 'Settings', 'eagle-booking' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
// Layout
|
||||
$this->add_control(
|
||||
'layout',
|
||||
[
|
||||
'label' => __( 'Layout', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'grid',
|
||||
'options' => [
|
||||
'grid' => __( 'Grid', 'eagle-booking' ),
|
||||
'carousel' => __( 'Carousel', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
// Items to Display
|
||||
$this->add_control(
|
||||
'items',
|
||||
[
|
||||
'label' => __( 'Items to Display', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '8',
|
||||
]
|
||||
);
|
||||
|
||||
// Columns
|
||||
$this->add_responsive_control(
|
||||
'columns',
|
||||
[
|
||||
'label' => __( 'Columns', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'devices' => [ 'desktop', 'tablet', 'mobile' ],
|
||||
'options' => [
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6'
|
||||
],
|
||||
|
||||
'desktop_default' => '4',
|
||||
'tablet_default' => '2',
|
||||
'mobile_default' => '1',
|
||||
]
|
||||
);
|
||||
|
||||
// Order By
|
||||
$this->add_control(
|
||||
'orderby',
|
||||
[
|
||||
'label' => __( 'Order By', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ID',
|
||||
'options' => [
|
||||
'none' => __( 'None', 'eagle-booking' ),
|
||||
'ID' => __( 'ID', 'eagle-booking' ),
|
||||
'title' => __( 'Title', 'eagle-booking' ),
|
||||
'date' => __( 'Date', 'eagle-booking' ),
|
||||
'rand' => __( 'Random', 'eagle-booking' ),
|
||||
'menu_order' => __( 'Menu Order', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Order
|
||||
$this->add_control(
|
||||
'order',
|
||||
[
|
||||
'label' => __( 'Order', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'ASC',
|
||||
'options' => [
|
||||
'ASC' => __( 'ASC', 'eagle-booking' ),
|
||||
'DESC' => __( 'DESC', 'eagle-booking' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Offset
|
||||
$this->add_control(
|
||||
'offset',
|
||||
[
|
||||
'label' => __( 'Offset', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
// Loop (Carousel)
|
||||
$this->add_control(
|
||||
'loop',
|
||||
[
|
||||
'label' => __( 'Loop', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'True', 'eagle-booking' ),
|
||||
'label_off' => __( 'False', 'eagle-booking' ),
|
||||
'return_value' => 'true',
|
||||
'conditions' => [
|
||||
'terms' => [
|
||||
[
|
||||
'name' => 'layout',
|
||||
'operator' => 'in',
|
||||
'value' => [
|
||||
'carousel',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Navigation (Carousel)
|
||||
$this->add_control(
|
||||
'navigation',
|
||||
[
|
||||
'label' => __( 'Navigation', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => __( 'True', 'eagle-booking' ),
|
||||
'label_off' => __( 'False', 'eagle-booking' ),
|
||||
'return_value' => true,
|
||||
'default' => true,
|
||||
'conditions' => [
|
||||
'terms' => [
|
||||
[
|
||||
'name' => 'layout',
|
||||
'operator' => 'in',
|
||||
'value' => [
|
||||
'carousel',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'bg_color', [
|
||||
'label' => __( 'Background Color', 'eagle-booking' ),
|
||||
'type' => \Elementor\Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .item .testimonial-item' => 'background: {{VALUE}}'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'border',
|
||||
'label' => esc_html__( 'Border', 'eagle-booking' ),
|
||||
'fields_options' => [
|
||||
'border' => [
|
||||
'default' => 'solid',
|
||||
],
|
||||
'width' => [
|
||||
'default' => [
|
||||
'top' => '1',
|
||||
'right' => '1',
|
||||
'bottom' => '1',
|
||||
'left' => '1',
|
||||
'isLinked' => false,
|
||||
],
|
||||
],
|
||||
'color' => [
|
||||
'default' => '#ededed',
|
||||
],
|
||||
],
|
||||
'selector' => '{{WRAPPER}} .item .testimonial-item',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'eagle-booking' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px'],
|
||||
'default' => [
|
||||
'top' => '4',
|
||||
'right' => '4',
|
||||
'bottom' => '4',
|
||||
'left' => '4',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .item .testimonial-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
\Elementor\Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'box_shadow',
|
||||
'label' => esc_html__( 'Box Shadow', 'eagle-booking' ),
|
||||
'selector' => '.item .testimonial-item',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
/* Render */
|
||||
protected function render() {
|
||||
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
$desktop_cols = !empty( $settings['columns'] ) ? $settings['columns'] : 4;
|
||||
$tablet_cols = !empty( $settings['columns_tablet'] ) ? $settings['columns_tablet'] : 3;
|
||||
$mobile_cols = !empty( $settings['columns_mobile'] ) ? $settings['columns_mobile'] : 1;
|
||||
|
||||
$eb_query_args = array(
|
||||
'post_type' => 'eagle_reviews',
|
||||
'posts_per_page' => $settings['items'],
|
||||
'orderby' => $settings['orderby'],
|
||||
'order' => $settings['order'],
|
||||
'offset' => $settings['offset']
|
||||
);
|
||||
|
||||
$eb_review_qry = new \WP_Query($eb_query_args);
|
||||
$eb_unique_token = wp_generate_password(5, false, false);
|
||||
|
||||
$class = '';
|
||||
|
||||
?>
|
||||
|
||||
<?php if ( $settings['layout'] === 'carousel' ) { ?>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
jQuery(function($) {
|
||||
|
||||
var owl = $('#testimonials-<?php echo esc_attr( $eb_unique_token ) ?>');
|
||||
owl.owlCarousel({
|
||||
loop: true,
|
||||
margin: 30,
|
||||
dots: <?php echo $settings['navigation'] ? 'true' : 'false' ?>,
|
||||
nav: false,
|
||||
responsive: {
|
||||
|
||||
0: {
|
||||
items: <?php echo $mobile_cols ?>
|
||||
},
|
||||
|
||||
768: {
|
||||
items: <?php echo $tablet_cols ?>
|
||||
},
|
||||
|
||||
992: {
|
||||
items: <?php echo $desktop_cols ?>
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php if ( $settings['navigation'] != true ) : ?>
|
||||
|
||||
<style>.testimonials .testimonials-owl { padding-left: 0 }</style>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
<?php
|
||||
|
||||
$class .= 'owl-carousel testimonials-owl';
|
||||
|
||||
} else {
|
||||
|
||||
$class = 'eb-g-lg-'.$desktop_cols.' '.'eb-g-md-'.$tablet_cols.' '.'eb-g-sm-'.$mobile_cols;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="testimonials">
|
||||
|
||||
<div id="<?php echo esc_attr( 'testimonials-'.$eb_unique_token ) ?>" class="<?php echo esc_attr( $class ) ?>">
|
||||
<?php
|
||||
|
||||
if ($eb_review_qry->have_posts()): while ($eb_review_qry->have_posts()) : $eb_review_qry->the_post();
|
||||
|
||||
$eb_review_author_name = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_author', true );
|
||||
$eb_review_avatar_file_id = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_image_id', true );
|
||||
$eb_review_avatar = wp_get_attachment_image_url( $eb_review_avatar_file_id);
|
||||
$eb_review_author_location = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_author_location', true );
|
||||
$eb_review_rating = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_rating', true );
|
||||
$eb_review_quote = get_post_meta(get_the_ID(), 'eagle_booking_mtb_review_quote', true );
|
||||
|
||||
?>
|
||||
|
||||
<div class="item">
|
||||
<div class="testimonial-item">
|
||||
<div class="author-img">
|
||||
<img alt="<?php echo esc_html( $eb_review_author_name ) ?>" class="img-fluid" src="<?php echo esc_url( $eb_review_avatar ) ?>">
|
||||
</div>
|
||||
<div class="author">
|
||||
<h4 class="name"><?php echo esc_html( $eb_review_author_name ) ?></h4>
|
||||
<div class="location"><?php echo esc_html( $eb_review_author_location ) ?></div>
|
||||
</div>
|
||||
<div class="rating">
|
||||
<?php
|
||||
|
||||
for( $x = 1; $x <= $eb_review_rating; $x++ ) {
|
||||
|
||||
echo '<i class="fa fa-star voted" aria-hidden="true"></i>';
|
||||
}
|
||||
|
||||
if ( strpos( $eb_review_rating,'.' ) ) {
|
||||
|
||||
echo '<i class="fa fa-star" aria-hidden="true"></i>';
|
||||
|
||||
$x++;
|
||||
}
|
||||
|
||||
while ( $x <= 5 ) {
|
||||
|
||||
echo '<i class="fa fa-star" aria-hidden="true"></i>';
|
||||
|
||||
$x++;
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<p><?php echo esc_html( $eb_review_quote ) ?></p>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endwhile; endif; ?>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user