Skip to content

Instantly share code, notes, and snippets.

View Jeff2Ma's full-sized avatar

Jeff Ma Jeff2Ma

View GitHub Profile
<!--
iOS Web App Basic Html Code.
Url:http://devework.com/ios-7-web-app.html
Thanks: https://gist.github.com/tfausak/2222823
-->
<!--meta tag-->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
@Jeff2Ma
Jeff2Ma / woocommerce-featured-products.php
Last active August 26, 2021 00:29
woocommerce featured products
@Jeff2Ma
Jeff2Ma / change_default_price_html.php
Created July 18, 2014 14:51
change woocommerce defalut price html code
<?php
// DeveWork.com
//这是一个可以修改woocommerce_get_price_html 函数默认输出的html代码的例子,
//作用是调换新旧价格的位置
//感谢http://wordpress.stackexchange.com/questions/83367/how-to-edit-the-get-price-html-on-woocommerce
add_filter( 'woocommerce_get_price_html', 'dw_change_default_price_html', 100, 2 );
function dw_change_default_price_html( $price,$product ){
if ( $product->price > 0 ) {
@Jeff2Ma
Jeff2Ma / Support PayPal GateWay in woocommerce.php
Last active August 28, 2022 12:07
Support PayPal GateWay in woocommerce【让woocommerce中文网关支持paypal并自动转换人民币美元转换】
<?php
//woocommerce中文网关支持paypal
// details at http://devework.com/support-paypal-gateway-in-woocommerce.html
//本函数解决的问题:贝宝不支持你的商铺货币。Gateway Disabled: PayPal does not support your store's currency.
add_filter( 'woocommerce_paypal_supported_currencies', 'enable_custom_currency' );
function enable_custom_currency($currency_array) {
$currency_array[] = 'CNY';
return $currency_array;
}
@Jeff2Ma
Jeff2Ma / woocommerce-custom-override-checkout-fields.php
Created July 30, 2014 05:59
woocommerce-custom-override-checkout-fields
<?php
//以下用部分代码演示hook ‘woocommerce_checkout_fields’ 这个函数
//参考文章:http://devework.com/woocommerce-custom-override-checkout-fields.html
//删除结算页面上多余的表单元素(fields)
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
//unset($fields['order']['order_comments']);
unset( $fields['billing']['billing_country'] );
@Jeff2Ma
Jeff2Ma / Javascript-chinese-unicode.html
Created August 12, 2014 15:30
Javascript 汉字编码转换
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.btn{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
<?php
/**
* Plugin Name: WooCommerce Subscriptions Product Removed Message
* Description: Display a notice on checkout when a product was removed from the cart after a subscription was added.
* Author: Gerhard Potgieter & Brent Shepherd
* Author URI:
* Version: 1.1
* License: GPL v2
*/
@Jeff2Ma
Jeff2Ma / test1.php
Created September 9, 2014 13:10
测试是否为5.3,5.4、支持zend 组件否、支持一些php 函数否 的代码
<?php
//测试是否为5.3,5.4、支持zend 组件否、支持一些php 函数否
//原始来源 http://www.smyx.net/
$funs_list = array('close_curl', 'close_fopen', 'close_http', 'file_get_contents', 'zend_loader_enabled');
if (!function_exists('close_curl')) {
function close_curl() {
if (!extension_loaded('curl')) {
return " <span style=\"color:blue\">请在php.ini中打开扩展extension=php_curl.dll</span>";
@Jeff2Ma
Jeff2Ma / test2.php
Created September 9, 2014 13:11
测试是否为5.2-5.4、支持zend 组件否、支持一些php 函数否 的代码
<?php
//验证是否为5.2、5.3、5.4 、支持zend 组件否、支持一些php 函数否
//原始来源 http://www.smyx.net/
$funs_list = array('close_curl', 'close_fopen', 'close_http', 'file_get_contents', 'zend_loader_enabled');
if (!function_exists('close_curl')) {
function close_curl() {
if (!extension_loaded('curl')) {
return " <span style=\"color:blue\">请在php.ini中打开扩展extension=php_curl.dll</span>";
@Jeff2Ma
Jeff2Ma / functions.php
Last active August 29, 2015 14:06 — forked from kloon/functions.php
<?php
// Add the code below to your theme's functions.php file to add a confirm password field on the register form under My Accounts.
add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3);
function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
}