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
/**************************************************************************** | |
指定したキーワードで、Youtube動画を検索して、もっとも近い動画を再生したい。 | |
動画の再生は、サイト内で行いたい。 | |
デモサイトはこちら | |
http://ticklecode.com/present/150206_wp_moku_YouTube_API/ | |
******************************************************************************/ | |
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 | |
/******************************************** | |
WordPressテーマファイル用 | |
キーワード指定からの、YouTube動画取得と再生 | |
※APIキーの設定が必要です。 | |
出力したいテーマでコードを埋め込んでください。 |
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 transient_remote_get($url, $expiration = 3600) { | |
$transient = 'remote_get-' . md5($url); | |
if ( ! ($response_body = get_transient($transient)) ) { | |
$response = wp_remote_get($url); | |
if( !is_wp_error($response) && $response["response"]["code"] === 200 ) { | |
$response_body = $response["body"]; | |
set_transient($transient, $response_body, $expiration); | |
} else { | |
$response_body = false; |
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
// 電話番号画像をダイヤルできるように変更する。 | |
// スマホデバイスのみ対象 | |
// | |
// 使い方 | |
// img タグに class="tel-link" を入れておく。 | |
// CSS で .tel-link-add {display:block;} でタップできるようにする。 | |
// | |
function fncTelLink(){ | |
var telno = "117"; | |
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
// Uderscore などが $ を使用しているので、無効して再定義。 | |
// 対象のJSファイルのみで有効なので、他のファイルでは、 $ が使える。 | |
// ここでは $ を無効にして、 jq を有効。 | |
var jq = jQuery.noConflict(); |
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 | |
// acquisition of the new article | |
// | |
// Japanese | |
// 新着記事の取得 | |
// | |
$args = array( | |
'post_type' => 'post', | |
'posts_per_page' => 3, | |
'post_status' => 'publish', |
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
// JavaScript | |
// Makeing TimeStamp | |
// Format: yyyymmddHHDDSSMMM | |
// | |
function getTimeStamp(){ | |
var time_stamp; | |
var objDate = new Date(); | |
time_stamp = objDate.getFullYear() + ( "0"+( objDate.getMonth()+1 ) ).slice(-2) + ( "0"+objDate.getDate() ).slice(-2) + ( "0"+objDate.getHours()).slice(-2) + ( "0"+objDate.getMinutes()).slice(-2) + ( "0"+objDate.getSeconds() ).slice(-2) + ( "00"+objDate.getMilliseconds() ).slice(-3); |
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
/*-------------------------------------------*/ | |
/* Load CSS | |
/*-------------------------------------------*/ | |
add_action('wp_enqueue_scripts', 'add_css' ); | |
function add_css(){ | |
// Debug Mode is Cash Clear | |
if (WP_DEBUG){ | |
$version = date("YmdHis"); | |
} else { |
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
// Hover Action Image Change | |
function fncHoverAction(){ | |
// | |
// If there is hover-action in class,I change an image in mouse hover | |
// | |
// How to use | |
// <img class="hover-action" src="head_text.jpg"> | |
// | |
// When Mouce Hover change image | |
// head_text.jpg -> head_text_hover.jpg |
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
// REVISON | |
define('WP_POST_REVISIONS',2); | |
//*********************************** | |
// Contact Form 7 Auto p-tag Control | |
// <pre> tag use when false setting | |
define( 'WPCF7_AUTOP', false ); | |