Skip to content

Instantly share code, notes, and snippets.

@furahaclothing
furahaclothing / tracking
Created March 2, 2014 13:30
荷物トラッキングの検索
<?php
//エラー処理
$kaisha = (!isset($_POST['kaisha'])) ? null : $kaisha = $_POST['kaisha'];
$denpyou = (!isset($_POST['denpyou'])) ? null : $denpyou = $_POST['denpyou'];
$submit = (!isset($_POST['submit'])) ? null : $submit = $_POST['submit'];
//URL設定
//クロネコヤマト
$url['1'] = "http://jizen.kuronekoyamato.co.jp/jizen/servlet/crjz.b.NQ0010?id=".$denpyou;
//佐川急便
$url['2'] = "http://k2k.sagawa-exp.co.jp/p/web/okurijosearch.do?okurijoNo=".$denpyou;
@furahaclothing
furahaclothing / gist:9306656
Created March 2, 2014 13:37
wp-customer-reviewの平均評価、総評価数
/*add before get_aggregate_reviews($pageID) */
function get_average_rating() {
global $post;
$this->get_aggregate_reviews($post->ID);
$average_score = number_format($this->got_aggregate["aggregate"], 1);
return $average_score * 20; // 20% for each star if having 5 stars
}
/*do_the_content($original_content), just after $the_content = ''; add the following:*/
@furahaclothing
furahaclothing / gist:9504574
Created March 12, 2014 10:46
荷物追跡サービスのフォーム
<script type="text/javascript">
<!--
function data_in(){
//フォームデータ入力用変数
var denpyou;
var kaisha;
var url;
url = new Array();
@furahaclothing
furahaclothing / gist:bba575c6fcce4243d8ab
Created May 7, 2014 10:31
welcart消費税別にした際、合計金額に消費税を足す
//総合計金額をフィルター
add_filter('usces_filter_set_cart_fees_total_full_price', 'my_filter_set_cart_fees_total_full_price', 10, 6);
function my_filter_set_cart_fees_total_full_price(){
global $usces;
$args = func_get_args();
$tax = $usces->getTax( $args[1] );
$total_full_price = $args[1] + $tax + $args[2] + $args[3] + $args[4] + $args[5];
@furahaclothing
furahaclothing / gist:a9ba180de54891e02d8f
Created June 4, 2014 13:54
wordpress-twitter card
<meta name="twitter:card" value="summary" />
<meta name="twitter:url" value="<?php echo get_permalink(); ?>" />
<meta name="twitter:title" value="<?php echo get_the_title(); ?>" />
<meta name="twitter:description" value="<?php echo get_the_excerpt(); ?>" />
<meta name="twitter:image" value="<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>" />
<meta name="twitter:site" value="@twitter_account" />
<meta name="twitter:domain" content="your URL"/>
<meta name="twitter:creator" value="@twitter_account" />
<meta name="twitter:card" content="product">
<meta name="twitter:site" content="@twitter_account">
<meta name="twitter:creator" content="@twitter_account">
<meta name="twitter:title" content="<?php usces_the_itemName(); ?>">
<meta name="twitter:description" content="<?php echo get_post_meta($post->ID ,'wccs_詳細' ,true); ?>">
<meta name="twitter:image" content="<?php usces_the_itemImageURL(0); ?>">
<meta name="twitter:data1" content="<?php usces_crform(usces_the_firstPrice('return'),true, false); ?>">
<meta name="twitter:label1" content="Price">
<meta name="twitter:data2" content="<?php echo get_post_meta($post->ID , 'wccs_サイズ' ,true); ?>">
<meta name="twitter:label2" content="Size">
@furahaclothing
furahaclothing / gist:71591dcffed7e498e162
Created July 13, 2014 07:13
welcart クーポン機能 *エラー表示検証する*
//welcart クーポンコード
add_filter('usces_order_discount', 'coupon_order_discount', 10, 2);
function coupon_order_discount($discount, $cart){
global $usces;
$entry = $usces->cart->get_entry();
$total_items_price = $usces->get_total_price();
if($entry['custom_order']['coupon'] == 'クーポンコード'){
$discount = ceil($total_items_price * 0.1 * -1);
}
return $discount;
@furahaclothing
furahaclothing / opacity
Created August 10, 2012 03:53
透過(opacity)
div#hoge a:hover img
{
opacity:0.8;
filter: alpha(opacity=80);
-ms-filter: "alpha( opacity=80 )";
background: #fff;
}
@furahaclothing
furahaclothing / single.php
Created August 10, 2012 04:06
single.phpに同じカテゴリー内の別の記事をランダム表示
<?php $cat = get_the_category(); $cat = $cat[0]; ?>
<?php $bk_wp_query = clone $wp_query; ?>
<?php queryposts( array('cat' => $cat->cat_ID, 'showposts' => 5,
'orderby' => 'rand', 'post_not_in' => array($post->ID)) ); ?>
<?php while (have_posts()) : the_post(); ?>
"><?php the_title(); ?>
div.kadomaru {
border-radius: 20px; /* CSS3 */
-moz-border-radius: 20px; /* Firefox */
-webkit-border-radius: 20px; /* Safari,Chrome */
border: 3px green solid; /* border */
background-color: #ccffcc; /* background */
}