Skip to content

Instantly share code, notes, and snippets.

@10h30
10h30 / functions.php
Created February 4, 2017 14:01
Quận / Huyện Việt Nam for Woocommerce
add_filter('wc_city_select_cities', 'my_cities');
/**
* Replace XX with the country code. Instead of YYY, ZZZ use actual state codes.
*/
function my_cities($cities)
{
$cities['VN'] = array(
'AN-GIANG' => array(
'Huyện An Phú',
@10h30
10h30 / mirotik-vietnam-ip-address-list
Created September 27, 2021 12:45
Tạo Address List cho Dải IP Việt Nam trên Mikrotik RouterOS
/ip firewall address-list
add address=1.52.0.0/14 comment=VN list="Vietnam IP List"
add address=2.56.16.0/22 comment=VN list="Vietnam IP List"
add address=2.59.0.0/23 comment=VN list="Vietnam IP List"
add address=5.198.248.176/28 comment=VN list="Vietnam IP List"
add address=14.0.16.0/20 comment=VN list="Vietnam IP List"
add address=14.160.0.0/11 comment=VN list="Vietnam IP List"
add address=14.224.0.0/11 comment=VN list="Vietnam IP List"
add address=17.81.39.0/24 comment=VN list="Vietnam IP List"
add address=17.81.60.0/24 comment=VN list="Vietnam IP List"
@10h30
10h30 / acme.sh
Last active March 14, 2022 13:27
#!/usr/bin/env sh
VER=3.0.2
PROJECT_NAME="acme.sh"
PROJECT_ENTRY="acme.sh"
PROJECT="https://github.com/acmesh-official/$PROJECT_NAME"
@10h30
10h30 / pfsense-vietnam-ip-list
Created October 26, 2021 03:49
Danh sách IP Việt Nam dùng để tạo Aliases trên pfSense
1.52.0.0/14 Vietnam
2.56.16.0/22 Vietnam
2.59.0.0/23 Vietnam
5.198.248.176/28 Vietnam
14.0.16.0/20 Vietnam
14.160.0.0/11 Vietnam
14.224.0.0/11 Vietnam
17.81.39.0/24 Vietnam
17.81.60.0/24 Vietnam
17.81.145.0/24 Vietnam
@10h30
10h30 / netflix-ip-list
Last active September 29, 2021 23:52
Netflix IP Address List
/ip firewall address-list
add address=23.246.0.0/18 comment=Netflix list="Netflix IP List"
add address=23.246.2.0/24 comment=Netflix list="Netflix IP List"
add address=23.246.3.0/24 comment=Netflix list="Netflix IP List"
add address=23.246.6.0/24 comment=Netflix list="Netflix IP List"
add address=23.246.7.0/24 comment=Netflix list="Netflix IP List"
add address=23.246.10.0/24 comment=Netflix list="Netflix IP List"
add address=23.246.11.0/24 comment=Netflix list="Netflix IP List"
add address=23.246.12.0/24 comment=Netflix list="Netflix IP List"
add address=23.246.13.0/24 comment=Netflix list="Netflix IP List"
add_filter('wp_get_attachment_image_attributes', 'change_attachement_image_attributes', 20, 2);
function change_attachement_image_attributes( $attr, $attachment ){
// Get post parent
$parent = get_post_field( 'post_parent', $attachment);
// Get post type to check if it's product
$type = get_post_field( 'post_type', $parent);
if( $type != 'product' ){
return $attr;
@10h30
10h30 / functions.php
Last active May 20, 2019 12:41
Woocommerce DYMO Print - Print custom field of variation products
//Tested on ycb.vn
function filter_wc_dymo_product($output,$object,$product,$variation,$labelID) {
if($labelID=='product') {
if(!empty($variation)) {
$barcode = get_post_meta( $variation->get_id(), '_barcode', true );
} else {
$barcode = get_post_meta( $product->get_id(), '_barcode', true );
}
$output[0]['BARCODE'] = $barcode;
@10h30
10h30 / year-archive-template.php
Created October 16, 2018 08:23 — forked from bradonomics/year-archive-template.php
Genesis Page Template displaying posts by year. Inspired by Alex Sexton's blog archives: https://alexsexton.com/blog/archives/ and built using code modified from Joe Mar Aparecio: http://www.joemaraparecio.com/customizing-genesis-archive-template-display-posts-month/
<?php
/**
*
* Custom Blog Loop for Bradonomics.
*
* Template Name: Bradonomics Blog
*
*/
//* Remove standard post content output
@10h30
10h30 / functions.php
Created May 16, 2018 07:33 — forked from srikat/functions.php
Testimonials Carousel in WordPress using Testimonials by WooThemes, Display Posts Shortcode and Slick jQuery. http://sridharkatakam.com/testimonials-carousel-wordpress-using-testimonials-woothemes-display-posts-shortcode-slick-jquery/
//* Enqueue scripts and styles
add_action( 'wp_enqueue_scripts', 'enqueue_custom_scripts_styles' );
function enqueue_custom_scripts_styles() {
wp_enqueue_style( 'dashicons' );
wp_enqueue_style( 'slick-styles', get_stylesheet_directory_uri() . '/css/slick.css' );
wp_enqueue_style( 'slick-theme-styles', get_stylesheet_directory_uri() . '/css/slick-theme.css' );
wp_enqueue_script( 'slick-js', get_stylesheet_directory_uri() . '/js/slick.min.js', array( 'jquery' ), '1.3.15', true );
@10h30
10h30 / functions.php
Created May 30, 2017 16:57 — forked from anonymous/functions.php
Change the number of products per row in WooCommerce
// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
function loop_columns() {
return 3; // 3 products per row
}
}