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
/** | |
* wordpressのcustom-headerの画像でカルーセル作る | |
* 画像1枚しか選択されてない場合はimgタグ出力 | |
*/ | |
function custom_header_carousel() { | |
/** | |
* register_default_headersの値、ヘッダー未設定の場合はNULL | |
* @type Array | |
*/ |
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
var fs = require('fs'), | |
del = require('del'); | |
gulp.task('clean', function(done) { | |
var files = fs.readdirSync('dist'); | |
var targets = []; | |
if(files.length) { | |
targets.push('dist/*'); |
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
/** | |
* カテゴリー一覧で表示されている記事のカスタムフィールドの値を得る | |
* @return Array カスタムフィールド値の配列 | |
*/ | |
function get_category_custom_field($cat_id) { | |
global $wpdb; | |
$meta_key = 'your_custom_field_key'; | |
$limit = get_option('posts_per_page'); | |
$offset = get_query_var('paged') * $limit; |
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
function duration(str) { | |
var matches = str.match(/PT(\d*)H*(\d+)M*(\d+)S*/i); | |
var d = (matches[1] && matches[1] + ':'); //hour | |
d += (matches[1] && matches[2] < 10 ? '0' : '') + (matches[2] && matches[2] + ':'); //min | |
d += (matches[3] && matches[3] < 10 ? '0' : '') + (matches[3] && matches[3]); //sec | |
return d; | |
} |
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 | |
/* | |
カテゴリーに所属する記事に設定されている指定したカスタムフィールドの値をリスト形式で得る | |
*/ | |
function get_category_posts_customfield_value($cat_id, $meta_key) { | |
global $wpdb; | |
$limit = get_option('posts_per_page'); | |
$offset = get_query_var('paged') * $limit; |
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 | |
$result = $wpdb->get_results($wpdb->prepare(" | |
SELECT name | |
FROM $wpdb->terms AS tm | |
JOIN $wpdb->term_taxonomy AS tmt | |
USING(term_id) | |
WHERE tmt.taxonomy = %s | |
AND term_id = %d | |
", 'category', $cat_id)); |
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 | |
/* | |
$cat_idで渡したカテゴリーIDに登録されている記事の情報を返す | |
返す情報はSELECTの内容に基づく(記事IDと記事タイトル) | |
参考:https://qiita.com/m-shin/items/cec1b8278448e70be168 | |
get_category_posts_data(get_cat_ID(single_cat_title('', false))); | |
*/ | |
function get_category_posts_data($cat_id) { |
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
/** | |
* jQuery Pager plugin | |
* Licensed under the MIT license | |
* This plugin is refer to how to write "jQuery ScrollSpy Plugin". | |
*/ | |
(function(factory) { | |
'use strict'; | |
if (typeof define === 'function' && define.amd) { | |
define(['jquery'], factory); | |
} else if (typeof exports !== 'undefined') { |
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
//http://compass-style.org/reference/compass/css3/flexbox/ | |
//http://jsdo.it/Tenderfeel/ofwd | |
@include flexbox(( | |
display: box, | |
box-orient: vertical, | |
box-pack: justify, | |
box-align: start | |
), $version: 1); |
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
var isIE = (function() { | |
var ua = navigator.userAgent.toLowerCase(); | |
if (ua.indexOf('msie') >= 0 || ua.indexOf('trident') >= 0) { | |
var array = /(msie|rv:?)\s?([\d\.]+)/.exec(ua); | |
return (array) ? array[2] : true; | |
} else { | |
return false; | |
} | |
}()); |