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関数がほとんど使えるようになる! | |
include 'wp-load.php'; | |
// オプションを10件取得 | |
$options = $wpdb->get_results("SELECT * FROM {$wpdb->options} LIMIT 10"); | |
// 公開済み投稿の本文の長さを全部足す | |
$query = <<<SQL | |
SELECT SUM(CHAR_LENGTH(post_content)) |
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 | |
$table = new \cli\Table(); | |
$table->setHeaders( $header ); | |
$table->setRows( $body ); | |
$table->display(); |
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" class="blog logged-in epub-toc rtl" | |
xmlns:epub="http://www.idpf.org/2007/ops"> | |
<head> | |
<meta charset="UTF-8"/> | |
<title> 目次</title> | |
<meta name="viewport" content="width=device-width"/> | |
<link rel="stylesheet" href="../Asset/wp-content/themes/hametuha/assets/css/epub.css" type="text/css"/> | |
</head> |
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
#!/usr/bin/env php | |
<?php | |
if( isset( $argv[1] ) && preg_match('/(-{1,2})?help$/', $argv[1] ) ) { | |
echo <<<'TXT' | |
/** | |
* Archive git diff file between specified commit | |
* | |
* git_diff ./archive 29879823c HEAD | |
* | |
* Enter above, diff between HEAD and 29879823c will be arvhived to `./archive`. |
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 | |
the_post(); | |
/** | |
* Get color function. | |
* | |
* Get term meta on loop is little bit annoying. | |
* You should define some wrapper function. | |
*/ | |
function get_color($tag){ |
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 | |
/** | |
* A template loader which accepts arguments. | |
* | |
* @param string $slug | |
* @param string|array $name | |
* @param array $args Arguments to pass. | |
* @param bool $echo If false, return string. | |
* @param string $glue Default is '-'. You can specify '/' which means directory separator. | |
* |
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
on run {input, parameters} | |
tell application "Pages" | |
activate | |
open input | |
tell front document | |
-- GET ALL TAGS | |
set theseTags to the tag of every placeholder text | |
-- FILTER FOR UNIQUE TAGS |
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
update tweeter_usermeta set meta_key = 'tweeter_capabilities' where meta_key = 'wp_capabilities'; | |
update tweeter_options set option_name = 'tweeter_user_roles' where option_name = 'wp_user_roles'; |
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 | |
# ID1でログインする | |
include __DIR__.'/wp-load.php'; | |
wp_set_auth_cookie(1); | |
header( 'Location: '.admin_url() ); | |
exit; |
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 | |
// | |
// ここから書いていく | |
// | |
add_action( 'rest_api_init', function(){ | |
register_rest_route( 'tweeter/v1', '/friends/(?P<user_id>[0-9]+)/?', [ | |
[ | |
'methods' => 'POST', | |
'callback' => function($params){ |