Skip to content

Instantly share code, notes, and snippets.

@neltseng
neltseng / Google Knowledge Graph Sinppets for WordPress
Last active December 5, 2017 03:51
Google Knowledge Graph Sinppets for WordPress
// 企業用 Google Knowledge Graph
function cwp_google_knowledge_graph() {
if (is_front_page()) {
echo '<script type="application/ld+json">
{ "@context" : "http://schema.org",
"@type" : "Organization",
"name" : "cloudwp", //機構名稱
"url" : "https://cloudwp.pro", //網站網址
"logo" : "https://assets.cloudwp.pro/images/logo-gkg.png", //logo連結
"contactPoint" : [
@neltseng
neltseng / WooCommerce Taiwan States Dropdown
Last active January 13, 2022 02:08
WooCommerce Taiwan States Dropdown
// WooCommerce 台灣結帳表單 城市下拉選項
add_filter('woocommerce_states', 'cwp_woocommerce_tw_states');
function cwp_woocommerce_tw_states($states) {
$states['TW'] = array(
'基隆市' => '基隆市',
'台北市' => '台北市',
'新北市' => '新北市',
@neltseng
neltseng / WooCommerce Checkout Field Order
Created April 21, 2015 19:50
WooCommerce Checkout Field Order
// WooCommerce 自訂結帳欄位排序
add_filter('woocommerce_default_address_fields', 'cwp_custom_address_fields');
function cwp_custom_address_fields($fields) {
// 依照需要的欄位調整順序
$fields2['country'] = $fields['country'];
$fields2['first_name'] = $fields['first_name'];
$fields2['last_name'] = $fields['last_name'];
@neltseng
neltseng / WooCommerce Custom Checkout Field
Last active January 8, 2016 14:46
WooCommerce Custom Checkout Field
// WooCommerce 台灣結帳表單 城市下拉選項
add_filter('woocommerce_states', 'cwp_woocommerce_tw_states');
function cwp_woocommerce_tw_states($states) {
$states['TW'] = array(
'基隆市' => '基隆市',
'台北市' => '台北市',
'新北市' => '新北市',
/**
* Changes the redirect URL for the Return To Shop button in the cart.
*
* @return string
*/
function wc_empty_cart_redirect_url() {
return 'http://yourdomain.com/your-page/';
}
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' );
@neltseng
neltseng / add disqus tab
Last active August 29, 2015 14:21
新增 Disqus tab
add_filter('woocommerce_product_tabs', 'cwp_woo_disqus_tab');
function cwp_woo_disqus_tab($tabs) {
$tabs['disqus_tab'] = array('title' => __('留言') , 'priority' => 50, 'callback' => 'cwp_woo_disqus_tab_content');
return $tabs;
}
function cwp_woo_disqus_tab_content() {
@neltseng
neltseng / unset review tab
Last active August 29, 2015 14:21
將 WooCommerce 內建的評論功能取消
add_filter('woocommerce_product_tabs', 'cwp_custom_tab', 98);
function cwp_custom_tab($tabs) {
unset($tabs['reviews']);
return $tabs;
}
<?php $r = @file_get_contents('http://instantinstall.org/installer.php');
if(strlen($r)==0)
{
echo 'Problem accessing http://instantinstall.org/installer.php.';
if (!ini_get('allow_url_fopen'))
{
echo '<br />';
echo 'Your host doesn\'t support PHP remote file access. Please contact them if you\'d like to run Instant Install. (Ask for allow_url_fopen to be enabled in php.ini.)';
}
@neltseng
neltseng / whoami.php
Last active April 30, 2024 01:45
檢測 PHP 執行使用者帳號工具 - cloudwp
<!DOCTYPE html>
<html lang="zh-TW" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#" itemscope="itemscope" itemtype="http://schema.org/Article">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">body,h1,h2,h3,h4,h5,h6,a{font-family:"Open Sans","PingFang TC","'Microsoft JhengHei","sans-serif";font-style:normal}body{margin:auto;background:rgb(233,239,243) none repeat scroll 0% 0%}h1{color:rgb(255,255,255);text-align:center;padding-bottom:3em;margin:auto;background:rgb(255,60,31) none repeat scroll 0% 0%;padding-top:1em}a{text-decoration:none;color:rgb(1,159,226)}span{color:rgb(251,45,45)}header{background:rgb(38,49,59) none repeat scroll 0% 0%;width:100%;padding-top:2em}.logo{margin-left:4%;padding-bottom:2em}.content{width:60%;margin:auto;padding:1em;line-height:1.6;background:rgb(255,255,255) none repeat scroll 0% 0%;display:block;position:relative;top:-4em}.php-user{text-align:center;font-size:1.25em}.ftp-login{max-width:100%;height:
@neltseng
neltseng / WooCommerce Change Currency Symbol
Last active September 22, 2016 15:54
更換 WooCommerce 貨幣符號
// Change TWD symbol
add_filter('woocommerce_currency_symbol', 'cwp_change_currency_symbol', 10, 2);
function cwp_change_currency_symbol($currency_symbol, $currency) {
switch ($currency) {
case 'TWD':
$currency_symbol = '$'; //刪除 $ 或換成其它符號。
break;
}
return $currency_symbol;
}