Skip to content

Instantly share code, notes, and snippets.

@hykw
hykw / gist:85860e7e9b5bfdd113d6
Last active Aug 29, 2015
wordpress: 相対パスでのwp-load.phpの読み込み方
View gist:85860e7e9b5bfdd113d6
$wpload = sprintf('%s/wp-load.php', $_SERVER['DOCUMENT_ROOT']);
require_once($wpload);
@hykw
hykw / gist:a78d1a28155d47768986
Last active May 24, 2016
wordpress: WP_Query() 呼び出し例
View gist:a78d1a28155d47768986
$args = array(
'post_type' => array(
'post',
),
'post_status' => array(
'publish',
),
'posts_per_page' => 5,
'order' => 'DESC',
'orderby' => 'date',
@hykw
hykw / gist:f62244c4fe1924ecfd6d
Last active Aug 29, 2015
wordpress: 固定ページでページング
View gist:f62244c4fe1924ecfd6d
■コンテンツ側
<!--nextpage-->
■php側
<?php
# ページングタグを表示する所で設定
wp_link_pages();
--------
c.f.
@hykw
hykw / gist:27f9586f2e9af88afe56
Created Jul 18, 2014
wordpress: 投稿画面に注記を追加
View gist:27f9586f2e9af88afe56
function after_title() {
echo '<p>これはタイトル下に表示される</p>';
}
add_action( 'edit_form_after_title', 'after_title' );
function after_editor() {
echo '<p>これはエディタ下に表示される</p>';
}
add_action( 'edit_form_after_editor', 'after_editor' );
@hykw
hykw / gist:3e43d3e62d34bb7e718e
Created Jul 18, 2014
wordpress: 投稿画面の項目非表示
View gist:3e43d3e62d34bb7e718e
function remove_default_post_screen_metaboxes() {
remove_meta_box( 'tagsdiv-post_tag' , 'post' , 'side' ); /* 投稿のタグ */
}
add_action('admin_menu','remove_default_post_screen_metaboxes');
@hykw
hykw / gist:bb0a1d034b648c275643
Last active Aug 29, 2015
MySQL: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
View gist:bb0a1d034b648c275643
/etc/my.cnf
-------------------------
default-character-set=utf8
character-set-server = utf8
collation-server=utf8_general_ci
init_connect='SET collation_database = utf8_general_ci; SET collation_connection = utf8_general_ci'
skip-character-set-client-handshake
-------------------------
mysql> ALTER DATABASE db CHARACTER SET utf8 COLLATE utf8_general_ci
View gist:65fb50edf11edf1cd9bc
$nonce = wp_nonce_field('pagename', '_wpnonce', true, false);
<form>
{$nonce}
</form>
---------------------
if(is_page('pagename') && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'pagename')) {
#
} else {
View gist:cccc8790fbb252ec7357
openssl s_client -connect ssl.example.com:443
というか、telnet-ssl 入れて
telnet-ssl -z ssl ssl.example.com 443
@hykw
hykw / gist:1c086f031b28fd942455
Created Sep 12, 2014
telnet のかわりに openssl で接続
View gist:1c086f031b28fd942455
openssl s_client -connect example.jp:443 -quiet
You can’t perform that action at this time.