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 | |
//ファイル名はご自由に | |
//ディスク容量気をつけてね | |
if ( WP_DEBUG_LOG ) ini_set('error_log', TEMPLATEPATH.'/log.php'); | |
wp_log(array('テーマ編集からログを見れるようにするには' => '.phpにするのが最も容易。')); | |
function wp_log($message) { | |
if (WP_DEBUG === true) { | |
$message = ( is_array($message) ) print_r($message, true); |
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
#CVSディレクトリ削除 | |
$ rm -fr $(find ./ | grep "/CVS$") | |
#ファイル数 | |
$ ls -1 | wc -l | |
#ディレクトリorファイルの容量 | |
$ du -sh ./* | |
#300分以前に更新されたファイル一覧 |
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
//標準のショートコードを削除する場合 | |
remove_all_shortcodes(); | |
/* | |
[p id='AAA']BBB[/p] to <p id="AAA">BBB</p> | |
*/ | |
add_shortcode('p', function($atts, $content=''){ | |
extract(shortcode_atts(array('id' => ''), $atts)); | |
return "<p id=\"{$id}\">{$content}</p>"; | |
}); |
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
<script> | |
/** | |
* @link http://tokkono.cute.coocan.jp/blog/slow/index.php/xhtmlcss/asynchronous-loading-of-major-social-buttons/ | |
*/ | |
(function(w,d){ | |
w.___gcfg={lang:"ja"}; | |
var s,e = d.getElementsByTagName("script")[0], | |
a=function(u,f){if(!d.getElementById(f)){s=d.createElement("script"); | |
s.src=u;if(f){s.id=f;}e.parentNode.insertBefore(s,e);}}; | |
a("//b.st-hatena.com/js/bookmark_button.js");//hatena |
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
// HTML5以降 | |
// 履歴に#URL#を追加 | |
history.pushState(null, null, '#URL#'); | |
// 履歴を#URL#に書き換え | |
history.relpaceState(null, null, '#URL#'); | |
// 戻るor進むイベントを取得 | |
window.addEventListener('popstate', function(e) { | |
var path = location.pathname; |
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
<a href="リンク先" onclick="javascript:ga('send', 'pageview', '識別名');">リンクテキスト</a> |
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 get_social_count() { | |
var list = $(".fb .count").map(function(index, el) { return $(this) }); | |
if ( !list ) return; | |
for (var i = 0; i < list.length; i++) { | |
var el_f = $(".fb .count:eq("+i+")"); | |
var url = el_f.parents("li").children("a:eq(0)").attr("href"); | |
get_count_fb(url, el_f); | |
} | |
} |
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 | |
require_once '/to/path/Opauth/Opauth.php'; | |
$config = array( | |
'security_salt' => '-----', | |
'path' => '/auth/', | |
'Strategy' => array( | |
'Twitter' => array( | |
'key' => '-----', | |
'secret' => '-----' | |
), |
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 xmlfile2array($filepath) { | |
if ( !file_exists($filepath) ) return false; | |
$xml = @simplexml_load_file($filepath); | |
return json_decode(json_encode($xml), true); | |
} | |
function xmlstr2array($str) { | |
$xml = @simplexml_load_string($str); | |
return json_decode(json_encode($xml), true); |
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 | |
remove_action('wp_head', 'wp_generator'); | |
remove_action('wp_head', 'rsd_link'); | |
remove_action('wp_head', 'wlwmanifest_link'); | |
remove_action('wp_head', 'wp_shortlink_wp_head'); | |
remove_action('wp_head', 'feed_links_extra', 3); | |
remove_action('wp_head', 'feed_links', 2); | |
remove_action('wp_head', 'index_rel_link'); | |
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); | |
remove_action('wp_head', 'parent_post_rel_link', 10, 0); |
NewerOlder