Skip to content

Instantly share code, notes, and snippets.

View kutoi94's full-sized avatar
🏠
Working from home

Luan DANG kutoi94

🏠
Working from home
View GitHub Profile
@kutoi94
kutoi94 / mb-hotel-management.php
Created February 28, 2020 13:28
Management Hotel Plugin
<?php
/**
* Plugin Name: Management Hotel
* Plugin URI:
* Description: You can manage hotel reservations inside your WordPress dashboard with full calendar view.
* Version: 1.0
* Author: Dev WordPress
* Author URI:
* License: GPLv2 or later
*/
@kutoi94
kutoi94 / plugin.js
Last active March 11, 2020 02:20
Manager Hotel by Metabox and Fullcalendar
$.ajax({
type: 'post',
url: ajaxurl,
data: {action: 'feed_events'},
error: function(err){
console.log(err);
},
success: function (data)
{
@kutoi94
kutoi94 / function.php
Created January 16, 2020 08:59
Part 3 Tạo và quản lí khách sạn với metabox plugin
if(!get_option('rwmb_bookings')){
add_option('rwmb_bookings', array());
}
add_action( 'rwmb_booking-fields_after_save_post', 'update_bookings_date' );
@kutoi94
kutoi94 / single-room.php
Created January 10, 2020 08:35
Part 3 Series: Tạo và quản lý đặt phòng khách sạn với Meta Box
<?php get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', 'single' );
the_post_navigation();
echo do_shortcode("[mb_frontend_form id='booking-fields' post_fields='title,content']");
if ( comments_open() || get_comments_number() ) :
@kutoi94
kutoi94 / functions.php
Created January 10, 2020 08:33
Part 3 Series: Tạo và quản lý đặt phòng khách sạn với Meta Box
<?php
/**
* Just Read functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Justread
*/
if ( ! function_exists( 'justread_setup' ) ) :
@kutoi94
kutoi94 / custom.js
Created January 10, 2020 08:32
Part 3 Series: Tạo và quản lý đặt phòng khách sạn với Meta Box
jQuery( function($) {
setTimeout(function(){
datepicker_reinstall();
console.log(disable_dates);
}, 1000);
function datepicker_reinstall(){
var dateFormat = "yy-mm-dd",
from = $( "#group_booking_check_in" ),
to = $( "#group_booking_check_out" );
@kutoi94
kutoi94 / booking.js
Last active November 18, 2019 02:56
Tính giá tiền, phòng khách sạn
jQuery( document ).ready( function( $ ) {
$('.group-bookings .add-clone').on('click', function(e){
setTimeout(function(){
var rooms = $('.group-bookings .rwmb-group-clone').length;
$('input#amount').val(rooms);
update_js();
}, 100);
});
@kutoi94
kutoi94 / single-product.php
Created September 25, 2019 12:36
Create dynamic favicon with Meta Box Plugin
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Justread
*/
get_header(); ?>
<?php
/*
* Template Name: My Account
*/
?>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<?php
@kutoi94
kutoi94 / publish-post.php
Created September 16, 2019 03:03
Full source code publish-post.php
<?php
/*
* Template Name: Publish Post
*/
if ( !is_user_logged_in() ) {
auth_redirect();
}