Skip to content

Instantly share code, notes, and snippets.

View levantoan's full-sized avatar

Lê Văn Toản levantoan

View GitHub Profile
@levantoan
levantoan / [Support-WPML]set_product_category_base_same_shop_base.php
Last active December 15, 2023 07:06
How to set product category base the same as shop base in WooCommerce
<?php
/*
Support WPML - 25/02/2019
/*
function devvn_product_category_base_same_shop_base( $flash = false ){
global $sitepress;
$languages = icl_get_languages('skip_missing=0&orderby=code');
if($languages && !empty($languages)){
$original_lang = ICL_LANGUAGE_CODE;
foreach($languages as $key=>$lang) {
@ms-studio
ms-studio / add-metabox-to-taxonomy.php
Created December 14, 2015 21:57
simple but complete example of adding metabox to taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// REGISTER TERM META
add_action( 'init', '___register_term_meta_text' );
function ___register_term_meta_text() {
@maarten00
maarten00 / pmt.js
Created March 19, 2015 09:56
Excel PMT in PHP and JavaScript
/**
* Copy of Excel's PMT function.
* Credit: http://stackoverflow.com/questions/2094967/excel-pmt-function-in-js
*
* @param rate_per_period The interest rate for the loan.
* @param number_of_payments The total number of payments for the loan in months.
* @param present_value The present value, or the total amount that a series of future payments is worth now;
* Also known as the principal.
* @param future_value The future value, or a cash balance you want to attain after the last payment is made.
* If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
@wpscholar
wpscholar / functions.php
Last active March 1, 2021 13:26
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/