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 | |
/** | |
* WP Search With Algolia autocomplete template file. | |
* Edit by levantoan.com | |
* | |
* @author WebDevStudios <[email protected]> | |
* @since 1.0.0 | |
* | |
* @version 2.5.3 | |
* @package WebDevStudios\WPSWA |
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
/** | |
* 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. |
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 | |
// 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() { |
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 | |
/* | |
* Author: Le Van Toan | |
* Link more update: http://levantoan.com/xoa-bo-category-va-slug-category-cha-khoi-duong-dan-category/ | |
*/ | |
// Remove Parent Category from Child Category URL | |
add_filter('term_link', 'devvn_no_category_parents', 1000, 3); | |
function devvn_no_category_parents($url, $term, $taxonomy) { | |
if($taxonomy == 'category'){ | |
$term_nicename = $term->slug; |
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 | |
// Remove product cat base | |
add_filter('term_link', 'devvn_no_term_parents', 1000, 3); | |
function devvn_no_term_parents($url, $term, $taxonomy) { | |
if($taxonomy == 'product_cat'){ | |
$term_nicename = $term->slug; | |
$url = trailingslashit(get_option( 'home' )) . user_trailingslashit( $term_nicename, 'category' ); | |
} | |
return $url; | |
} |
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 | |
/* | |
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) { |
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
/* | |
web: http://levantoan.com | |
*/ | |
.woocommerce #quantity input::-webkit-outer-spin-button, | |
.woocommerce #quantity input::-webkit-inner-spin-button, | |
.woocommerce #content .quantity input::-webkit-outer-spin-button, | |
.woocommerce #content .quantity input::-webkit-inner-spin-button, .woocommerce-page #quantity input::-webkit-outer-spin-button, | |
.woocommerce-page #quantity input::-webkit-inner-spin-button, | |
.woocommerce-page #content .quantity input::-webkit-outer-spin-button, |
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 | |
/* | |
* Code Bỏ /product/ hoặc /cua-hang/ hoặc /shop/ ... có hỗ trợ dạng %product_cat% | |
* Thay /cua-hang/ bằng slug hiện tại của bạn | |
*/ | |
function devvn_remove_slug( $post_link, $post ) { | |
if ( !in_array( get_post_type($post), array( 'product' ) ) || 'publish' != $post->post_status ) { | |
return $post_link; | |
} | |
if('product' == $post->post_type){ |
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 | |
/* | |
Array | |
( | |
[name] => Array | |
( | |
[0] => 0as | |
[1] => 1as | |
[2] => 2as | |
[3] => 3as |
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 | |
/*instagram shortcode | |
* Get access_token to http://instagram.pixelunion.net/ | |
* Or place [CLIENT_ID_HERE] to your Client ID => https://instagram.com/oauth/authorize/?client_id=[CLIENT_ID_HERE]&redirect_uri=http://localhost&response_type=token | |
Used: [instagram_widget access_token="_Your Access Token_" show="20"] | |
by: www.levantoan.com | |
* */ | |
function scrape_instagram($access_token = '', $slice = 20, $type = "image") { |
NewerOlder