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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
<pre> | |
<small> | |
<?php | |
$cf = get_post_custom($post->ID); | |
print_r($cf); | |
?> | |
</small> | |
</pre> |
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 | |
function seed_login_redirect(){ | |
global $pagenow; | |
if('wp-login.php' == $pagenow) { | |
if(isset($_POST['wp-submit']) || // in case of LOGIN | |
(isset($_GET['action']) && $_GET['action']=='logout') || // in case of LOGOUT | |
(isset($_GET['checkemail']) && $_GET['checkemail']=='confirm') || // in case of LOST PASSWORD | |
(isset($_GET['checkemail']) && $_GET['checkemail']=='registered')) return; // in case of REGISTER | |
else wp_redirect(home_url('/account/')); // or wp_redirect(home_url('/login')); |
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
RewriteEngine On | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] |
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 | |
if( have_rows($brand_slug) ): | |
$i = 1; | |
while( have_rows($brand_slug) ): | |
the_row(); | |
$cat = $brand_slug . '-cat'; | |
$term = get_sub_field($cat); | |
?> | |
<div class="tab-products"> |
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 | |
/** | |
* Enqueue scripts and styles. | |
*/ | |
function fruit_scripts() { | |
wp_dequeue_style( 'seed-style'); | |
wp_enqueue_style( 'fruit-css', get_stylesheet_directory_uri() . '/style.css', array(), filemtime( get_stylesheet_directory() . '/style.css' ) ); | |
wp_enqueue_script( 'fruit-js', get_stylesheet_directory_uri() . '/js/main.js', array(), '2017-1', true ); |
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 | |
ติดตั้ง Woocommerce php sdk โดยใช้คำสั่งด้านล่างนี้ (ใช้ Command ในการตัดตั้ง) | |
// composer require automattic/woocommerce | |
// Setup: | |
require __DIR__ . '/vendor/autoload.php'; | |
use Automattic\WooCommerce\Client; | |
function wc_init() { |
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 | |
/* Custom Thai Province Order */ | |
if (get_locale() == 'th') { | |
add_filter( 'woocommerce_states', 'seed_woocommerce_states' ); | |
} | |
function seed_woocommerce_states( $states ) { | |
$states['TH'] = array( | |
'TH-81' => 'กระบี่', | |
'TH-10' => 'กรุงเทพมหานคร', | |
'TH-71' => 'กาญจนบุรี', |
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
// ใส่ CSS สำหรับแสดงผล Mobile เช่น | |
.test { | |
font-size: 12px; | |
} | |
@media (min-width: 768px) { | |
// โค้ด CSS สำหรับจอ iPad แนวตั้ง เช่น | |
.test { | |
font-size: 14px; | |
} |
OlderNewer