Skip to content

Instantly share code, notes, and snippets.

@furahaclothing
furahaclothing / gist:8574355
Created January 23, 2014 07:22
構造化データリッチスニペット for wordpress
<-- Fixing Warning: Missing required field “entry-title”-->
<h1 class="entry-title"><?php the_title(); ?></h1>
<-- Fixing Warning: Missing required field “updated” -->
<span class="date updated"><?php the_time(); ?></span>
<-- Fixing Warning: Missing required hCard “author” -->
<span class="vcard author">
<span class="fn"><?php the_author(); ?></span>
</span>
@furahaclothing
furahaclothing / jquery.countdown.css
Last active December 31, 2015 03:19
jQuery'countdown'プラグインをwordpressで使う 2013.12.31.23:59:59までカウント。過ぎると、HAPPY NEW YEARのテキスト
<?php
wp_deregister_script('jquery');
wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), '1.7.1');
?>
<?php wp_enqueue_script('countdown',get_bloginfo('template_url') . '/countdown/jquery.countdown.js', array('jquery'), '1.0'); ?>
<?php wp_enqueue_script('countdown',get_bloginfo('template_url') . '/countdown/jquery.countdown-ja.js', array('jquery'), '1.0'); ?>
<?php wp_enqueue_style('countdown',get_bloginfo('template_url') . '/countdown/jquery.countdown.css'); ?>
<?php wp_head(); ?>
<script type="text/javascript">
jQuery(function() {
@furahaclothing
furahaclothing / index.php
Created December 9, 2013 05:14
facebook APP(いいね限定ページ)の作成
<?php
include 'signed_request.php';
if (isset($_POST['signed_request']) ) {
$fb_data = parse_signed_request($_POST['signed_request'], 'シークレットキー');
if ($fb_data) {
if( $fb_data['page']['liked'] ){
include 'fan.php';
}
else {
include 'not-fan.php';
@furahaclothing
furahaclothing / gist:7806979
Created December 5, 2013 15:14
welcart デフォルトテンプレート archive.php
<?php
get_header();
?>
<div id="content" class="two-column">
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h1 class="pagetitle"><?php printf( __( 'Category Archives: %s', 'uscestheme' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
@furahaclothing
furahaclothing / gist:7800218
Last active December 30, 2015 08:08
welcart商品のソート(並び替え) 新着・ランダム・価格(カスタムフィールド名:price)
<form name="irekae" method="get" id="sort_form5" class="sort_form5">
<select name='narabi' onChange="document.forms['irekae'].submit()" >
<option value="sort1"<?php if(!isset($_REQUEST['narabi']) || $_REQUEST['narabi'] == 'sort1') echo ' selected="selected"';?>>新しい順</option>
<option value="sort2"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort2') echo ' selected="selected"';?>>古い順</option>
<option value="sort3"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort3') echo ' selected="selected"';?>>価格:安い順</option>
<option value="sort4"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort4') echo ' selected="selected"';?>>価格:高い順</option>
<option value="sort5"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort5') echo ' selected="selected"';?>>ランダム</option>
<option value="sort6"<?php if(isset($_REQUEST['narabi']) && $_REQUEST['narabi'] == 'sort6') echo ' selected="selected"';
@furahaclothing
furahaclothing / gist:7512646
Last active December 28, 2015 14:09
wordpressでカテゴリー一覧ページでループ出力(タイトル・サムネイル・カテゴリーリンク)
<?php
global $post;
$tmp_post = $post;
$category_ids = array( '29','33','34','85','113','32','28','43','30','31','114');//カテゴリーID
$numberposts = '4';//投稿数
foreach ( $category_ids as $category_id ) {
?>
/*カテゴリー名*/
<?php echo get_cat_name( $category_id ); ?>
<span class="sub"><a href="<?php echo get_category_link( $category_id ); ?>"><?php _e('see all', 'usces'); ?> &raquo;</a></span>
@furahaclothing
furahaclothing / gist:7367376
Last active December 27, 2015 18:09
jQueryでオリジナルSNS(twitter.facebook)ボタン(カウンター付)
//headerにjQuery
<?php
wp_deregister_script('jquery');
wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), '1.7.1');
?>
//js
<script type="text/javascript">
$(function(){
var link_src = location.href;
@furahaclothing
furahaclothing / gist:7298950
Created November 4, 2013 06:51
jQuery Drop Down Mega Menu/css
/* Reset code to remove theme inherent styling */
#dc_jqmegamenu_widget-%ID%-item ul.menu ul, #dc_jqmegamenu_widget-%ID%-item ul.menu li {
list-style: none;
padding: 0;
margin: 0;
}
#dc_jqmegamenu_widget-%ID%-item ul.menu ul {
display: none; /* Hides non-mega links */
}
#dc_jqmegamenu_widget-%ID%-item ul.menu .sub ul {
@furahaclothing
furahaclothing / gist:6804799
Created October 3, 2013 04:05
wordpress イベントカレンダーをカスタムポストで出力
function my_get_calendar($yearmonth = ''){
global $m;
$m = isset($_GET['ym']) ? $_GET['ym'] : $yearmonth; // 前後月リンク対応
// $m = $yearmonth; // 'YYYYMM' の書式でカレンダーの年月を指定
ob_start();
get_calendar();
$output = ob_get_contents();
ob_end_clean();
@furahaclothing
furahaclothing / gist:5779853
Created June 14, 2013 06:23
welcart-金額部分にSOLD(在庫)を表示-
<?php if( !usces_have_zaiko() ) : ?>
<div class="field_price"><?php echo apply_filters('usces_filters_single_sku_zaiko_message', __('Sold Out', 'usces')); ?></div>
<?php else : ?>
<div class="field_price"><?php usces_the_itemPriceCr(); ?></div>
<?php endif; ?>