This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Grid container. Based on Bootstrap 4. | |
* | |
* Partially works. No offset support. | |
*/ | |
.grid-container { | |
display: grid; | |
grid-template-columns: repeat($grid-columns, 1fr); | |
margin: 0 auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use \WP_Query; | |
$categories = get_categories( ['parent' => 0] ); | |
$ids = array_map( function( $category ) { | |
return $category->term_id; | |
}, $categories); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get timestamp | |
$date_string = 'June 19, 2020'; | |
$timestamp = strtotime( $date_string ); | |
// Get weekday for given date | |
// Return 0-6 for Sun to Sat | |
$weekday = date( 'w', $timestamp ); | |
// Calculate first and last date of given week |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', function() { | |
// Header will contains HTTP_TRUE_CLIENT_IP if accessing via Akamai | |
if( isset( $_SERVER['HTTP_TRUE_CLIENT_IP'] ) ) { | |
ob_start( function( $output ) { | |
return str_replace( 'wpengineurl.com', 'realdomain.com/sub' $output ); | |
} ); | |
} | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ประกาศตัวแปรรอทิ้งไว้ จริงๆ ใช้ $data อันเดียวก็ได้ แล้ว map ทับเอา | |
$raw = []; | |
$data = []; | |
// ข้อมูลตัวอย่าง | |
$timein = [ | |
[ | |
'id' => 100287, | |
'date' => '2020-02-26', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('.my-form').on('submit', (e) => { | |
e.preventDefault(); | |
let form = e.target; | |
let formData = new FormData( form ); | |
let userdata_access_token = getUserdataAccessToken(); | |
// ถ้าต้องการเพิ่มข้อมูล ใช้ .append ได้เลย | |
formData.append('userdata_access_token', userdata_access_token); | |
// แล้วเอา formData ส่งไปเป็น data ของ $.ajax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let products = [ | |
{ | |
id: 1, | |
quantity: 10, | |
}, | |
{ | |
id: 2, | |
quantity: 2, | |
} | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let products = [ | |
{ | |
id: 1, | |
quantity: 10, | |
}, | |
{ | |
id: 2, | |
quantity: 2, | |
} | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// define options with chance weight | |
$choices = [ | |
'a' => 10.50, | |
'b' => 30, | |
'c' => 24.50, | |
'd' => 35, | |
]; | |
$total = array_sum( $choices ); // total chance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '@nobleclem/jquery-multiselect'; | |
export default () => { | |
let FormElement = $('.content-form__form-wrapper'); | |
if ( FormElement.length ) { | |
let FormId = FormElement.attr('data-form-id'), | |
FormHtml = $('<div />').append(FormElement.clone()).html(); | |
$(document).on('gform_confirmation_loaded', function() { |
NewerOlder